Quantcast
Channel: Questions in topic: "shader programming"
Viewing all articles
Browse latest Browse all 169

LIGHTMAP_ON shader keyword is never enabled in build.

$
0
0
Currently I have some shaders that make use of the built-in LIGHTMAP_ON keyword. The shaders seem to work as expected in the editor, with the variant being enabled when a material has baked lightmaps. However, in the build, it seems like the LIGHTMAP_ON keyword is not enabled, even though the lightmaps are present. Here's a snippet of the shader: half4 frag(v2f i) : COLOR { #if LIGHTMAP_ON fixed3 lightmap = DecodeLightmap(UNITY_SAMPLE_TEX2D(unity_Lightmap, i.uv1)); color.rgb *= lightmap; return color; #else return fixed4(0, 0, 0, 0); #endif } When the above shader is in the editor, if the lighting is baked, the mesh will appear to have its texture with the lightmaps applied, as expected. When the lightmaps are not baked, the mesh will be all black. In the build, the mesh is always black, even if lightmaps are baked. All other shader variants work fine, and don't require any changes to the build settings in order to be included.

Viewing all articles
Browse latest Browse all 169

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>