PDA

View Full Version : Painting a circle on terrain



schlumpf
11-02-2009, 12:45 PM
Hello,

I have an application rendering terrain. This terrain should be modified. To do so, I have a "brush" I want to show by painting a circle on the terrain.

The terrain is made by 256 triangle strips (per tile). I tried two things so far (and googled for hours): Projecting a texture on the terrain (I failed) and - what I think is better - a cylinder that intersects the terrain as seen here:

http://imagr.eu/up/4aef349177660_circle.JPG

To get only the part of the cylinder intersecting the terrain to show I tried using the stencil buffer, but I failed miserably. (It either did not display the terrain behind the cylinder or just did nothing).

In the last (6?) hours I found nothing on google on how to only show the intersecting parts (the red circle I added with mspaint). So in case anyone knows how to do so and telling me how to do so would do me a huge favor by pasting the code or a short example / description for it. Or at least a hint into the right direction.

I would be really thankful if someone would do so.

Similar: http://www.gamedev.net/community/forums/topic.asp?topic_id=538305

Yeh, if you want to use the stencil buffer, make a cone or cylinder with an inside and an outside the thickness you want the circle to be, then its a matter of shadow voluming it onto the surface.
That way is guaranteed to work.
If your not comfortable with using the stencil buffer, did you know you can also accomplish shadow volumes simply with shaders also.

So look up a shadow volume tutorial and you should be able to apply it to a cone or cylinder to make the circle.
But I did not really get that ._.