View Full Version : Phong in OpenGL
I have a problem, I need draw a Phong light Source.
Please tell me how do it.
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 ?
I need one aproximation of how do Phong Shading in OpenGL. A method for simulating Phong.
12-28-2000, 02:58 AM
Newer gfx cards have per-pixel shading, which means they do phong. Search for the "phong" opengl extension.
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.
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.
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.