Lighting Vertex Colors

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
pwierz
Posts: 59
Joined: Sun Aug 20, 2006 3:32 pm

Lighting Vertex Colors

Post by pwierz »

I'm trying to add an overhead light to Tutorial 3 (Custom Scene Node). So I added the following code:

Code: Select all

	scene::ILightSceneNode* light = smgr->addLightSceneNode();

	video::SLight lightdata = light->getLightData();     
	lightdata.Type = video::ELT_DIRECTIONAL; 
	lightdata.AmbientColor = video::SColorf(1.0,1.0,1.0,1.0); 
	lightdata.DiffuseColor = video::SColorf(1.0,1.0,1.0,1.0); 
	light->setLightData(lightdata);
	light->setRotation(core::vector3df(90,0,0));
But all I get is a white pyramid. What I'm looking for is the colors to be the color specified on the vertex when it is facing the light (above the node in this case) and black when away from the light. Sorry to ask such a remedial question but I've been using trial and error and all I'm getting is error. Thanks.
pwierz
Posts: 59
Joined: Sun Aug 20, 2006 3:32 pm

Post by pwierz »

Ahhh... figured it out. Turn the ambient and specular to all zeros and then make the diffuse color white with the alpha turned all the way down. Funny how things make total sense once you figure them out.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Please note that the custom node's vertices are not properly provided with normals (IIRC). So lighting of this mesh could be wrong.
Post Reply