hey…m tryin to implement phongs illumination and phongs shading model for any polygobal surface. I am facing probelms in calculating vector H and V from the vector ‘N’ …please give me the mathematical tool to do so…

If I understand you correctly (rather, guess what you mean), you can not compute H (half-vector) and V (light direction) from N (normal). You obtain (one of) these vectors from your light source and then perform a dot product with the normal. What is your source of information? Maybe it explains what the H and V vectors are?!

Hey lot of thanks Haan…actually m reading realted stuff from a book “Computer graphics using OpenGL” by Dr F.S.Hills…m a rookie in this field…and m not getting exact ingormation to how to perform this vector obtaining calculations or rather how to obtain one of these vectors from light source …coz in this book theory has been emphasized rather then mathematical aspect …and I have been asigned to implement phongs shading model by my proff. to be completed in next two weeks…so thats the matter…can u give some link or stuff (my mail id: "bhuvi988@rediffmail.com" ) in order to implement phong’s illumination as well as fast phong’s shading…lookin forwrd…

Regards,

Bhuvnesh Pratap Singh

The Phong-Blinn variant with halv-vectors is covered here

http://www.lighthouse3d.com/opengl/glsl/index.php?dirlightpix

In this example, the light vectors are retrieved from standard OpenGL function calls in the shader program. If the example is too advanced you probably have to read up on OpenGL first.

Once you have this example working it should be trivial to compute classical Phong shading (without the halv-vector).

Hey Haan…

Specifically my problem is that after setting up the light source say at point (1,1,1,1) should I calculate the L vector by subtracting the vertex’s cordinates from this point fr every vertex of the mesh ??? & How can I calculate the V vector that signify the viewer’s eye for every vertex ??? plz help

Regards

Bhuvnesh Pratap Singh

Do you use a shader to compute the Phong model?

Naa…I simply want to calculate the light intensity per vertex acc. to Phongs illumination model thats it, and thats why I need those vectors…

I you do that per vertex it is not Phong shading but Gouraud shading. This is what the Opengl fixed pipeline already does…