Transparent, Baked Vertex Lit, Double sided shader request

Anyone know how to go about combining these 2 shaders below to get a transparent, baked vertex lit, 2 sided object. I would really appreciate it.

This one does Double Sided Soft Alpha Transparency:

Shader “Vegetation” {
Properties {
_Color (“Main Color”, Color) = (.5, .5, .5, .5)
_MainTex (“Base (RGB) Alpha (A)”, 2D) = “white” {}
_Cutoff (“Base Alpha cutoff”, Range (0,.9)) = .5
}
SubShader {
// Set up basic lighting
Material {
Diffuse [_Color]
Ambient [_Color]
}
Lighting On

// Render both front and back facing polygons.
Cull Off

// first pass:
// render any pixels that are more than [_Cutoff] opaque
Pass {
AlphaTest Greater [_Cutoff]
SetTexture [_MainTex] {
combine texture * primary, texture
}
}

// Second pass:
// render in the semitransparent details.
Pass {
// Dont write to the depth buffer
ZWrite off
// Don’t write pixels we have already written.
ZTest Less
// Only render pixels less or equal to the value
AlphaTest LEqual [_Cutoff]

// Set up alpha blending
Blend SrcAlpha OneMinusSrcAlpha

SetTexture [_MainTex] {
combine texture * primary, texture
}
}
}
}

And this one does Baked Vertex Lighting:

Shader “Baked Vertex Lighting/Vertex Lit” {
Properties {
_Color (“Main Color”, Color) = (1,1,1,1)
_SpecColor (“Spec Color”, Color) = (1,1,1,1)
_Emission (“Emmisive Color”, Color) = (0,0,0,0)
_Shininess (“Shininess”, Range (0.01, 1)) = 0.7
_MainTex (“Base (RGB)”, 2D) = “white” { }
}

SubShader {
Pass {
Material {
Diffuse [_Color]
Ambient [_Color]
Shininess [_Shininess]
Specular [_SpecColor]
Emission [_Emission]
}
Lighting Off
Cull Off
SeperateSpecular On
SetTexture [_MainTex] {
constantColor [_Color]
Combine texture * primary DOUBLE, texture * constant
}
}

Pass {
Blend One One
Lighting Off
Cull Off

BindChannels {
Bind “Vertex”, vertex
Bind “TexCoord”, texcoord
Bind “Color”, color
}

SetTexture [_MainTex] {
Combine primary * texture
}
SetTexture [_MainTex] {
constantColor [_Color]
Combine previous * constant
}
}
}
}

2 Likes

I have something that almost works, it needs double sided lighting (where only the normal orientation is taken into account)

don’t ask me how this works, no idea where this thing gets its baked vertex color from I did it by trial and error…

Shader "Baked Vertex Lighting/Baked Vertex Cutout No Culling 2" 
{
	Properties {
	    _Color ("Main Color", Color) = (1,1,1,1)
	    _SpecColor ("Spec Color", Color) = (1,1,1,1)
	    _Emission ("Emmisive Color", Color) = (0,0,0,0)
	    _Shininess ("Shininess", Range (0.01, 1)) = 0.7
	    _MainTex ("Base (RGB)", 2D) = "white" {}
   		_Cutoff ("Base Alpha cutoff", Range (.5,.9)) = .5

	}
	 
	SubShader {
		Pass
	    {
			AlphaTest GEqual [_Cutoff]

	   	   	Cull off
	   	   	
	        Material {
	            Shininess [_Shininess]
	            Specular [_SpecColor]
	            Emission [_Emission]    
	        }
	        ColorMaterial AmbientAndDiffuse
	        Lighting On
	        SeperateSpecular On
	        SetTexture [_MainTex] {
	          Combine texture * primary, texture * primary
	  //          Combine texture , texture 
	
	        }
	        SetTexture [_MainTex] {
	            constantColor [_Color]
	            Combine previous * constant DOUBLE, previous * constant
	        } 
	    }
		// Pixel lights
	  //  UsePass "Bumped Specular/PPL"
	}
}
1 Like

thank you so much man after 12 years

1 Like

How could you get this to render shadows?