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?
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.
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.
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…
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.
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.
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.