Big problems with lights

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
texel3d
Posts: 23
Joined: Sat Feb 28, 2009 2:45 pm
Contact:

Big problems with lights

Post by texel3d »

Hi,

i have a big problem with lights.
I can't do what i want to do.
How can i put infinite point light ? Is is possible ? and how ?
How can i put directionnal light ?

The tutorials and examples only show how to use point light with attenuation. And The documentation is very limited, and when i follow the things that should be done it does not work.

When i try to use directionnal lights, i have always the light in the same direction.

Code: Select all

scene::ILightSceneNode* nodeLight = smgr->addLightSceneNode(0, core::vector3df(0, -1, 0),
		video::SColorf(1.0f,1.0f,1.0f,1.0f),
		20000.0f);
nodeLight->getLightData().Type = video::ELT_DIRECTIONAL;
nodeLight->getLightData().Direction = core::vector3df(1, 0, 0); 
nodeLight->getLightData().SpecularColor = video::SColorf(0.0f,0.0f,0.0f,1);
nodeLight->getLightData().AmbientColor = video::SColorf(0.0f,0.0f,0.0f,1);
Maybe my question is stupid, but i need help.
I use Irrlicht 1.5
Hirte
Posts: 73
Joined: Sat Apr 01, 2006 1:32 pm

Post by Hirte »

You can only use 8 lights in your scene, it is a hardware limitation.
But in irrlicht 1.6 (SVN) there is a lightmanager with (theoretically) unlimited lights, but only up to 8 lights per object.
texel3d
Posts: 23
Joined: Sat Feb 28, 2009 2:45 pm
Contact:

Post by texel3d »

When i write "infinite light" i mean light without attenuation.
And what about my other problems ?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Did you dare to read the documentation? The light data clearly states that you're not supposed to alter Direction and Pos. You have to move and/or rotate the light scene node. This will give you a proper position of your point light and make your directional/spot light change its cone's direction. Attenuation can be changed by altering the attenuation :shock: Simply set (1,0,0) and you have the effect disabled. Or do you want to set ambient light? This would go via the scene manager.
texel3d
Posts: 23
Joined: Sat Feb 28, 2009 2:45 pm
Contact:

Post by texel3d »

Ok. I understand now.
Some tutorial seems to be wrong on the web. They modify read only data of SLight (type).

Example:
http://www.portail-irrlicht.fr/wiki/ind ... c:irrLight
http://www.siteduzero.com/tutoriel-3-56 ... -soit.html

It's strange to mix read only and non read only data in the SLight.

I think i understand that i need to translate and rotate the light node to set new position/ direction.

But how to set the type to ELT_DIRECTIONAL if it is read only in SLight ? I don't find how to do that in the documentation.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

The ILightSceneNode has all the required methods. The tutorials seem to be outdated, because the direct access was the method in 1.3 and earlier versions.
Keyosz
Posts: 4
Joined: Wed Jul 14, 2010 8:31 am
Location: Italy

Post by Keyosz »

Post Reply