Jump to content

  • Log In with Google      Sign In   
  • Create Account

Terrain painting, working 4 texture limit


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 TRONJon   Members   -  Reputation: 221

Like
0Likes
Like

Posted 25 April 2014 - 04:39 AM

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



Sponsor:

#2 Stainless   Members   -  Reputation: 944

Like
3Likes
Like

Posted 25 April 2014 - 05:34 AM

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. 



#3 Hodgman   Moderators   -  Reputation: 30384

Like
5Likes
Like

Posted 25 April 2014 - 09:38 AM

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.



#4 TRONJon   Members   -  Reputation: 221

Like
0Likes
Like

Posted 27 April 2014 - 10:54 AM

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 :)



#5 Digitalfragment   Members   -  Reputation: 844

Like
0Likes
Like

Posted 27 April 2014 - 06:29 PM

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.



#6 RobMaddison   Members   -  Reputation: 698

Like
0Likes
Like

Posted 28 April 2014 - 01:51 AM

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.

#7 Waaayoff   Members   -  Reputation: 781

Like
0Likes
Like

Posted 29 April 2014 - 01:28 AM

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. "




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS