- Home /
Directional lightmap in custom shader.
I have this error:
"Fragment program 'frag': Unrecognized sampler 'samplerunity_lightmap' - does not match any texture and is not a recognized inline name (should contain filter and wrap modes)"
when I write
"UNITY_SAMPLE_TEX2D_SAMPLER (unity_LightmapInd, unity_Lightmap, i.uv1)."
I'm just trying to get directional lightmap in custom shader, but i have this strange error. if i write "unity_Lightmap" instead of "unity_LightmapInd" i don't have error.
Answer by shivaduke28 · Nov 09, 2021 at 01:11 PM
This occurs when you use unity_LightmapInd
without unity_Lightmap
. unity_LightmapInd
is supposed to use the sampler of unity_Lightmap
, named samplerunity_Lightmap
. If you do not use unity_Lightmap
in your shader, then the optimizer will strip it and its sampler from shader.