attenuation factors

Is there a way to set the OpenGL light attenuation factors kc, kl, and kq in ShaderLab (or elsewhere in Unity)?

Thanks

Not at the moment. The main reason is that in Unity you have more than just OpenGL lighting model - you also have per-pixel lights, implemented with vertex/fragment programs, where lighting is computed “manually”. Of course, you can write your own shaders to compute lighting in any way you like, but it’s not trivial.

Thank you for the reply NeARAZ.

My question was in reference to a thread in the Unity Support forum: “Brighter lights and more attenuation” (http://forum.otee.dk/viewtopic.php?t=1696). Together bigbrainz and I are trying to get finer control over lighting behavior.

Perhaps it would be good to first understand how the ‘attenuate’ and ‘range’ variables in the Light class map to the OpenGL state. Could that be explained?

It seems desirable to have a ‘brightness’ control in the Light class. In the absence of such, could I control the strength of a quadratic fall-off point light in ShaderLab somehow?

Pointers to scripting documentation beyond the online reference would be helpful. Also, I want to avoid requiring GPU programs because many of the customers of our PC-counterpart product have low-end graphics hardware.

Thank you for any insights and instruction you can give. We have enjoyed using Unity immensely!

looks at the nick… wait, you are bigbrainz!

When attenuate is off, the light has no attenuation at all (in GL terms: constant=1, linear=0, quadratic=0).
Otherwise, Unity always uses quadratic attenuation at the moment. The GL quadratic attenuation factor is: 25.0 / (range*range). Other factors are default (constant=1, linear=0). You can’t have further control over the attenuation at the moment.

I’m thinking about adding something like that as well at some point - e.g. “intensity multiplier”. Probably not in the upcoming release though. But it will surely be required once we start playing with HDR stuff, and in general is a nice thing to have.

Yea, that was weird–sorry about that. I was using bigbrainz’ Mac when I last posted, and I forgot to switch forum accounts. bigbrainz and I (RockHound) are both working to port our current product to Unity.

Thanks for the details–this amount of control should be good for us. It is very helpful to understand what is happening underneath.