PDA

View Full Version : Get visible contour vertices



Tom19
11-28-2011, 10:42 AM
Hello,

I try to determine which vertices are lying on the border of the object (in current perspective). My idea was to render the full object once to a texture and then erode it (makes the object a bit smaller). Then render only the vertices as points and compare it with the eroded image. Every vertex lying on a colored area should not be a vertex on the contour, because of the erosion.

In short:
1. Rendering full object once with erosion
2. Rendering only vertices as points
3. Compare rendering [1] & [2] and determine points in [2] which are not colored in [1].

In the end I want to have a list of vertices defining the outer contour (no suggestive contours) of the object.

How could I do this efficiently? Render to texture and compare in on cpu? Or is there a better method doing it with shaders and transform feedback?

Thanks for your help!

tksuoran
11-28-2011, 11:52 AM
What are you subsequently going to do with the information, is this for CPU or GPU use?

MaxH
11-28-2011, 04:55 PM
If by 'erosion' you mean scaling, I don't think the idea will work if the projection of your object onto the focal plane is concave. What point would you scale about?

How about checking the color of the pixels adjacent to each vertex pixel (on the focal plane). If any of the adjacent pixels are the background color, that vertex is a boundary vertex.

The Little Body
11-28-2011, 05:23 PM
Why don't compare the projected depth value of the vertex with the depth value in the depth buffer ?

Cf. draw the object in a first pass and compare the projected depth value of each vertices in a second pass

If the two depth values are approximatively the same then it's a visible contour vertices, if not this isn't a visible contour vertice.