Terrain overheads?

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
aCallum
Posts: 13
Joined: Sat Jan 04, 2014 4:31 pm

Terrain overheads?

Post by aCallum »

So, embarking on an exciting project making use of the Unity port of BEPU (on mobile)!

I ran some initial tests and all seemed to work well, creating and updating a few hundred box/sphere entities and some static surfaces gave me constant FPS and accurate collision detection.

Over time, I have began to implement some BEPU terrain entities into the project and appear to be running into difficulties. I am making use of the wheel cast shape wheel colliders and vehicle controller to control a vehicle in the space, when driving on basic box shapes I have good FPS (I say good because I'm sure there are rendering overheads I have yet to optimise for mobile). But, when I move onto a BEPU Terrain, there is a significant slow down (oddly, only seen in the physics, not the overall FPS, but thats another story to do with the timestepping/updating of unity).

So, basically, I would love to know what overheads may exist in Terrain entities in BEPU that may cause this drop (also wheel colliders may be more expensive), I'm assuming they are inherently more complex than box surface? And of course - any insight you may have to reduce this and increase performace.

I have used the configuration utlity to set uper speedy settings (which helped a little) and the terrain entities are created in 15*15 vertex 'chunks' (with a manual distance culling to remove/add chunks that are within certain distance)

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

Re: Terrain overheads?

Post by Norbo »

Terrains are indeed usually more expensive than a simple box, but their collision detection cost is proportional to the number of potentially colliding triangles in the terrain. If a single object's AABB overlaps 100 triangles, it's going to test all of them. If it's just a few (2-8) triangles, it won't be that much slower, especially since there's a lot of things going on in the engine besides collision detection.

I don't have enough information to be very helpful beyond that. It would be good to collect precise per-timestep execution times in the different simulation conditions. It could also be informative to build an equivalent simulation in the BEPUphysicsDemos to check to see if the same performance issues exist. That would also give me an equivalent environment to test things in.
Post Reply