Page 1 of 4

Hard/Soft edges for smoothing

Posted: Sat Jun 04, 2005 7:12 am
by Rahu
I had another thread about this, but it got long and complicated :P heres pretty much what everyone agreed on in the last one.

We would like to have the option to set edges as hard/soft and have the smoothing appear in the viewport for proper tweaking. Another feature to work with this is to have autosmooth apply hard/soft attrib to edges so an autosmoothed shape can be tweaked efore a render.

Posted: Sun Jun 05, 2005 2:21 am
by ideasman
This is true, however there is at leasy 3 places normals are generated

Mesh/DisplayList/Rendering engine (autosmoothed)

Apparently these could be unified in some areas, else youd need to add edge based smoothing to all 3 normal generation code.

- Cam

Posted: Wed Jun 15, 2005 6:53 pm
by Rahu
Sorry this reply took so long, didn't notice anyone replied in the first place :P

I'm not much of a 3d coding guy, but I don't see how this would be much different to make than the current face-based system. It would just allow faces next to each other be smoothed to other faces, but not to each other, which I assume is where the trickery comes in.

Posted: Fri Jun 17, 2005 12:38 pm
by ideasman
Good Edge based smoothing would be realy slow unless you have a format that stores which faces are next to each other, faces sharing edges, faces sharing verts etc.

At the moment Blender dosent store this data, so edge based smoothing would be slow since it would have to generate that data on the fly.

Aparently zr was a python implimentation of a topographical mesh datastructure that he may add into blender?? So if this was done Edge based smoothing would be possible

Smoothing groups is the 2nd best option, and would be fairly easy to add.
anyone for smoothing groups?

Posted: Fri Jun 17, 2005 1:01 pm
by kakapo
smoothing groups would be better than the current solution but the workflow is much worse than having the possibility to just make edges hard and soft.

i think edge based smoothing should be implemented for the he-mesh. its data structures contain the needed stuff, right?

Posted: Fri Jun 17, 2005 3:10 pm
by fearandloathing
Manual control over vertex normals is absolutely essential for game development, I was quite shocked to learn that blender didn't have smoothing groups (setting hardness per edge is the better way to go though).
It might be more fun to write a softbody dynamics engine, but manual vertex normals editing is a must-have for any modern 3d package, far more important than softbody dynamics.

Some might argue that since normal maps are becoming the new standard, smoothing groups aren't that important any more.
That's not true, you still need manual control over vertex normals, especially if you plan to use blender for creating mods for contemporary games/game engines like Enemy Territory (ok perhaps it's outdated, but the game is far from dead).

I don't want to come off like I'm demanding the coders to serve me with features, if it weren't for my non-existant programming skills I would have contributed to the blender with code (and vertex normals editing would have been the first thing to contribute), but I'm finding other ways to contribue, I'm sketching up a tutorial on different styles of character rigs right now, and I'm thinking about doing some presets for reference for an eventual rigging script (the actual scripting will have to be done by someone else though).
I'll stop ranting now.

Posted: Sat Jun 18, 2005 12:00 am
by Pierre-Luc_Auclair
ideasman wrote:Good Edge based smoothing would be realy slow unless you have a format that stores which faces are next to each other, faces sharing edges, faces sharing verts etc.
I don't think it would be really slow. It's just a open edge with vertex normals not facing the same way..

Posted: Sat Jun 18, 2005 2:43 am
by ideasman
Pierre-Luc_Auclair wrote:
ideasman wrote:Good Edge based smoothing would be realy slow unless you have a format that stores which faces are next to each other, faces sharing edges, faces sharing verts etc.
I don't think it would be really slow. It's just a open edge with vertex normals not facing the same way..
Could you please write up a detailed description of how it would work?
If it is not too hard I could get a patch made up.

Posted: Sat Jun 18, 2005 6:57 am
by Pierre-Luc_Auclair
I'm pretty sure it would require adding access to vertex normals on meshes.

Well, not really. Here's how it's done (there may be other ways of doing this but to me it's just logical, and what I've found was along those lines):

Image

Basically how I see it you have to split the edges you want hard to have 2 normals to break the smoothing.

Posted: Sat Jun 18, 2005 3:00 pm
by Brandano
I was already thinking about doing this through python before 2.37 came out, but never had time to actually getting down to do that. On top of it Blender comes to your help by having the 'remove doubles' option to weld back edges if you messed up. I was also thinking about a method to edit vertex normals manually, but that requires to be able to select a vertex without being in edit mode, as Blender recalculates normals whenever the mesh is in edit mode and all changes would be lost. I'll give it some tought but I am extraordinarily lazy, so don't expect anything in a short time.

Posted: Sat Jun 18, 2005 3:39 pm
by theeth
Pierre-Luc_Auclair wrote:I'm pretty sure it would require adding access to vertex normals on meshes.

Well, not really. Here's how it's done (there may be other ways of doing this but to me it's just logical, and what I've found was along those lines):

Image

Basically how I see it you have to split the edges you want hard to have 2 normals to break the smoothing.
When you split off vert 10 from vert 6, how do you know which face uses which?

note: I already have a method to do it, but it requires more data that the current mesh structure doesn't have. I have a py wrapper on NMesh that can generate that kind of data and easily do that kind of think in a timely maner, but generating the data is quite slow.

Martin

Maya Polygon Soften/Hard edge workflow

Posted: Sat Jun 18, 2005 5:43 pm
by fobsta
Maya has a really simple workflow to set the shading angle for polygon edges.

Image

Looking at the image from left to right

The poly mesh has the centre edge selected and the user has called up the 'Polygon Soften/Harden Edge Options' box. It is awaiting user input.

The L shaped mesh in the middle has had it's centre edge shading angle set to 180 degrees. The transition shading from one right angled poly to the next is very smooth.

The last mesh has had it's centre edge shading angle set to 0 degrees
. The transition shading from one right angled poly to the next is very abrupt.

Not wanting to start a flame war but in my humble opinion this workflow is much more elegant and flexible than 3DS Max's smoothing groups.

cheers

Posted: Sat Jun 18, 2005 7:54 pm
by Pierre-Luc_Auclair
theeth wrote:When you split off vert 10 from vert 6, how do you know which face uses which?

Martin
It's not important because it is "virtually" the same vertex. When editing they both act as one. The most important thing with hard edges is to keep editability. (is it what you meant?)

Branando:
I guess that to implement normals editing, you would have to have a "set" or "unset" property on each normal. When the recalculation would go over the mesh it would skip the "set" normals. So I also guess that it would require some messing with the normals/smoothing code.

fobsta:
Sorry to say that, but I don't think this is what we should target for a good hard edges (or normal editing) implementation. The threshold method is not really appropriate for production level work IMHO.

Posted: Sat Jun 18, 2005 10:19 pm
by -efbie-
the main coding problem with manual vertex normal is to determine a good space to describe their orientation.

Posted: Sat Jun 18, 2005 11:32 pm
by Pierre-Luc_Auclair
-efbie- wrote:the main coding problem with manual vertex normal is to determine a good space to describe their orientation.
Must be object or tangent I guess. Tangent is more powerful though(and I guess more complex), and could be resused directly for normal maps display. But I think you can convert object<=>tangent..