Terrain creation is fantastic, and a lot of artists tries to recreate them using 3D softwares.
In Blender, terrain creation is used to be fastidious, with large amount of polygons, and no real erosion system (ANT works but it is super slow and not adapted for realistic mountains).
1 - How it currently works
The main issue here is : Performance. Yes, one more time performances are an issue.
- With high resolution, the landscape meshes are heavy to work on, and are a pain to edit
- No real erosion simulation system available
- No data maps available too (slope, cavity, etc…) or with tricky methods
2 - How I think it could works
Editing
Forget the current Blender mesh implementation. The current mesh system is very complex, and has a lot of functionalities, but most are useless for terrain and particularly heightmaps. Major problem of these functionalities : performances. Mesh is evaluated by the CPU for every change, and it is too slow for terrain editing.
I propose to directly use the opengl API to draw the heightmap onscreen. This way, there is only the needed functionalities available.
So, the terrain is a heightmap, that we can sculpt with no performances issues, and no resolution limit. Then, using a special water erosion brush, we can put water a bit everywhere to erode what is under. This way, the artist is free to do everything he wants.
Erosion
Using modern techniques such as GPU parallelisation, erosion can be done in real time.
I saw a great implementation from Lan Lou of a real time erosion using opengl. Github
page
My early prototype is highly inspired by this project.
Rendering
The terrain object can be converted to Blender mesh to be rendered, or into an heightmap to then displace a plane at a custom subdivision.
Technical details
The newly created object type is a HeightMap
and owns multiple GPUTexture pointers for height, sediment, and other data. When computing erosion, we give these textures to some compute shaders that derive the maps, and create natural landscapes.
The textures can then be used to directly draw the terrain on the screen with minimal latency.
Demo
3 - What about an addon ?
This kind of specific feature is usually made as an addon, but in this case, it concerns simulation. Simulations are heavy to handle with python, and it would not allow the new object type with GPUTexture pointers.
Someone correct me if I’m wrong.
4 - Impact on Blender itself
The addition of a new object type is always something to consider with a lot of precautions :
- Is it really useful ?
→ This Terrain object is used only in specific situations, similar to light probes, gpencil objects - Can it be merged with another object ?
→ It definitely can’t, as it is not a mesh, but a heightmap - Do it follows the Blender guidelines ?
→ I’m not part the Blender community from ages, so I can’t say.
5 - What am I planning to do ?
Object structure
- Create and integrate the new object type
- make it convertible to/from mesh objects
- manage storage in the blend file
Erosion system
- Find a way to erode dynamically
- Hydraulic erosion
- Thermal erosion
- Try different methods (already grid erosion tested, particle erosion todo)
Future
Maybe, an integration with the Geometry nodes project would be amazing, but we have to wait for simulation implementation (fluid, rigid bodies…).
6 - Actual issues
The main question here is to define when the erosion step happens. For every other blender simulations, it is refreshed and cached on every blender frame. But for terrains, it is different; only the final frame is important, we do not care of the whole animation of erosion (for now, maybe in the future).
→ One option I thought is to compute erosion for each 3d region redraw. This way, it happens in real time, and doesn’t wait for the next frame. For erosion, the frame duration is not important, as the time step is constant. So the more step is computed, the better it is.
However, this option is not optimal at all :
- The drawing system give an evaluated version of the heightmap, so we have to skip the dependency graph to modify the object at drawing
- it is not in relation with other simulation systems of blender
If some have ideas, give them below ; Thanks for reading it