Terrain painting, working 4 texture limit

Started by
5 comments, last by Waaayoff 10 years ago

For my engine, I'm working on the terrain painting functionality in the world editor program. I'm using texture splatting to render my terrain chunks, this gives me a 4 texture limit on individual chunks... and until I find a better technique for texturing, this is how it's going to stay.

In my editor I have a large range of textures to choose from, and currently when you paint onto the terrain, the engine searches through the Chunk's 4 textures, if it finds the one that we're currently painting.. then it just adds to that channel.

But, the problem comes if we have 4 textures painted onto a chunk.. and we try painting another... currently my engine finds the texture with the least coverage and swaps that over to the one we're painting... which works, but sometimes it means swapping a texture that I'd rather not lose (it may have less coverage.. but it's more important.. like a thin path to walk on or something).

I'm just wondering how other engines /programmers address this problem of painting with limited textures, without hassling the level artist too much?

Jon

Advertisement

Split your textures.

You can either do it one of two ways.

1) Texture merging

Instead of having four textures (say grass, sand, rock, earth) you combine them into a single texture. Grass top left. Sand top right. etc.

Then in the pixel shader you modify the UV coordinates to grab the texture you want (or the mix of textures you want)

2) Multipass rendering

Draw your terrain with four textures, then do another draw pass with another four textures.

I prefer the first technique, but the second is used very successfully in many engines.

If you have an editor that allows unlimited layers then you can do some nice stuff afterwards:

* find all triangles using only one texture, sort them per texture, create sub-meshes using a single-texture shader.

* find all triangles using two textures, sort them per texture-pair, create sub-meshes using a double-texture blend shader.

* same for three/four, tripplet/quadruplet, tripple/quadruple blend shader

* find all triangles using five or more textures, mark them as errors to the user. Force them to repaint those triangles to use less layers.

* Export the terrain as a collection of these sub-meshes.

Thanks guys, this helps alot! It's a shame we can't have 'virtual texture units' it would solve so many issues with texturing.

Jon :)

Another approach which I worked on at a past company was to allow the artists to work on as many layers as they want, by flattening the result into rendertargets at runtime, with the flattened rendertargets placed akin to clipmaps. The editor gave the artists an indicator as to the complexity of the area and what general performance would be like.

I paint "unlimited" layers onto my terrain by making each layer point to its painted triangles as a lookup into an overall chunk indexbuffer. I then draw each layer in a separate pass. Means you can then just treat each layer like a generic material with supporting normal maps, gloss maps, etc.

If you do need more than 4 layers per chunk, this is the best way I've found to do it on DX9 as tiling textures from an atlas is not something I ever got to look right. I believe in later versions of DX you can use 3d textures instead of atlases for one pass multi-layer rendering.

For my engine, I'm working on the terrain painting functionality in the world editor program. I'm using texture splatting to render my terrain chunks, this gives me a 4 texture limit on individual chunks... and until I find a better technique for texturing, this is how it's going to stay.

I prefer this texturing technique to traditional texture splatting (Skip to the texturing part). It allows you to use much more than just the four (or five) texture maps.

"Spending your life waiting for the messiah to come save the world is like waiting around for the straight piece to come in Tetris...even if it comes, by that time you've accumulated a mountain of shit so high that you're fucked no matter what you do. "

This topic is closed to new replies.

Advertisement