Lighting problem

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
merovingian
Posts: 37
Joined: Thu Feb 28, 2008 4:34 am
Location: Perth, Western Australia

Lighting problem

Post by merovingian »

I have a little problem. I have my camera inside a tunnel system. The only light is a light scene node that is at the same position as the camera. The radius of this light does not reach as far as the end of the tunnel. Yet the wall at the end of the tunnel is shining back at me, bright white. Screenshot here:

Image

Naturally, I don't know why that wall is white. Except I am sure that either my model is broken (drawn in Blender, imported as a .3ds file), or my code is broken. At first I thought the issue may have been with the Specular and Mirror colour settings for the wall, but I played with both to no avail. And they are the same as the side walls, the floor and the ceiling. Any ideas?
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

I see you draw with OpenGL. In that case, did you set light range with Radius parameter or Attenuation? OpenGL ignores Radius parameter you have to set light range with Attenuation. hybrid was posting formula to calculate attenuation from range in some post here.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Yeah, attenuation should be set to (0.f,1.f/radius, 0.f)
merovingian
Posts: 37
Joined: Thu Feb 28, 2008 4:34 am
Location: Perth, Western Australia

Post by merovingian »

Thanks fellas.

If I use attenutation, the far wall is no longer bright white, but it's still the brightest object in the tunnel, even though it's well outside the light radius. So it seems that OpenGL/radius is only part of my problem.

I think there must be a problem with my model.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Maybe you have non-normalized normals. This can result in almost arbitrary lighting.
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

Or ambient component of light set too high... for example.
Try to play also with shininess and other attributes of both, light and material.
Kriolyth
Posts: 26
Joined: Wed Mar 26, 2008 6:59 pm
Location: Moscow, Russia

Post by Kriolyth »

Try also tesselating tunnel walls. Usually all lighting is per-vertex and then lightness values are interpolated over whole triangle. If a triangle is too stretched, lighting will never be correct.
The cake is a lie.
Post Reply