help with another simple ligthing problem

Hi guys, continuing my work with lighting, now actually I have not a problem at all, but a doubt. Look at the image bellow:


click for enlarge

I did note OpenGL doesn’t calculate if a object is in front of another, in order to receive light (if a objects shadows another). In this image, the light source is slightly up the truck but far behind it. The circulated plate is receiving light even standing hide from the light source, hide behind the truck in relation to the light source. If the plate is hidden from the light, why is it receiving light?

Like I said, I did note Opengl doesn’t do that by itself. How can I control that? Is there any “easy” way?

Regards!

Opengl does not do itseft any occlusion computations. What you see is just a gouraud shading artifact.

read this at “2. Poor Tessellation Hurts Lighting” section.

OpenGL doesn’t know if an object hides another. It only knows the spatial relation of the current vertex/fragment, light, camera and surface normal. No ‘easy’ way to control that, you need to check how to do shadows.

I read 2. Poor Tessellation Hurts Lighting but I could not link that with my doubt.

I don’t want to use shadows, is complicated, is there another trick to do, such materials properties to that plate?

Even if you changed material properties for that plate, it would be view/light position dependent. So, to be short, no easy way to get out of this.

If you don’t intend to mess with shadows at this point, try to improve on other important things (e.g. shaders) that improve quality.

It is not linked to shadows, this is just because fixed pipeline computes lighting per vertex and then interpolates color at each fragment.

To solve this, you can use a fragment shader and use per pixel illumination like Phong model or not use a spot light.

EDIT: Are to other part of your green object poor tesselated? Check also the normals you set

dletozeun, he said that the light comes from the back of the truck, and we see the front (you can see the ambient on the facing side of the truck), so it’s probably a combined problem of shadowing & the interpolation artifact.

Sorry, here is how it is:


click to enlarge

the scene is ugly, but it’s all I need for while. After this I’ll apply texture. I’d just want to get rid of these problems of shadows and lighting, it seems lighting is the most difficult part of rendering in rasterization. How I love ray tracing… :frowning:

I think in setting the sun at 12:00 PM. :smiley:

I am happy to see your beautiful truck, but that does help us if you don’t emphasize the lighting bug, I don’t see it here…

In ray tracing, you don’t have this problem, because all is done per pixel, but lighting is still complicated (depending on your needs)

EDIT: babis is right. Try to put the light in front of the truck.

If you don’t want to check shadows (which is pretty logical), just ignore it for now & focus on the rest. Don’t expect to have a perfect scene before you delve into texturing.

The problem is simple:

Just look at the wheel splasher. It is not intended to receive direct light from the sun, since the truck’s cabin places between them.

So now your problem is about shadows?? As babis and I said, Opengl does not manage shadows, you have to do it yourself. There is many algorithms that intend to do that, shadow mapping looks like to be the easiest to implement (At least basic shadow mapping).

How much time is OpenGL’s shadows learning curve? I don’t have any material to study, just tutorials bad explained. :frowning:

Another thing I’m sad is in tesselation. My scene is composed purely by 4 vertex quads, this is ugly. I’d want to do some beautiful curves, even the quads I’d like to draw in a series of vertex to take better lighting approach. I read about tessalation and I just could not got how it works, it is much complicated. I tried to use NURBS but it is slow as hell and I can’t put it in a display list without bugs.

Yeah, I’ll research about shadow maps, I don’t have many other choices.

Thanks.

nurbs - display lists - vertex lighting. I’d suggest you to forget the deprecated stuff and start checking VBOs, FBOs & shaders if you will be messing with GL for some time.

where can I find good stuff to learn about that?

Google! Ozone3D has a tut about VBOs, FBOs tut + an example class from GPGPU.org (you can also find 2 articles in gamedev), and you can start learning GLSL from Lighthouse3D. Avoid just-code tutorials at all costs.

Ok, thanks a lot!