Advertisement

Phong Shading, how?

Started by October 29, 2000 03:29 PM
4 comments, last by okapota 24 years ago
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.
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...

Advertisement
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.
Prosser: But the plans were on display.Arthur Dent: On display? I eventually had to go down to the cellar.Prosser: That's the display department.Arthur Dent: With a torch.Prosser: The lights had probably gone.Arthur Dent: So had the stairs.Prosser: But you did see the notice, didn't you?Arthur Dent: Oh, yes. It was on display in the bottom of a locked filing cabinet stuck in a disused lavatory with a sign outside the door saying "Beware of the Leopard." Ever thought of going into advertising?
Well, you could use the register combiners if you own a GeForce, have a look at the Nvidia site for demos (with source).
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
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.

This topic is closed to new replies.

Advertisement