I really want the unity_Lightmap ones to be the same as _MainTex, my only way of doing this is to write them as GLSL which means having 2 shader versions :S
Is there a way to override the unity_Lightmap declaration?
Performance, they are sampled into a lowp variable then converted to mediump to be applied to the texture, which has quite a hit on low end android devices, so sampling into a mediump would avoid this performance loss.
Okay, I’ll give the reverse question then, why do you need _MainTex to be mediump? The definition of lowp is it can accurately reproduce any 8 bit per channel color (max error is 2^-8 = 0.00390625 = 1/256).
edit: I don’t do much android dev anymore, and when I did we didn’t use lightmaps, so I haven’t had to deal with most of this, but my understanding is just defining things as fixed, half, float get converted to lowp, mediump, highp for GLSL automatically so there’s no need to write a separate GLSL version of shaders.
Again performance, math operations on lowp are slower than highp or mediump, and Unity does not allow you to specify lowp as a sampler2D, only half or default which is mediump or highp respectively, so for best performance, it would really need to be mediump.
Okay, so having experimented, it appears the only way to do this is to write 2 sets of shaders, one for direct in HLSL and the other in GLSL for OpenGL, as you can then declare your own unity_Lightmap variables, there doesn’t seem to be any way to delcare it via HLSL as it seems to be declared regardless of whether you include the cginc with the declaration or not…very odd.