Increase Terrain Performance

Hi, I have a 64 tile world creator terrain. Each tile is 512x512. Resolution 2048 each.

I am also using megasplat on the terrains but megasplat doesnt really cost anything at present with the 2048x2048 sized textures as far as I can tell.

When the scene is in playmode without the terrains active the FPS is approx 240-250.

When I activate the terrain the FPS goes down to 44-50 which basically leaves no room to add anything else.

I have actually added most scene objects with aquas water and the scene goes down to 11-15 FPS.

So my question is what can I do to improve the performance.?

Any suggestions welcoma dn appreciated.

Thanks.

First you need to find out what exactly is costly. You do this by creating a build, run it on the target platform and connect Unity’s Profiler to your game. The Profiler shows you how expensive a certain code-path / feature is.

Once you profiled the game and the Profiler told you what is expensive, you can use this information to start optimizing things.

Here are a few resources that should help you to get started with the Unity Profiler.

Learn how to diagnose common performance problems and optimize your projects:
https://unity3d.com/learn/tutorials/topics/performance-optimization

Introduction to the Profiler

https://www.youtube.com/watch?v=sBpXiJ9G3OY

Unite Europe 2017 - Practical guide to profiling tools in Unity

https://www.youtube.com/watch?v=OSlOwJP8Z14

Unite Europe 2017 - Performance optimization for beginners

https://www.youtube.com/watch?v=1e5WY2qf600

5 Likes

Awesome, @Peter77

Much appreciated. I’ll dig deeper into this now I have a direction.

Thanks again.

1 Like

If you can afford to wait a bit for it to release, Unity have done some serious optimisations for this kind of multi-terrain workflow due sometime in 2018. 64 terrains is a lot for the old terrain system but probably fine for the new. It would mean moving to a new version of Unity and that’s somewhat destructive though. Just adding peripheral information, as Peter’s answer is great.

2 Likes

Just building on the 2 great answers here, once you have profiled and optimized as far as you can, look into some kind of asynchronous chunk loading/unloading based on distance, so that only max of say 9 tiles around camera are actually active.

If you cant see it, dont draw it (and probably dont run its behaviours too unless it is something that you wish to continue simulating off screen) :slight_smile:

2 Likes

Thanks, I am actually in no rush as I am really just getting the foundational terrain and main cities and objects etc in place “as I want them to look” before optimizing on a much deeper level after learning more.

Also I was actually iunder the impression that advanced developers such as World Creator developers would have taken what you had to say into account before offering a product marketed as multiple terrains and their current limitations of basically zero. But as mentioned I dont know the ins and outs of unity etc so there are most likely IFS and BUTs I dont understand.

Thanks again for the great input. Much appreciated.

I

I will, thanks. Glad I got answers that were extremely helpful too and that put me on the right path rather than going blind on my own. Much appreciated.

So far I have just been looking at Occlusion Culling which hardly makes any difference if any… and World Streamer which I put off buying because I really cant learn stuff whilst watching a detailed and unfocused screen whilst bad 90s thump music is going on to further distract me. But that’s a pet hate of mine, " Great developers who don’t have a microphone" (even bad english is better than none, that actually gets me more focused on what is being said. I say that because many developers seem to be Spanish, Dutch, German etc…)

Again thanks for the advice… I most definitely will take it and the other great comments here. Much appreciated.

1 Like

I mean 512x512 is 512 metres squared, and then you have 64 of those (32 768 m2 - a potentially insane amount to load at once or even in quarters, to put it into perspective you are trying to load and draw the entire map of skyrim in one go - skyrim was around 37000m2). A chunk in a game is usually something like 50 metres squared (and you load 9 of those around your camera), to give you some idea of the kind of optimizations needed to make this work. World creator will probably never be optimized enough to get this running with good performance out of box, its not really a performance issue as much as you need to learn to break up the data in your game into easy to manage and read in < > out chunks.

1 Like

You should lay off using any asset store assets for terrain really IMHO if there’s no rush on this. Unity do have big improvements coming down the pipe.

1 Like

I recently read a post dates 2013/14 about a supposed unity terrain upgrade that was at the time 4 years late?

Is the update you speak of coming this year?

Thanks

Yeah it’s this year. Unity will spam the blog ultra hard. I’m estimating it’ll be late this year, during 2018.3 as a beta thing. I don’t have clue honestly. It’s based on what Unity showed at GDC.

1 Like

Thanks for the input. Much appreciated. Have a good one.

1 Like

Just a few notes regarding tile-based worlds and high resolution terrain objects, you will never gain practical performance with high number of tiles and high-res heightmaps/textures on terrains in a static scene. Not in Unity nor in any other real-time 3D engines.

We also wanted huge worlds with detailed terrains while maintaining performance in real-time and that’s where we ended up releasing the streaming system in TerraLand. In the following video the total resolution for the heightmap is 16384 pixels and 65536 pixels for the imagery. The world is a 160 x 160 km area and the whole database size for the streaming server is about 1.5 GB.

