region filling

Started by
0 comments, last by Erik Rufelt 14 years, 11 months ago
Consider a closed contour, each segment in the contour is defined by two 3D end points, the contour can thus be expressed as an ordered list of vertices, and the first and the last coincide. Imagine to have the contour laying over a mesh, for example a terrain mesh. I would like to fill the portion of the mesh "inside" the contour with a given color. I used a triangulation algorithm to obtain a mesh from the contour, but I am not satisfied with it because I want the region to lay exactly on the terrain mesh. Do you think it can be done in the pixel shader (or in any other way)? cheers, Marco
Advertisement
The easiest way would probably be to draw the triangulated shape to the stencil buffer, then draw the terrain again with stencil testing, only drawing the pixels where the previous shape was drawn.

This topic is closed to new replies.

Advertisement