开发者

How to check whether an edge is the outline of a mesh?

开发者 https://www.devze.com 2023-02-19 05:39 出处:网络
I have a 3D mesh that is composed of lots of triangles. I need to only render the outline of this m开发者_如何转开发esh. Please see this image http://postimage.org/image/2jnaopqro/

I have a 3D mesh that is composed of lots of triangles. I need to only render the outline of this m开发者_如何转开发esh. Please see this image http://postimage.org/image/2jnaopqro/

The way that I check whether an edge is outline is to check whether the two adjacent triangle that share this edge have different normal sign relative to current viewing direction. The view direction is defined as the vector pointing outside of the screen.

However, this method doesn't always work. As illustrated by the while arrow, you can see I do miss some of the outline. Do you know why?

Note:

1> I have checked that all normals are computed in CCW
2> The given mesh data is also correct. In other words, 
   no given triangle is returned with wrong order.

I will be very interested to know the limitation of this detection method. As I mentioned early, it works most of the time.

Thank you


If you're looking to do "toon shading," this is often done not by finding the actual edge, but by (for example) filling with white, drawing the mesh as solid black outlined triangles (possibly padded bit), then drawing the mesh as non-outlined white triangles in front of it. The result is a black outline of the mesh.

0

精彩评论

暂无评论...
验证码 换一张
取 消