basic lighting query

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
Th3one
Posts: 17
Joined: Fri Nov 25, 2005 11:43 am

basic lighting query

Post by Th3one »

Hi,

I have disabled dynamic lighting on my weapon because the change in brightness of it looks a bit dodgy. I used the following code to do so:

Code: Select all

weapon1->setMaterialFlag(video::EMF_LIGHTING, false);
I was wondering if there was any way of setting the material so it has a constant lighting level that isnt affected by the other lights in my scene?
krama757
Posts: 451
Joined: Sun Nov 06, 2005 12:07 am

Post by krama757 »

Im a bit fuzzy, but isnt there a way to change the diffuse and specular of materials in the engine? In which case you could make a model and apply a material that isnt affected by light. Then change its specular and diffuse to some value?
Guest

Post by Guest »

hi!

you can change the material colors like this:

Code: Select all

//AmbientColor = the color of the ambient lighting of the node
//SpecularColor = the color of the specular lighting of the node (specular effects are light reflection and such things, like shininess i think)
//DiffuseColor = the color of the diffuse lighting of the node 
//EmissiveColor = the color of the light which the node emits
//Shininess = how much the node shines/reflects .. of you use a very low shininess effect it looks a little like a bloom shader, could look very cool in some scenes


//turn dyn. lighting off/on
node->setMaterialFlag(EMF_LIGHTING, false);

//set the ambient color lower than the MAX (255,255,255,255), because otherwise no specular/diffuse effects are seen (taken from the irrlicht api documentation)
node->getMaterial(0).AmbientColor.set(alpha, red, green, blue);

//set the specular color
node->getMaterial(0).SpecularColor.set(alpha, red, green, blue);

//set the diffuse color
node->getMaterial(0).DiffuseColor.set(alpha, red, green, blue);

//set the emissive color
node->getMaterial(0).EmissiveColor.set(alpha, red, green, blue);

//set the shininess value of the node  (0.0f = off, > 0.0f = on)
node->getMaterial(0).Shininess = 0.0f;
i hope that could help you a bit :)

for further documentation, take a look at SMaterial in the irrlicht API documentation!

good luck! ;)
Th3one
Posts: 17
Joined: Fri Nov 25, 2005 11:43 am

Post by Th3one »

GFX...you are a genius, just what I was looking for. Thanks mate...owe u bigtime :D
Guest

Post by Guest »

If you don't want it affected by lights in the scene but want to have it "lit" why not lightmap it?
Post Reply