U3D Terrain Editor


I haven’t really tried with a detail texture, but I have tried with duplicating each terrain layer with a lower-scaled UV and blending that in, as was discussed much earlier in this thread:

It works fairly well, although it doesn’t eliminate the repeating pattern completely, since it still exists at the higher scale:

It’s far less obvious from the ground, at least, and that’s really what counts. Of course, in a tri-planar mapping texture like this, doubling the number of texture samples might not be what you really want to do. Not only does it add even more blending to the texture, it also can impact performance. Still, even on my crappy lappy I still get about 40 FPS on this scene with the tiling reduction enabled.

I pushed a commit to provide a toggle for enabling/disabling tiling reduction. Go to the terrain layer brush, and there is now a toggle in the group with the other material settings.


Some insight on how UDK does it:


And UE4:

And CE:


The method I just pushed to the repo was derived from the Multi-UV Mixing section of the UDK document. I am sorta curious on what kind of performance other people get out of this shader with triplanar, normal-mapping and tiling reduction all enabled. My knowledge of shaders and performance characteristics is spotty at best, but I’m actually surprised that it works as well as it does.

8 terrain layers. 3 axes for triplanar, and 2 samples per axis (for tiling reduction) comes out to 48 texture samples for the diffuse, and another 48 for the normal maps. 96 samples, plus the 2 samples for the blend maps. Everything I always heard about shaders has led me to believe that 98 texture samples should bring my lappy to its knees, so the fact that it doesn’t kinda surprises me.


That erosion effect looks super sexy. Almost like world machine on lesser resolution. Saying that, I’m thinking that this could be a very usefull tool for making height and blend maps for other engines or even non game projects.


This is the best thing that ever happened to Urho. Your work is amazing, @JTippetts. :heart_eyes::heart_eyes::heart_eyes:


It’s kinda been my idea all along to keep it sorta engine-neutral, at least as far as the actual terrain editing goes. However, lately I’ve been looking at adding some Urho3D-specific functionality: spawning forests and other vegetation and doodads from noise module density layers, using splines to generate road pieces, maybe some basic point-click object placement, generating rocks and cliffs to cover steep slopes, etc… Most of that, though, would be tied pretty tightly to the Urho3D engine, not that that is a bad thing IMO.

@smellymumbler Thanks, I appreciate that. :blush:


The results are increasingly impressive, indeed. :slight_smile:


Wow, nice work! I love seeing the progress of this editor :slight_smile:


Looking great @JTippetts keep it up :+1:


I have setup a project page for U3DTerrainEditor at gamedev.net. Project includes a ZIP with executables for Windows: an OpenGL build and a D3D11 build. Again, the project is still very much in progress, and a lot of stuff is still broken/unpolished/stupid. I’m working on it gradually. (Cut me some slack, will ya? I’m just a lowly factory worker and dad trying to make time for this stuff.)


Thanks for the executables! Playing around with the source killed me, and this worked instantly :slight_smile: Good work!


Thanks a lot, this project is amazing! It is the only reason I’ve chosen Urho :grinning:

How big the terrains can be? Can I stitch them together? Does Urho apply any kind of dynamic LOD to the terrains?


You can connect as much Terrains as you need, connecting them as neighbors. LODs are seamlessly connected.
Beware that standard terrain normals suck because of two reasons, so it’s better to bake all normals into texture and use custom terrain shader.


Are the LODs auto-generated by the terrain system? Is there any kind of culling system tied to the terrain system so it also affects entities placed on top of that terrain?


No, they are not. To achieve that, you have to export the models with different LOD versions that specify the distance at which they switch.


If you talk about terrain geomipmapping, there is.

Drawables are always culled separately. I have no idea why one want to cull them by terrain patches.


There have been a few updates lately. First of all, from the Terrain Settings menu you can now save or load the whole project, which will save any Node groups, Spline groups, terrain layers, and will also export a normal map for the terrain. From the Terrain Settings menu, you can also adjust colors/brightness for the Main and Back lights (directional lighting), as well as colors for Ambient and Fog. There are also sliders for fog Near and Far distances.

Clicking on the color swatches opens up a color wheel to choose a color. The color wheel has a separate brightness slider next to the value slider (TODO: labeling on color chooser) that allows you to choose over-bright (up to 2x brightness) for light colors if desired.

There are a few more tools in the Filters menu, for things such as basin filling. I’ve also added an experimental water layer that can be edited using filters or a brush. The water layer is implemented as a separate Terrain with a water material applied, that sits at a small negative offset ‘underneath’ the main terrain. The water terrain can be edited, and will be visible wherever it protrudes above the main terrain. I am experimenting with water shader technology to make the water look better; in the current repo, the editor will calculate a full-terrain depth texture as the difference between the water height and the terrain height, and use that depth texture to blend in a foam texture in shallower water. I don’t know much about water shaders, so that’ll be a point of research in the future.

Making the water from a Terrain rather than just a simple plane allows you to have water on varying elevations. In the Filters menu there is a filter, Fill Basins with Water, that will calculate a depression map, and fill the depressions with water. It’s still a little wonky at the edges, so I’ll definitely need to make improvements there. The depression fill will simulate water filling up the basins, so the water will exist on many different levels, something that would be more difficult to achieve with water planes.

I definitely will need to work on more/better water tooling if I continue with this experiment. I would like to implement a flow map texture to allow you to edit the way the foam and ripples flow. That shouldn’t be too technically difficult; tooling and operations will be the trickiest part, I think. I’ll probably also modify the shader to also use the depth to darken the color of the water. There are some pretty cool tricks to be done with water, and like I said I’m no expert with them.

I’ve sorta lost track of what other additions there have been since I last updated, so if you’re curious go ahead and grab the latest repo. This weekend, time allowing, I’ll try to get a binary build uploaded.

Edit: Also have implemented alpha brushes for height and terrain texture editing:

The alphas are scanned from a folder of .PNG images. They orient to the camera, so by rotating the camera you can apply the alpha at different orientations. As part of this process, I got rid of the old CustomGeometry-based brush cursor, and implemented the brush cursor as part of the terrain shader, so I could show a preview image of the alpha overlaid on the terrain. The alpha image is multiplied by the circular brush before application.


This thing just keeps getting better and better. BEST URHO PROJECT EVER