Sign in to follow this  
cavatina

How to find exterior silhouette?

Recommended Posts

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

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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...

Share this post


Link to post
Share on other sites
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:)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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...




Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this