[OpenGL] Light radius doesn't work, and attenuation factor?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
piiichan
Posts: 59
Joined: Thu May 01, 2008 1:20 am
Location: New Caledonia (France - Pacific)
Contact:

[OpenGL] Light radius doesn't work, and attenuation factor?

Post by piiichan »

1)
When I set up a light with ISceneManager::addLightSceneNode() in OpenGL, no matter what radius I specify, it won't be taken into account. Even when I set the radius to 0, the light is still on for very far objects. This doesn't happen with Direct3D.
Is it a bug, or is it me?

2)
I don't fully understand how the attenuation factor works for a light.
Do I have to specify a value for constant, linear and quadratic or only one of them? Must the value be between 0 and 1? What does a value of 0 mean? What about 1?

Thanks!
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

The radius feature is only supported for d3d, but you should instead use attenuation. The default attenuation in Irrlicht is (1,0,0), which means that the light strength does not decrease at all. So it's full bright everywhere on the scene. An attenuation of (0,1.f/radius,0) is the "radius effect" used in previous versions of Irrlicht. It doesn't really work exactly like the radius in d3d, but looks similar. You can play around with the values of attenuation to make the light act really different, so just test on your own.
piiichan
Posts: 59
Joined: Thu May 01, 2008 1:20 am
Location: New Caledonia (France - Pacific)
Contact:

Post by piiichan »

Yep, it works. Thanks. :)

But the documentation should precise the fact that the radius is only supported by D3D, and that GL users should use the attenuation factor instead...
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

I will move the radius setting to ILightSceneNode probably and then make the attenuation change automatically. It's not yet decided and in progress, and that's why it's also not properly documented. Will be sometimes, though :)
Post Reply