PDA

View Full Version : How to implement the Smooth shading ?



jerin3D
02-02-2002, 05:35 AM
Hi,

I displyed the 3D object by joining large number of triangles in a window.Three vertices of each triangles are storied in a linked list.In the Display function ,reads the triangle list and display the object. I want to give the smooth shade model to the displayed object.

I read about Gouraud and Phong shading for that.gl functions (glNormal(),glPolygonMode(),glShadeModel(),etc..)i s not sufficient for implementing smooth shading?

How i can implement it?

Regrds,
Jerry

Nervus
02-02-2002, 03:53 PM
First of all, I think it is very bad (from the performance point of view) for your triangles to be held in linked list...

As for the shading part, you should provide OpenGL with vertex normals, not face normals.

chennes
02-04-2002, 02:02 PM
jerin3D -

I'm not sure that I'm understanding quite what your question is - are you having problems getting smooth-shading in GL, or are you asking if GL can do it?

I'll start with the second - Yes, GL can do it, and quite well (IMHO).

Second, you will probably need to do some averaging of your vertex normals - search this forum for discussions of it - I'm sure there are about 8 million posts! Then, if you've got everything set up correctly, you should have a very nice looking smooth surface.

Finally, I'll second the above remark about linked lists - unless you absolutely need them, they tend to use way too much memory and be way too slow for graphics applications.

Good luck,
Chris