Hi,
I like to ask if there is a performance difference for using Terrain or static triangle? Currently I'm using triangle mesh for terrain directly instead of heightmap, so I like to ask if there is a disadvantage of using static triangle. Terrain size is 10km, around 20K vertices, on a very low end specs.
Terrain or static triangle
-
- Posts: 136
- Joined: Sun Jan 17, 2010 11:35 am
Re: Terrain or static triangle
I have found that a height map is faster (but not by heaps) but also less accurate. Things are far more likly to fall though the world or intersect the world than with a static triangle mesh.
One thing you could do is split you static tri mesh up into 0.5km*0.5km chunks so on a 10km by 10km map you would have 400 chunks, and just insert them when needed. However the static tri mesh is a quadtree i believe so it may not help speed that much. But i'm sure norbo will know
I have also found that it will really slow down the simulator if you have more than 10-20 tris in very close proximity to each other in the tri mesh.
One thing you could do is split you static tri mesh up into 0.5km*0.5km chunks so on a 10km by 10km map you would have 400 chunks, and just insert them when needed. However the static tri mesh is a quadtree i believe so it may not help speed that much. But i'm sure norbo will know
I have also found that it will really slow down the simulator if you have more than 10-20 tris in very close proximity to each other in the tri mesh.
Re: Terrain or static triangle
Thanks for sharing.
Inserting dynamically is not an option for me because the whole map is actively using it.
10 - 20 triangles in cloes proximity means?
Inserting dynamically is not an option for me because the whole map is actively using it.
10 - 20 triangles in cloes proximity means?
-
- Posts: 136
- Joined: Sun Jan 17, 2010 11:35 am
Re: Terrain or static triangle
more than 20 or so in a .5 by .5 by .5 space and it starts to slow down (expesially on 360) we had to just get very low poly physics versions of our models made up. Other than that it works fine.
Ahh the whole 10km is in use. hmm well a heightmap would probably be faster. what kind accuracy do you need? racing game, flight sim, shooter, rts etc..?
For most games you can get away with a low accuracy, also may i suggest tweaking the iteration count of the simulator. (the default is 10) if you arn't doing heaps of stacking 3-6 works quite well and gives you a mighty speedup.
Ahh the whole 10km is in use. hmm well a heightmap would probably be faster. what kind accuracy do you need? racing game, flight sim, shooter, rts etc..?
For most games you can get away with a low accuracy, also may i suggest tweaking the iteration count of the simulator. (the default is 10) if you arn't doing heaps of stacking 3-6 works quite well and gives you a mighty speedup.
Re: Terrain or static triangle
It's a rts sort of. I have used the heightmap fine on xbox360, there were some issues but were fixed in 0.10 (I think). Now porting to wp7 phone, which is much lower spec, so even more aggressive optimization needed.
-
- Posts: 136
- Joined: Sun Jan 17, 2010 11:35 am
Re: Terrain or static triangle
I would say go with a height map, and if that has problems then try something else.
A height map should use heaps less memory than a static tri mesh (i would think) which would be very important for the phone.
A height map should use heaps less memory than a static tri mesh (i would think) which would be very important for the phone.
Re: Terrain or static triangle
Heightmap would be more work for me. Now currently using a triangle meshes for terrain because the phone has limitation on terrain vertices
Re: Terrain or static triangle
The terrain uses a very direct grid approach based on the horizontal coordinates of entities, so it is fast and has no additional supporting data structures. The StaticTriangleGroup uses a bounding volume hierarchy which is also fast, but is made to support arbitrary geometry and cannot make as many assumptions about the data, making it slower (O(log N) as opposed to O(1)).
Additionally, a single large StaticTriangleGroup/Terrain is currently faster than multiple small StaticTriangleGroups/Terrains.
Provided that triangles are of fairly regular shapes and sizes, StaticTriangleGroups and Terrains should have equivalent collision detection robustness.
In the upcoming versions, as part of the significant collision detection system changes, both the StaticTriangleGroup and Terrain should get a nice bit faster and more robust.
Additionally, a single large StaticTriangleGroup/Terrain is currently faster than multiple small StaticTriangleGroups/Terrains.
Provided that triangles are of fairly regular shapes and sizes, StaticTriangleGroups and Terrains should have equivalent collision detection robustness.
In the upcoming versions, as part of the significant collision detection system changes, both the StaticTriangleGroup and Terrain should get a nice bit faster and more robust.