How to find exterior silhouette?

Started by
5 comments, last by cavatina 17 years, 6 months ago
Hi all, Could someone give me a hint about how to find the exterior silhouette of a 3D object? I use "(Normal dot View) < threshold" to detect silhouette, but get some error. This is the result of using n dot v => and when view direction becomes this => I want to get just the exterior silhouette(contour), like this => and this => I study some algorithms of NPR, but I don't want to just render the exterior silhouette, I want to know exactly what is exterior silhouette during program run time. For example, if "some condition satisfy", I can judge it is exterior silhouette. Hope someone could help me, thanks a lot!!! :) cavatina
Advertisement
The problem is that you are basing your silhouette on polygons.
What you really need to do, is focus on Edges.

two adjacent polygons will share one edge.
compare the normals of the polys, if one faces away from the camera and one faces towards the camera. Then that shared edge between them is part of the silhouette.

You can speed up the process, once you find one edge that is part of the silhouette, you can check it's neighboring edge, forming a chain. This will eliminate checking edges that lead into the center of the object and are not near the edge...

This requires that you explicity represent Edges as well as the polygons, and maintain pointers between them so you can quickly check the associations...
I think this would work:

* Render the object to a texture, in a way that the whole object has the same color.

* Mipmap the texture.

* Compare the colors from two diffrent levels, level 0 and some other. With higher level, thicker boarder.

* Render screen quad, if the colors is diffrent and neighter is black, render boarder color.

* Blend boarder with the backbuffer.

For best performance, use a shader. There is a variant of this where you use a normal map in the first step but that one create interior edges to. If you have many objects that you want to render boarder to at the same time you could use many colors, with RGBA you could render 4 boarders and you could probably divide it further with some brainwork:)
Quote:Original post by 51mon
I think this would work:

* Render the object to a texture, in a way that the whole object has the same color.

* Mipmap the texture.

* Compare the colors from two diffrent levels, level 0 and some other. With higher level, thicker boarder.

* Render screen quad, if the colors is diffrent and neighter is black, render boarder color.

* Blend boarder with the backbuffer.

For best performance, use a shader. There is a variant of this where you use a normal map in the first step but that one create interior edges to. If you have many objects that you want to render boarder to at the same time you could use many colors, with RGBA you could render 4 boarders and you could probably divide it further with some brainwork:)


Uhhh...
No,
He wants to actually calculate the silhouette for use in game logic (probably shadow volumes or something). Not just render it as a graphics post-process effect.

Quote:Original post by cavatina
...I don't want to just render the exterior silhouette, I want to know exactly what is exterior silhouette...




A quick way to get that effect is to a render a larger, fully blue version first, then render the actual model.

nm, you aren't looking for the effect...
Quote:
Uhhh...
No,
He wants to actually calculate the silhouette for use in game logic (probably shadow volumes or something). Not just render it as a graphics post-process effect.

Sorry didn't saw that. Maybe he could still use the technique by rendering the silhouette to a separate surface, depends of what he is actually doing?
Thanks all,
Is there a shader solution to do such task?
Or how to pass these exterior silhouette information into shader stage?
Sorry I still have no idea... :(
If I use back and front face to find silhouette and want do some pixel-process in pixel shader. How should I do this? thx

cavatina

This topic is closed to new replies.

Advertisement