We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
smooth polygon faces (Read 914 times)
smooth polygon faces
Apr 11th, 2006, 1:55pm
 
Hi,
Im trying to make 3D polygon shape, and i want the polygons to be smooth, so that there is no visible edge between the adjacent polygon faces. I know its theoretically possible, since most 3d modeling programs have this feature, and also the sphere() object uses this.
Is there a way to add smoothing between and arbitrary set of adjacent polygons?

any hints would be really appreciated!

regards,

Henrik
Re: smooth polygon faces
Reply #1 - Apr 11th, 2006, 2:06pm
 
What you need to do is set the normal() for each vertex, in such a way that the adjacent polygons that share a vertex, use the same normal for it.

The normal is a 3D vector that is perpendicular to the surface. so even though a polygon is flat, you cna set one of the normals to be slightly different, and it'll be interpreted as being a curved surface when it comes to lighting the polygon.
Re: smooth polygon faces
Reply #2 - Apr 11th, 2006, 3:19pm
 
Thanx, that makes sense!
just a little detail: do i call normal() before or after i call vertex() to assign the normal vector?

Henrik
Re: smooth polygon faces
Reply #3 - Apr 11th, 2006, 4:33pm
 
You call it before, and it sets the normal for all the following vertex() calls, until you call normal() again I think.
Re: smooth polygon faces
Reply #4 - Apr 11th, 2006, 7:01pm
 
great! thanks alot!
Page Index Toggle Pages: 1