builtin lightmapped + transparency shader?

Hey,

I might be overlooking things, but is there really no built in shader for lightmapped transparent rendering?

Meaning a RGBA base texture, with the A dictating transparency, multiplied by a lightmap?

Bye, Lucas

Indeed there is no such built-in shader. Which one of lightmapped would you need (vertex lit, diffuse, bumped, …)?

Vertexlit. (for now :slight_smile: )

I guess if you want to support all combinations the number of shaders you’d have to write skyrockets before you know it.

Bye, Lucas

Hey Lucas,

Aras wrote this one for me a little while ago…

Shader "Transparent/Lightmapped/VertexLit" {
Properties {
	_Color ("Main Color", Color) = (1,1,1,1)
	_MainTex ("Base (RGB)", 2D) = "white" {}
	_LightMap ("Lightmap (RGB)", 2D) = "black" {}
	_FallbackColor ("Fallback Color", Color) = (1,1,1,1)
}

// ------------------------------------------------------------------
// Three texture cards (Radeons, GeForce3/4Ti and up)

Category {
	ZWrite Off
	Alphatest Greater 0
	Tags { "Queue" = "Transparent" }
	Blend SrcAlpha OneMinusSrcAlpha 
	ColorMask RGB

SubShader {
	Fog { Color [_AddFog] }

	Pass {
		Name "BASE"
		Material {
			Diffuse [_Color]
		}
		Lighting On

		BindChannels {
			Bind "Vertex", vertex
			Bind "normal", normal
			Bind "texcoord1", texcoord0 // lightmap uses 2nd uv
			Bind "texcoord1", texcoord1 // lightmap uses 2nd uv
			Bind "texcoord", texcoord2 // main uses 1st uv
		}
		
		SetTexture [_LightMap] {
			constantColor [_Color]
			combine texture * constant
		}
		SetTexture [_LightMap] {
			constantColor (0.5,0.5,0.5,0.5)
			combine previous * constant + primary
		}
		SetTexture [_MainTex] {
			combine texture * previous DOUBLE, texture * primary
		}
	}
}

// ------------------------------------------------------------------
// Dual texture cards - no lighting

SubShader {
	Fog { Color [_AddFog] }

	// Always drawn base pass: texture * lightmap
	Pass {
		Name "BASE"
		Tags {"LightMode" = "Always"}
		Color [_PPLAmbient]
		BindChannels {
			Bind "Vertex", vertex
			Bind "normal", normal
			Bind "texcoord1", texcoord0 // lightmap uses 2nd uv
			Bind "texcoord", texcoord1 // main uses 1st uv
		}
		SetTexture [_LightMap] {
			constantColor [_Color]
			combine texture * constant
		}
		SetTexture [_MainTex] {
			combine texture * previous, texture * primary
		}
	}	
}

// ------------------------------------------------------------------
// Single texture cards - no lightmap

SubShader {
	Fog { Color [_AddFog] }

	// Always drawn base pass: texture * lightmap
	Pass {
		Name "BASE"
		Tags {"LightMode" = "Always"}
		Color [_PPLAmbient]

		SetTexture [_MainTex] {
			constantColor[_FallbackColor]
			combine texture * constant, texture * constant
		}
	}	
}

}

Fallback off

}