But that’s exactly what a large number of games do including horizon zero dawn - which is an impressive piece of open world tech. Terrain divided up into 64 tiles of high res heightmaps, which directly goes against what you are saying. Perhaps they use compute and other techniques?

I think we need to define what scales we are working at to comment, really. From your video perhaps you’re talking about flight sim scales :slight_smile:

1 Like

My thoughts exactly.

But I would probably be better off just listening as my knowledge is far too little.

I actually cant get my project to build in order to profile due to texture size issues and so need to learn about Asset Bundling before I return to the terrain issues.

AND… keep my unity version upgraded to the latest as I await the new terrain system.

I will though do another multi tile terrain so I can test now I have a small amount of knowledge of where I will be going

Thanks again, much appreciated for the input.

You missed one point in my explanation and that’s the word “static” there, of course you can possibly have unlimited resolution for your data but in a dynamic streaming environment as in our streaming system. That’s why there are tiles in HZD to load/unload (or maybe intense LODing) them based on player position and why I shared the video at first place which is what OP asked for.

But what you said about the scales is true, you can have a 160km2 area in a 16k heightmap or a 1 km area in the same resolution.

In the video I posted, the whole world is a grid of 32x32 with each tile at resolution of 512 for the heightmap and 2048 for the textures loaded and streamed dynamically and obviously will explode your computer if run statically in the game start at once, not to mention that the base world is still empty.

Also regarding the flight sim you mentioned, that’s exactly where it becomes trickier as the “viewing distance” is the
most important factor when dealing with huge open-worlds as it’s harder to fill in the horizon when you are up in the sky rather than walking on terrain surface. In a flight sim you can not hide further tiles behind other elements and they are always in view plus your vehicle usually travels faster and streaming is done more frequently.

P.S. I remember a dev talk of Horizon Zero Dawn where they said, we did not care much about the world size and metrics and that’s the density and diversity of the elements in the game design which matters, while other games arguing about the map scale and at its best they mention it is a 16x16 km area but “sparse”. The denser the scene is the more sense of scale and illusion of bigger space in perspective.

1 Like

Isn’t streaming the same as occlusion culling?

I tried occlusion culling and when visualized it streams each section as it should and looks like about 10% of the tile areas are active at any single time YET… it makes absolutely no difference to the FPS.???

I also just did a test as follows

1 - A 5760x5760 (4x4x1440/16 tiles) terrain.
2 - A single tile 5760x5760 terrain.
3 - A single 512x512 tile terrain.

I used world creator as well as the standard unity terrain builder…

I even flattened each and there was no visible FPS difference???

And on ultra with v-sync active settings every single one of the above averaged around 66-76 FPS.

That tells my unknowledgable self that unity is unusable. Add aquas and your done… An ignorant remark I know but you get what I am saying I’m sure.

In short as a none experienced none developer I like to get the tools and then find my way around the issues but as yet I cannot find a way around the FPS issue which all begins with the terrain itself.

Again, to my inexperienced self I was thinking of trying world streamer but it seems to me that all that does is something very similar to occlusion culling which as I mentioned doesnt work???

The Unity terrain system is outdated and lacking for sure, but the troubles you describe here are things you would encounter with all engines. To do huge terrains you need to be really smart about how you do it, or it will be doomed to fail.

Horizon ZD, TCGR Wildlands, Assasin’s Creed, etc all use elaborate streaming systems, combined with heavy LODing and lots and lots of deterministic procedural generation. It is not easy, but with experience you can make it work on basically every engine. Before trying this you should think long and hard on whether this feature is absolutely necessary for your core game play!

And occlusion culling is very different from streaming. Culling is just about what you render, while streaming is about what you actually load, and at what resolution.

And about flattening terrains; heightmaps are converted to a mesh with a certain mesh “budget”, to ensure stable frame rate while rendering, so it is normal that flattening the terrain don’t make it cheaper.

1 Like

Thanks, much appreciated for clearing that up.

Because I don’t currently have the knowledge or experience to make it work, which subjects do I need to research in particular in order to get it working?

At the moment the projects ready for dumping and using unity for what its actually geared up for out of the box. 2D or 3D 20x20 scenes.?

Apologies for the sarcasm but I bought into the idea that creating a game can be done by the inexperienced? You don’t need to be a C# Developer etc and so spend a couple of thousand so far in assets. Which I should have not been so naive about. My bad!.

Following on from my above comments I am not sure what you mean here as I am trying to create what I believe to be a SMALL (4096x4096 JUST 4x4km square?) open world game of which the terrain is the foundation but the terrain demolishes the building of anything on top of it?

I realize my own ignorance which is why I am asking these things in the first place.

Thanks again for the input.

Did you ever watched the video I shared and read through the description?

Also the last 2 minutes of the video shows the streaming in editor to reveal what is behind the scenes as it dynamically streams/feeds terrain data from an external local server outside Unity similar to asset bundles.

For the rest of the questions whatever @roxIndie said is true.

1 Like