Performance of Terrain

Going through various Youtube Tutorials and Forum threads I got the logical impression that reducing the Heightmap Resolution and the resolution of the texture being used on terrain should increase performance.

I tried different setups and run them through the profiler but I really couldn’t find any difference at all in FPS.

Could anyone clarify if it makes sense at all reducing Heightmap and / or Texture resolution to increase performance on Desktop PCs nowadays?

Using Unity 2020.3 URP

Thanks.

There’s your answer right there. Hypothetically those things that you mentioned might help in some situations, but not necessarily.

Lowering the workload seems like it should logically improve performance over-all, but what actually happens in my experience is that you can keep throwing more and more at the render with careless abandon and it won’t make any appreciable difference at all … up to point. Once you get that point then you start looking for what the problems are.

The way to increase performance is to identify any specific problems that you’re having and address those. Are you getting bad performance? Does the profiler indicate what the problem might be? If you try to optimize too early then you’ll waste a lot of time fixing problems that you never would have had.

Having said that, I’m pretty conservative with my poly-count and texture resolution, but mostly because it’s just easier for me to make assets that way.

1 Like

Ok that was basically what I needed to know. First make a project more complete and care about performance later.
My approach was to try to “test everything” beforehand.

Thanks a lot for your reply.

Ignoring my last post I just tested a few setups.

  • Using Terrain with Draw instanced disabled = ca. 250 FPS
  • Using Terrain with Draw instanced enabled = ca. 270 FPS
  • Using Mesh Terrain = ca. 290 FPS

Honest question:
Why would I use Terrain at all, considering that the Mesh-Terrain looks basically the same but hast about 1/4 file size and more FPS?
Or am I missing something here.

1 Like

I don’t really use terrains all that much, so I’m not really familiar with how they are optimized. I know that if you add trees and grass in the terrain editor, it automatically billboards the trees and distance-culls the grass.

Hmm after trying out a lot I think I found a good reason (correct me if I’m wrong or if there’s a workaround).

Mesh terrain get’s very unsharp when it’s not created detailed enough. And when it’s created with enough detail, the file size actually get’s even bigger than the size of the terrain.

Although the performance of mesh is still better.

Does the file size of terrains/meshes in the project folder (of those specific files) reflect the final build size needed for those?

It depends on what sort of shader and UV unwrap you have on your mesh. There are splat map shaders that you can use on your meshes that work exactly the same as the terrain. Instead of a splatmap, you could also use vertex colors or just ordinary UV coordinates. you could also use tri-planer-projection world-space texturing or something like that.

With a mesh-based approach, you’re basically free to do anything you want, so you could very well create a solution that looks better and is better-optimized than Unity’s terrain system if you know what you’re doing.

This I don’t really know. you might be able to see this in a build report but I’m not sure whether they are so detailed.

1 Like

I assume you do not use an asset from the store for that?

I have two professional assets which include a terrain to mesh feature but both of them can only use splatmaps (as far as I’m aware)

Not really.

For my meshes, I’m just using normal uv -mapped meshes made in Blender. They have a custom shader that applies a second texture in tri-planar world space (The second texture is just to add a low-frequency noise over the primary texture, things like splotches and stains and stuff like that).

The one thing I’m using from the asset store, is that I’m currently trying to adapt the code from this asset to suit my needs:
https://assetstore.unity.com/packages/tools/utilities/scene-streamer-38168

I’m dividing my “overworld” into squares (in separate scebes) so, at any given time, only the square that the player is in and the eight bordering squares are loaded. That way I don’t have the entire map loaded at once.

Do you know if it’s a huge performance increase to load seperate scenes instead of just set the tiles inactive?

Terrain performance is limited for the mobile platform
You do not need any special optimizations for pc

Hm. good point.

If a tile is only inactive it’s still in memory, so if your entire world is loaded that could add-up to too much RAM. On the other hand, continually loading and dumping scenes has a certain amount of inefficiency as well. For example, it would be much faster and more efficient to activate an inactive game object than to load it from a scene. So I guess it’s really a trade off and neither method is always preferable to the other. That’s something I should keep in mind as well, for my project.

With scene streaming, the size of scenes matter too. You obviously don’t want too large of a scene to load at once. On the other hand, too small of a scene may mean loading too frequently.

1 Like

The difference between using terrain vs mesh is terrain uses splat maps, so you can have very high resolution ground textures. With a mesh you have 1 texture that is spread over the entire terrain, so it will be much lower resolution when near the ground.

1 Like

Not necessarily. The texture does not need to be stretched once over the entire mesh because you can UV map the texture to repeat multiple times if you want, or you can also write a shader to do that. You can use splat maps on a regular mesh too, with the right shader. World-space Triplanar projection is another common way to map repeating textures. There are lots of different ways to apply texture to a mesh.

4 Likes