View Full Version : Phongs illumination model

Pratap

06-26-2008, 02:09 AM

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

Nicolai de Haan

06-26-2008, 09:59 AM

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?!

Pratap

06-26-2008, 10:21 AM

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

Nicolai de Haan

06-26-2008, 12:09 PM

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).

Pratap

07-05-2008, 12:56 AM

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

dletozeun

07-06-2008, 06:33 AM

Do you use a shader to compute the Phong model?

Pratap

07-07-2008, 05:26 AM

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

dletozeun

07-07-2008, 05:42 AM

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

Powered by vBulletin® Version 4.2.5 Copyright © 2018 vBulletin Solutions Inc. All rights reserved.