Paper Modeller 03 with smoothing control

Published July 19, 2011
Advertisement
Maybe it isn't worth a journal entry, but I successfully implemented the automatic smoothing generation feature for shading the models. It was a necessary visual feature (totally smooth or totally faceted display was not only ugly, but disturbed the spatial sense too) but it was also important for editing/unfolding.

Smoothing is usually controlled through smoothing groups.
Smoothing groups are polygon/triangle based: every triangles have one or multiple smoothing group ID:s which control the vertex normal calculation: which triangle normals should be used for calculating the final interpolated vertex normal. The ID:s can be assigned in multiple ways (I guess every mayor 3D modelling applications support that), manually assigning values or "auto smooth" features with angle threshold.
It is important to note that .obj format doesn't support multiple smoothing group ID:s per triangle (or at least some exporters doesn't).


My approach is different: the automatic smoothing generation is edge based. That means in some cases the output of my algorithm and triangle/polygon based algorithms will differ even with the same angle threshold (see first image: the windows of the car).
smooth_compare.JPG
This approach suits better the needs of a paper modeller, where some sharp edges are need to be perforated or etched before bending. These bend-edges are displayed too (see images below), and will affect the automatic unfolding feature. It will be possible to manually define bend-edges too.


The algorithm starts with simply detecting bend-edges (by the angle of the two side triangles), then comes the ugliest son-of-a-bitch hacked algorithm ever, it's such an ugly bitch that I even made a screenie about it:
source_screenshot_small.jpg
It works nicely but in some degenerate cases it doesn't give good results (shared vertex but non-continuous surface), I'll deal with it some time...
See the screenshots with different angle thresholds below.

Some smaller stuff: I managed to use DevIL for loading images as textures, thanks for the posts in the other entry and Gaiiden for putting some focus on that entry!
Added "zoom to extent" feature, and vertex normal display (it's only useful for debugging the smoothing).
Replaced the jaw/pitch camera rotation to "arcball" rotation (or whatever it's called..).

Next: *sigh* selection and undo/redo *sigh*. I'll dig myself into Aardvajk's journal....
Maybe some refractoring too *sigh*

sm_01.JPGsm_02.JPGsm_03.JPGsm_04.JPG


sm_05.JPGsm_wireframe_01.JPG
sm_wireframe_02.JPG
0 likes 1 comments

Comments

zarfius
Looking good
July 27, 2011 12:08 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement