- Home /
Use lightmap data in shader
I'm trying to create a shader which allows me to tint the applied lightmap and also dissolve between two textures.
I have both working in separate shaders but I can't figure out how to combine them.
Any help greatly appreciated.
Dissolve shader: https://gist.github.com/jimfleming/ad643ef3aca7d0e8a743
Original mobile unlit+lightmap shader: https://gist.github.com/jimfleming/edc86d310c15c7e165c9
Well for 1, your dissolve shader is CG and your lightmap shader is ShaderLab. Hard to combine. Tinting is simply multiplying by a color, so give it a color input property, and bind/combine (ShaderLab) or $$anonymous$$ultiply (CG) it by the texture. You may run into an issue with having 3 texture reads, a lightmap read, and a few colors... Just some thoughts. Hope this helps.
Answer by jimfleming · Jul 08, 2013 at 02:03 AM
Finally figured it out. The difficulty was correctly accessing the lightmap from a cg shader.
The code is here with some comments about gotchas.