View Full Version : Phong in OpenGL

12-27-2000, 06:51 AM
I have a problem, I need draw a Phong light Source.

Please tell me how do it.


12-28-2000, 02:23 AM
hey, phong is a lighting model and a shading technique.
opengl uses the phong model for lighting, but currently has only solid and gouraud shaders, so you can't get phong-like rendering this way.

what do you really need ?


12-28-2000, 03:41 AM

I need one aproximation of how do Phong Shading in OpenGL. A method for simulating Phong.


12-28-2000, 03:58 AM
Newer gfx cards have per-pixel shading, which means they do phong. Search for the "phong" opengl extension.

12-28-2000, 04:28 AM
you can do a good phong approximation using spherical environment mapping.

if light position relative to the object don't change very much, you could pre-render a environment map with MAX, for example.
build a sphere with your preferred material,
place the light (or lights) around and render the scene to a square bitmap.

then you load it in your application, next you activate texturing and automatic texture coordinate generation for sphere mapping.

now you have a object rendered with a close approximation to phong shading.

instead, if you want a complete phong shading system, one which dependens on camera, object and light relative position,
then it's just a bit more complex.

you have to rebuild each frame the environment map, and reupload it to gl.


12-28-2000, 07:42 AM
Another way to achieve a "phong like" effect is to use projected textures, using a texture similar to the phong highlight and multitexturing it on your objects.