- Home /
Unity Terrain Performance
Hi,
We are currently in the pre-production of our next game that will be developed using Unity3D and I'm wondering what performance implications using the built-in Unity terrain has (http://unity3d.com/unity/features/terrains).
Our game is developed for the web player and should run with a minimum of constant >15fps on low-end laptops (not netbooks, but with a dual core cpu and an integrated graphics card). This means we have to keep the number of draw calls and, more importantly, the polygon count low since integrated gpus use the cpu for vertex transformations.
Unfortunately I can't find much information about the internal workings of the Unity terrain, so I can't judge how well it performs against terrain modeled in Maya and imported as FBX:
- Is the created terrain a single vertex buffer that is always rendered as a whole, even when just parts of the terrain are visible?
- How does Texture Painting on the terrain work? Are drawn features baked into a single texture or are they rendered using multitexturing, needing multiple draw calls?
- Does Unity employ any terrain rendering/LOD techniques such as ROAM, Clipmaps or Persistent Grid Mapping to enhance rendering performance?
In our game we use an isometric camera (can be moved, but the view direction will stay the same inside a level). This means that only a small part of the terrain is visible at once, so it is necessary that the rest of the terrain is culled away as early as possible to avoid many vertex transformations. A technique such as Persistent Grid Mapping would be suited fine for this scenario, I guess. Another possibility would be to model terrain manually in Maya and import it as multiple meshes to enable view frustum culling.
I would be very thankful for any information about Unity terrain performance and how it may perform against hand-modeled terrain in our case.
Answer by Justin Warner · Dec 29, 2010 at 10:18 PM
You should be fine using it as many people have... Why not do some tests for yourself?
As for culling, that's a pro feature, it comes with the iOS I believe...
Texture painting works well... And I think it'd be a single texture (You can see the height map is only one).
And yes, it has billboarding, which you can control at what distance it starts (For trees and foliage)...
It'd be best to use it for yourself, actually see how it works, personal opinion, but maybe someone else will post more info... Unity is very easy to use for tests, so perhaps you can just do your own...
But yeah, said what I think/know... Hope it helped a little...
I will test the terrain performance trial-and-error wise, but I would love to have more information about how Unity terrains work "under the hood" to have a better idea of: - How performance will scale with larger/smaller terrains - Best practices for using terrain: - Can we use texture painting as much as we want, or use it with care? - Is it better to use a single terrain or to stitch multiple neighboring terrains together (to enable culling)?
As to culling: Although we use the Pro Version, I am quite sure that View Frustum Culling is available in the Indie Version (it's a very basic rendering technique). You may be referring to Occlusion Culling, which is only available in the Pro Version, but won't help us to speed up performance in our case, since we won't have many object occlusions due to our isometric camera.
Answer by Owen-Reynolds · May 09, 2011 at 05:11 AM
Some tests on my non-pro version show terrain has got the basic optimizations (somewhat variable mesh size, LOD, viewport culling):
o Mesh has 1/2 the verts on "flat" areas (set wireframe and look.)
o Drawn in blocks of about 8x8(?) (replace the FirstPass terrain shader and you'll see the "draw blocks." Adjustable distance with the terrain gear.)
o Viewport culling (set Stats while running, walk to the edge of the world and count draw calls.)
o Far blocks drawn with 1/2 the verts (simple stitching) (this is the terrain popping you see as you use height tools), using a single low-res texture pre-built from all of the terrain splats (it uses the Diffuse shader, which takes 1 texture.)
o Near terrain (using the splats) uses one draw call (on each terrain block) per 4 splats. Could write your own "8-splats in one pass" shader, but no way to ask Unity for all terrain splats and two control textures in one pass.