Shading Instructions and Rasterizer !

calculating Ambient color + diffusecolor + specular color is the lighting calculation.
How ? we were just talking about distances and light vectors and all that stuff , where do these ambient+diffuse+specular values fit in ?

The farther you go from light sources, the weaker they become. So for an accurate lighting calculation, strength of each light source at that point is also considered.
Oh , I get it now , you mean the distance between the light source and a specific vertex , but isn't that the same as the light direction vector ?
 
How ? we were just talking about distances and light vectors and all that stuff , where do these ambient+diffuse+specular values fit in ?
This is the lighting equation! Ambient component can be as simple as a constant color (say dark red) or as complex as global illumination solution that took 2 months offline to compute. Diffuse is what you originaly came up with: normal dot lightdirection. Specular can be something like: (normal dot halfangle)^n where halfangle is a vector half way between light direction and viewer direction and n is the "shines" factor.
All of this are also multiplied by light color (diffuse and specular component), material color (diffuse, specular and ambient component for example). Diffuse and specular are also multiplied by attenuation factor (that's where the distances come in) and possibly shadow values from shadow buffers.
All this is lighting equation.

Oh , I get it now , you mean the distance between the light source and a specific vertex , but isn't that the same as the light direction vector ?
Direction is a vector, distance is a scalar. But yeah, you can calculate distance from an unnormalized light direction vector.
 
Thanks MDolenc and curious.trier , you both have been of a great help .. I can't thank you guys enough :smile: .

I will be back with more questions though , don't let your guards down !:D
 
I stumbled across something called deferred lighting , and I had a hard time understanding it completely , it has something to do with applying lighting as a 2D post process filter .

Q1 ? does that mean that in contrast to forward lighting where lighting is done with 3D coordinates , deferred lighting happens truly in 2D ? then how ?

Q2 ? Why can't we apply Anti-Aliasing in deferred lighting ?

Q3 ? what is the use of depth or normal buffer in this method ?

Q4 ? What is the definition of post processing in general ? I would like a quick overview of what is going on behind it .
 
I stumbled across something called deferred lighting , and I had a hard time understanding it completely , it has something to do with applying lighting as a 2D post process filter .

Q1 ? does that mean that in contrast to forward lighting where lighting is done with 3D coordinates , deferred lighting happens truly in 2D ? then how ?

Deferred lighting means visibility has been completely resolved. Here we defer lighting calculations until *all* geometry for a frame has been rendered. This way we don't do lighting for invisible fragments. It is in 2D because your frames are ultimately 2D.

Q2 ? Why can't we apply Anti-Aliasing in deferred lighting ?

Hardware limitation, resolved in DX10.1

Q3 ? what is the use of depth or normal buffer in this method ?

Normals are needed for lighting. Depth is needed to resolve visibility of objects.

Q4 ? What is the definition of post processing in general ? I would like a quick overview of what is going on behind it .

Post processing is,

a) render a frame's geometry
b) take the rendered frame as a texture and treat it like a 2D image
c) apply some 2D effects like motion blur, focal blur etc.
 
Deferred lighting means visibility has been completely resolved. Here we defer lighting calculations until *all* geometry for a frame has been rendered. This way we don't do lighting for invisible fragments. It is in 2D because your frames are ultimately 2D
Thanks for the nice and straight answer .. :smile:

Post processing is,
a) render a frame's geometry
b) take the rendered frame as a texture and treat it like a 2D image
You mean this happens before Rasterization ? ie on vertices not pixels ?
 
You mean this happens before Rasterization ? ie on vertices not pixels ?

No, all of it happens after pixel shading has been done. Vertices are in 3D, not 2D, then how can you treat it as texture.

I really think you should start playing with 3D code. Simple Nehe Stuff will do fine, doesn't have to be too big or fancy. I can see that there are a lot of half baked concepts in your mind. Playing with code, (even a little bit) will increase your learning efficiency easily by an order of magnitude. It's simply a better way to spend your learning time.
 
Thanks for the answer , really appreciate your help , I will certainly try to start some coding , the thing is , I am quite busy with studying Medicine , this thing is so damned big it doesn't leave much room for anything else , however I will do my best to make room for coding .

I really think you should start playing with 3D code. Simple Nehe Stuff will do fine, doesn't have to be too big or fancy.
Any suggestions ?
 
Head over to nehe.gamedev.org

Start following their tutorials. Great place to start for anyone. You'll need to know C/C++.
 
Head over to nehe.gamedev.org
The site is not working , I don't know why ..

Start following their tutorials. Great place to start for anyone. You'll need to know C/C++
Aha ! I knew I was walking into a trap :p ! I know nothing of C or C++ !
Does OpenGL coding needs C++ knowledge ?

I am a complete noob in coding .. I have never done any of it before.
 
Does OpenGL coding needs C++ knowledge ?
OpenGL as you know is a graphics library containing some graphics functions that help the programmer draw 2D/3D scenes. To be able to use (call) these functions, you need to learn a programming language as rpg said.

I recommend C++ (lots of resources). Online tutorials are available and you can start with MIT's Introduction to C++ course and/or this tutorial.

Use Dev-C++ free compiler to apply the codes in the tutorials. After learning the basics of C++, add the GLUT package to the compiler, then follow NeHe tutorials and download the codes written for Dev-C++ at the end of each lesson.

Btw, thanks for this informative topic and please keep asking :smile:

(I think I know you very well dear Dr.H ;))
 
Last edited by a moderator:
I'd recommend using FreeGLUT instead of GLUT, since it is actively maintained and will allow you to work with OpenGL 3.x, both are available from Fusions GLUT link.

Also, Dev-C++ doesn't look like it has been updated for a few years, so you might want to look at alternatives, be it Visual Studio C++ Express or Code::Blocks or similar.

Good luck!
 
Thanks for the great help rpg.314 , Fusion , MrGaribaldi .. I will let you know on my progress with C++ .

@Fusion , I had my doubts about you the moment I I laid my eyes on your nickname and this thread .. now I know for sure ..:D

Glad I found someone that I belong to in this great community ..
 
Back
Top