None of those work. They are always the same value, no matter what light radius/intensity you change. This makes writing custom lighting routines for point/spot lights impossible.
I can’t attenuate light intensity in a pixel shader, and I remember running into this before a long time ago. There is also no way to get the light radius (_LightPositionRange don’t work either) to do your own linear/quadratic attenuation.
Anyone have any info on this? This seems like a pretty huge broken bit to me.
Interesting enough, if I use “Lighting On” on ALL my custom shaders in the scene is works…sometimes.
But the docs say “Lighting On” is only for vertex lighting, I’m doing per pixel lighting, so what gives. Is unity_LightAtten only working in vertex shader? But it works in my pixel shader *sometimes" as well.
This is very buggy, I can’t seem to figure out what the right settings are to get Unity to pass in unity_LightAtten and work as expected.
Lighting On is for fixed function, and therefore obsolete.
unity_4LightPosX0, unity_4LightPosY0, unity_4LightPosZ0, unity_4LightAtten0, and unity_LightColor[4] are intended to be for vertex lighting, but you could do per-pixel operations using them; you just have to enforce that they are point lights, which could be impossible depending on your scene; you can manually tag the point lights as “not important” to enforce them being integrated into these uniforms. You enable them with Tags {“LightMode”=“ForwardBase”}.