Surface normals for polygons/nurbs

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
simdev
Posts: 8
Joined: Tue Mar 11, 2008 3:18 pm
Location: Bursa,Turkey

Surface normals for polygons/nurbs

Post by simdev »

Hi all,
First of all although I searched for sometime, I could not get a clear topic on this issue.
Hereafter I will use
polygon surface : a surface which has triangles having all 3 vertices exactly the same normals
nurbs surface : a surface which has triangles having vertices set to different normals

Ok,
When a surface is created from triangles, faces using the same index share the same vertice coordinate. But also one vertice can have one normal.
So if you want a contunuity on the surface normals (to have a smooth look) you first get the normals of the triangles sharing the same index and get the average of normals and set the vertice normal based on this value.
But if you want a broken look on the surface (which you can separate the borders of each triangle one by one) you have to isolate vertices of each triangle. So no two triangles can share the same index value.
In order to identify which triangles has isolated vertices in vrml files there is a parameter called crease angle.

I don't know much about other formats.
In my simulation application this surface relation is a very critical parameter.

If you think the above is right why isn't there a way for irrlicht to load nurbs surfaces. Is this information missing in .3ds file for instance or irrlicht loader disregards this information. :?:

Thansk Folks
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

3ds files use smoothing groups to add this information. However, Irrlicht doesn't interpret this information, so it's lost when coming via 3ds. But most other mesh formats do support vertex normals, even in compact form (e.g. obj which separates positions and normals and creates vertices from arbitrary combinations thereof). So maybe just try another format.
Post Reply