Different colors in materials

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
dart_theg
Posts: 87
Joined: Sun Dec 29, 2024 3:13 am

Different colors in materials

Post by dart_theg »

I've always been kind of confused by this:
Which colors in materials are affected by lights vs. when there is no lighting (lighting is off)?

Like when lighting is off, can I influence color with diffuse? Or is it ambient? I need a cheat sheet to recall this every time because I simply can't remember...
CuteAlien
Admin
Posts: 10021
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Different colors in materials

Post by CuteAlien »

Yeah, I get the confusion, was the main reason I wrote the MaterialViewer example. But it's pretty simple - if you turn of light _none_ of those colors affects the material anymore. They _all_ only work with lighting. The only color which affects polygons without lighting are the vertex colors. And how and if the vertex colors affect the polygons depends on the SMaterial::ColorMaterial setting. And... there is a chance I miss something and what I said is wrong (or one of the drivers is wrong), so please correct me if you find a case where it's different.

So... what if you want to use one of the colors in SMaterial instead? Enable Lighting. But what if you don't want light to affect it? Only use EmissiveColor (self-lighting) and set the rest to 0. Or set some global light and use diffuse color in combination with it (kinda depends what you use it for). What if you want transparency? I think I found some trick once described here: viewtopic.php?p=309119 but in general that's when I start using a shader.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
dart_theg
Posts: 87
Joined: Sun Dec 29, 2024 3:13 am

Re: Different colors in materials

Post by dart_theg »

Ahhh ok. I recall in the past I had used lighting but made the ambient color or something bright so a directional light added like a pseudo rim light to some objects. Thank you!
Post Reply