Terrain - Questions and Possibilities ?

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
thiago
Posts: 22
Joined: Sat Oct 16, 2010 10:32 pm

Terrain - Questions and Possibilities ?

Post by thiago »

Iam currently using the Terrain from Bepu, but its not so good for what i need, i have to build a system that uses very big Terrains (like 50x50 Km2 ).
To render this, i need to do some optimization and i need to control how triangles and normals are created.
Is there a way to send the triangles and normals to the Terrain Class ?

How terrain class manage the triangles, can i want to use those data some way (i need to have some spation partition to draw that efficiently) ?
Another question, Can i change Dinamicaly the terrain (deformation) ? maybe terrain.SetHeight is a good option for this ?
What do you sugest ? (use staticTriangleMesh or something else )

Thanks
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Terrain - Questions and Possibilities ?

Post by Norbo »

The Terrain class as-is just uses a heightfield (2d float array). Sending normals/triangles to it won't help it since it just bases its collision on triangles procedurally created from the heightfield on demand.

The Terrain doesn't really have anything in it that could assist or be assisted by rendering structures; it just uses the regular grid and bounding boxes to find the appropriate triangles.
Another question, Can i change Dinamicaly the terrain (deformation) ? maybe terrain.SetHeight is a good option for this ?
Yes, but be careful when deforming terrain with entities nearby. When the height is changed, it acts more like a teleport than a normal velocity-based movement, so the penetration recovery system will be the only thing pushing entities away. This will work, but the collisions look squishier and things could fall through in some cases.

To simulate a massive terrain, there will have to be a Terrain for what you're currently on, and for anything you're almost going to move to. That is, when you reach the edge of your current simulated terrain, another chunk of terrain is set up to allow you to keep moving. You could do this with multiple Terrains.

Note that truly massive worlds may have floating point precision issues as you go far away from the origin. You may have to use an approach like the one outlined in this post: http://www.bepu-games.com/forums/viewto ... ?f=4&t=971
thiago
Posts: 22
Joined: Sat Oct 16, 2010 10:32 pm

Re: Terrain - Questions and Possibilities ?

Post by thiago »

as always
thank you for the answer

one last thing, using the staticTriangleMesh for large terrain can be aceptable in bepu, or iam wasting memory?
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Terrain - Questions and Possibilities ?

Post by Norbo »

A Terrain will be a little more efficient than a StaticTriangleGroup for things which can be Terrains (heightfields). Changing geometry in a StaticTriangleGroup will be more expensive than a Terrain, too. That's not to say that a StaticTriangleGroup wouldn't work, though.
Post Reply