Lightmap with Alpha8 textures

We want to use Alpha8 textures with the lightmap shaders, but that texture format doesn’t seem to work with those shaders. I may be wrong, but it seems that the ‘combine’ command won’t modulate a target RGB with the contents of the Alpha8 format. Perhaps that format is always interpreted as alpha.

Is it possible to use Alpha8 with the lightmap shaders? If not, is there a way in shaderlab, without using programmable shaders, to use an Alpha8 texture to modulate a main texture?

Our goal is to tint a character based on the lightmap it is standing on. Our current approach is to intersect a ray each frame with the lightmap under the character, read the lightmap pixel value, and tint the character accordingly. The GetPixel function we’re using requires ARGB32, RGB24 or Alpha8 formats, but the first two require a lot more video memory than we want to give, particularly since our lightmaps are grayscale.

I suppose another solution is to use a DXT format for rendering the lightmap, and use a second copy of the texture map in system memory to look up texel values.

Thanks for any ideas or feedback.

Would something like this work?

SetTexture[_MainTex] { combine texture }
SetTexture[_LightMap] { combine texture alpha * previous }

Yes that worked! I needed the word ‘alpha’ after the word ‘texture’. Thanks for showing me that syntax.

It would be nice if the alpha keyword was in the Shaderlab documentation.