Archived

This topic is now archived and is closed to further replies.

okapota

Phong Shading, how?

Recommended Posts

okapota    122
i need to "phong" shade my world, into a texture, because i want to create light maps. but i dont know how to simulate phong shading with openGl. should i write the shading rasterizer alone? any ideas anybody? thnx in advance.

Share this post


Link to post
Share on other sites
baskuenen    124
I dont have any eperience with this, but I know OGL doesn''t in any way support phong! If I would have to do this, I would use raytracing, and render my own lightmaps. This might sound difficult, but I think this would be easiest and smoothest method. You can use OGL and render using gouraud, and if you split up your polygons into tiny ones, gouroad would give you a nice approximation I think.

Please correct me if I''m wrong...

Share this post


Link to post
Share on other sites
mars_888    122
I think you''ll have to write it yourself I''m afraid. I now D3D doesn''t do Phong shading, and I think OpenGL doesn''t either. I''m sure there are some good tutorials on the web. You might like to check out www.flipcode.com. I know there are some tutorials on Lightmaps on here. Just go there and select the second option from the top (development tutorials) in the left menu and then go to ''3D Theory / Gfx''. Browse the list and you should find several tutorials. I hope this helps.

Share this post


Link to post
Share on other sites
NeoGL    122
you would have to write your own phong shader which is not too difficult. The main difference is one guy takes the vertex colors at each vertex obtained from the vertex normals and interpolates the color across the facet while the other guy interpolates the vertex normals across the facet and obtain the color from the interpolated normals at any point on the facet. Now, which guy is which is what gets me confused every alternate year. One is phong , the other is gourad, but it doesn''t make a difference to you, you could write your lightmap using gourad shading too. If you haven''t written any shaders before, you can mail me or you can find out the lighting equations in any physics book(optics chapter...?? still called optics ??)

NeoGL

Share this post


Link to post
Share on other sites
okapota    122
thank u all very much, i can write a phong shader thats ok.
i just wanted to be sure, that there are no opengl functions that can help me do that. and i dont have geforece2, so i cant use its extensions.

Share this post


Link to post
Share on other sites