smoothing algorithm without quads

smoothing algorithm without quads
I'm upgrading my webgl renderer program Brigl to work with the latest version of Three.js (the 3d engine i use).
I've found a bitter suprise: they deprecated the Quad primitive (Face4). Now the whole library only deals with triangles (Face3).
I relied to quads for my smoothing algorithm, and everything broke Smile

So my algorithm worked like this: if two faces have a conditional line on the common edge, that means the faces should be smoothed. Smoothing means averaging all normals (per-vertex face normals) at each end of the conditional lines.

I've adjusted for the Face4 removal in the simplest way: by adding two Face3 composing the quad. But now it happends that if i have two quad connected by a condline, only two of the four triangles are affected, the other two staying unsmoothed, effectively creating a zigzag pattern. You can see it here:

[Image: zigzag.jpg]

Do you have any idea on how i could correct this issue? I tried to keep track of triangle pairs forming quads, but i couldn't manage to restore a working solution.
Eventually i could move all smoothing code to BEFORE generating the 3d mesh, that is while still working with plain ldraw objects (quads and tri), but it looks like an huge amount of work..
« Next Oldest | Next Newest »

Messages In This Thread
smoothing algorithm without quads - by Nicola - 2013-08-30, 14:07

Forum Jump:

Users browsing this thread: 1 Guest(s)