Dynamic Grid Based Terrain

Problems building or running the engine, queries about how to use features etc.
jmandevel
Gnoblar
Posts: 2
Joined: Sat Nov 08, 2025 11:27 pm

Dynamic Grid Based Terrain

Post by jmandevel »

Ogre Version: :?:
Operating System: :?:
Render System: :?:

I am interested in making a free and open source clone of Wurm Online, and I am trying to decide if I want to make the game using Ogre3D. I have very little experience using Ogre3D, and I don't want to waste time learning the engine if it doesn't have the kind of features I am looking for. Wurm Online uses a grid-based terrain system where players can terraform by digging and dropping dirt at tile corners to raise and lower them.

Here is an old video showing how this works:

Also here:
https://www.wurmpedia.com/index.php/Digging

The tiles are rather large at a size of 4x4 meters
https://www.wurmpedia.com/index.php/Tile

I don't think that Ogre3D's built in terrain system is going to cut it. Maps in Wurm (and this clone) need to be huge, and it needs to be possible to see distant terrain features. Some tiles (like dirt, grass, sand) need to have edges that blend into surrounding tiles, while other tiles (like cobblestone, paved stone, tile) need to have hard edges. The solution for this problem employed in Wurm appears to be that all of the game tiles are separated by thin "border" tiles which allow for blending between surrounding textures if needed. Clearly, in order for this to work I need to implement some sort of dynamic terrain instead of using the built in Ogre3D terrain system. How could this kind of thing be implemented in Ogre3D?

paroj
OGRE Team Member
OGRE Team Member
Posts: 2274
Joined: Sun Mar 30, 2014 2:51 pm
x 1239

Re: Dynamic Grid Based Terrain

Post by paroj »

jmandevel
Gnoblar
Posts: 2
Joined: Sat Nov 08, 2025 11:27 pm

Re: Dynamic Grid Based Terrain

Post by jmandevel »

paroj wrote: Sun Nov 09, 2025 12:46 am

This is a helpful video. I still have questions though. How many textures does it support? Does it support hard and blended edges like I described in the OP? Is it a splat map or are texture IDs stored in the vertices?

paroj
OGRE Team Member
OGRE Team Member
Posts: 2274
Joined: Sun Mar 30, 2014 2:51 pm
x 1239

Re: Dynamic Grid Based Terrain

Post by paroj »

it uses a splat map to blend the texture layers. You can use the splat map to control the transition.
Ogre has a cap of 16 texture units, however you could use texture arrays to go beyond that as they count as one unit (not implemented yet).

You can also plug a custom shader generator to reinterpret the texture layers as you like:
https://ogrecave.github.io/ogre/api/lat ... ml#details

jmandevel
Gnoblar
Posts: 2
Joined: Sat Nov 08, 2025 11:27 pm

Re: Dynamic Grid Based Terrain

Post by jmandevel »

paroj wrote: Sun Nov 09, 2025 3:18 pm

it uses a splat map to blend the texture layers. You can use the splat map to control the transition.
Ogre has a cap of 16 texture units, however you could use texture arrays to go beyond that as they count as one unit (not implemented yet).

You can also plug a custom shader generator to reinterpret the texture layers as you like:
https://ogrecave.github.io/ogre/api/lat ... ml#details

Does the splat map do something like 1 pixel per tile? This might work. I think that for road tiles, I can make some sort of decal system that makes a new mesh placed directly on top of the terrain. However, this would require the terrain to not tessellate at all, or there would be bits of terrain going through the road. This is more complicated because I need to be able to have diagonal pavement too which covers only one triangle half of a tile so players can make diagonal roads.

I think for roads and stuff like that I am going to do is to split tiles into four separate triangles, each triangle having one point at the center of the tile and sharing one edge with the tile. In the following diagram, the red tiles are terrain tiles where the corners can be raised and lowered. The blue triangles each have their own terrain tile type, and can be paved or whatnot.

Image

Maybe I can use the built in terrain system to render distant terrain features, but make a new terrain system for rendering close up terrain with more detail. I could also do as you say and change the existing terrain system to make use of texture arrays. Of course, this sounds like a challenging thing to implement, especially since I have no experience with Ogre3D. Maybe I could start by trying to make a pull request where I implement texture arrays to Ogre3D itself. Maybe I could talk to whoever is responsible for making the terrain system (Steve Streeting?).

Last edited by jmandevel on Sun Nov 09, 2025 5:28 pm, edited 1 time in total.
paroj
OGRE Team Member
OGRE Team Member
Posts: 2274
Joined: Sun Mar 30, 2014 2:51 pm
x 1239

Re: Dynamic Grid Based Terrain

Post by paroj »

no, the splat map works like this

Image

i.e. it is independent of the terrain geometry.

You should try using the terrain system as is. The 16 texture unit limit still allows you to use 12 terrain layers and 3 splat maps to address them. The handling of those is done internally by Ogre. Take a look at the Terrain sample.