How to instantiate or modify Terrain3D instance in runtime without a hiccup? #847
-
|
In Demo CodeGeneratedDemo new terrain instance created at runtime, but with a considerable delay. Can this be done in, for example, other thread to not create a hiccup in runtime? Or maybe there are some async methods in API that I missed? I need some way to "swap" between different terrains seamlessly and instantaneously at runtime (terrain textures aren't known beforehand). It can be done either by creating separate terrains, or reassigning terrain textures. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
The script generates a 32-bit noise map per pixel. That takes time in GDScript. There's lots of ways to generate noise faster. You could possibly do it on another thread. This has nothing to do with Terrain3D though. Once the noise map is created, it's fast to import.
Instantaneously depends on your ability to generate your source noise data rapidly. Focus on that first. Then the Data and Region API have plenty of functions that take in your incoming data at runtime. This data does need to be processed into texture arrays, which will take a time proportionate to the number of regions you have active, and have modified. 1000 will be noticeable. 10 may not. |
Beta Was this translation helpful? Give feedback.
Noise data generation is entirely independent from Terrain3D. You can generate your noise on a separate thread, on the GPU, or using any number of methods.
Transferring that data into Terrain3D and rendering it, everything is run single threaded in the main thread. That part isn't slow necessarily, depending on how much data you are bringing in, and what part of the API you're using, you can update the terrain in realtime.