Create holes in plane dynamically

Started by
4 comments, last by SirWeeble 8 years ago

Hi,

I have simple big plane and I like to dynamically dig holes into this plane.

Im not sure about my flow.

So I like to create texture, something like height map, where I will draw holes and their depth by CPU code.

After that I will emit new vertices based on this texture in geometry shader and draw it.

Is this good flow or is there other better ways how to achieve this?

Thank you for help.

Advertisement
What's the ultimate purpose? Do you actually need the holes to exist in the geometry, or could you get away with using a texture on the plane, and writing your "holes" to the alpha channel to render those areas transparent?

I working on "prototype" where player use shovel to dig holes into flat terrain. Lets say digging tresure or something like this.

So I need physically created holes which can be deepened further and further with some limit.

So these aren't complete holes in the plane, just deformations?

Try searching for information about Constructive Solid Geometry. That lets you do boolean operations of shapes, so you could setup a ground mesh then subtract the spheres from it. You could also look into voxels, setup a big array of voxels for the terrain, then just start removing the voxels as the user digs. With voxels, you'd still need to look into some way of calculating the mesh from the voxels though, but there should be a lot of information about that online as well.

If you look up the term "marching cubes" or "marching spheres" you'll find some intersting info for 'voxel' methods. The term "voxel" is incorrect, since it's geometry, not pixels, but.. meh..

I'm not sure how usefull it would be though. I think it's really CPU intensive. I think this is one of the biggest barriers to dynamic terrain alteration - especially if you want wide open outdoor terrain.

This topic is closed to new replies.

Advertisement