How does landscape terrain work internally?


photo

Recommended Posts

I ve did some simple performance tests and it seems, that adding new heightmap layers (LandscapeLayerMap) doesnt have big (if any) impact. What is going on internally? All heightmaps are pre-builded into one mesh, so it does not matter, if I have 1 or 100 layers, performance will be +- same? Or is there any overhead for each layer, so better to not add too much layers?

And same for textures, are textures baked into some megatexture, so it does not matter how many of them I use, or is there any overhead for each, so again, better to limit it? 

Thanks!

 

 

Link to post

Hi Jirka,

There is no simple answer to your question, unfortunately :)

First of all, you need to understand which mechanics are involved when terrain is rendered and when:

  1. When camera is static (no streaming, mostly GPU is limiting performance right now)
    • All the landscape layer maps visible tiles are already blended and loaded to the megatexture
  2. When you moving around different LandscapeMaps (streaming is involved, CPU & GPU load increased). More layers - more CPU overhead in general.
    • Landscape layer maps pixels are blending in runtime and saving the results into the megatexture
    • Landscape layer maps are performing frustum culling (if enabled), cpu/gpu/disk cache loading / unloading / intersections / physics tasks.

So, do not measure performance with a mostly static camera and small viewport, do some flying tests (check the numbers in performance profiler or microprofile) and you probably will find most of the issues early.

Some of the use-cases and best practices are already described in the documentation, don't forget to check there: https://developer.unigine.com/en/docs/2.10/objects/objects/terrain/landscape_terrain/settings

 

Quote

And same for textures, are textures baked into some megatexture, so it does not matter how many of them I use, or is there any overhead for each, so again, better to limit it? 

That's currently is not implemented. We considering to add this option for the final project build. Don't know yet how much time that operation could take (hours?) :)

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to post
40 minutes ago, silent said:

Hi Jirka,

There is no simple answer to your question, unfortunately :)

First of all, you need to understand which mechanics are involved when terrain is rendered and when:

  1. When camera is static (no streaming, mostly GPU is limiting performance right now)
    • All the landscape layer maps visible tiles are already blended and loaded to the megatexture
  2. When you moving around different LandscapeMaps (streaming is involved, CPU & GPU load increased). More layers - more CPU overhead in general.
    • Landscape layer maps pixels are blending in runtime and saving the results into the megatexture
    • Landscape layer maps are performing frustum culling (if enabled), cpu/gpu/disk cache loading / unloading / intersections / physics tasks.

So, do not measure performance with a mostly static camera and small viewport, do some flying tests (check the numbers in performance profiler or microprofile) and you probably will find most of the issues early.

Some of the use-cases and best practices are already described in the documentation, don't forget to check there: https://developer.unigine.com/en/docs/2.10/objects/objects/terrain/landscape_terrain/settings

 

That's currently is not implemented. We considering to add this option for the final project build. Don't know yet how much time that operation could take (hours?) :)

Ok, thanks for valuable info. Do I understand well, that blending heighmaps into megatexture happens when needed, so it is not happening each frame, but from time to time, when this particular chunk becames visible?

 

Edited by demostenes
Link to post

Yep, when new tile is appears in a frustum and it's being missed from megatexture all the landscape maps are being blended. Depending on virtual texture resolution and cache size you may see the blending more or less often. For some small terrains it even possible to store them entirely in GPU cache.

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to post
55 minutes ago, silent said:

Yep, when new tile is appears in a frustum and it's being missed from megatexture all the landscape maps are being blended. Depending on virtual texture resolution and cache size you may see the blending more or less often. For some small terrains it even possible to store them entirely in GPU cache.

Great, thanks.

Link to post