Problems with handling sharp edges


RE: Problems with handling sharp edges
#2
(2023-04-10, 18:40)Max Murtazin Wrote: So, continuing with my LDraw to xml converter grind, looks like I have managed to solve pretty much everything but one thing - handling sharp edges

I have tried multiple ways, but nothing seems to work. Generally, it seems I should not interpolating normals between faces that share sharp edge, but then arises problem of faces that share only 1 vertex. How this case should be approached?

What techniques have you tried? The simple case is to smooth all normals by averaging the normal at each vertex by summing up the normals of adjacent faces and normalizing the result. Normals are interpolated between vertices when rendering, so you may need to index the vertices differently depending on the normals you calculate.

One approach I've seen is using conditional lines to average normals. I've found that averaging on conditional lines or at least edges that aren't marked sharp produces some artifacts when working with triangulated meshes. Applying the averaging before triangulating should give slightly better results. This seems to be the approach used by some older applications.

Another approach is to just average the normals using an angle threshold. For each vertex in each face, add the normal for any adjacent face that differs by at most some threshold. This is common in hard surface modeling and tends to work well for most parts. There's some example code online like the one here: https://gist.github.com/Ni55aN/90c017faf...8ab6566cfa.

In my Blender importer, I split the sharp edges as well as using an angle threshold. This seems to give better results. I'm still working on recreating this code to work outside of Blender.
Reply
« Next Oldest | Next Newest »



Messages In This Thread
RE: Problems with handling sharp edges - by Jonathan N - 2023-04-14, 14:39

Forum Jump:


Users browsing this thread: 1 Guest(s)