Advertisement Jump to content
Sign in to follow this  

OpenGL Multipass Terrain Texture Splatting

This topic is 1426 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi fellow gamedev!


I have implemented the "Advanced Terrain Texture Splatting" as explained by this article. It looks really nice and natural. Somehow I made the terrain editor to target my shitty mid-end Android phone which has only a maximum of 4 textures. So a layer of terrain could only have 3 rgba(diffuse+height) and 1 rgb(splatmap).


Now somehow I feel that this is inadequate. I might need like 8 textures for a complex map. In the "traditional splatting" I could simply break them down into 3 pass, which is (3 rgba + 1 rgb), (3 rgba + 1 rgb), and (2 rgba + 1 rgb). It's doable because the blending between layer is simply :


SOURCE * SRC_ALPHA + DEST * ONE_MINUS_SRC_ALPHA which is similar to standard OpenGL blending state. But with the "advanced" method, I couldn't do the same thing. It's because now the incoming layer needs to know the "height" of the previous layer. It simply can't be done without the next layer being able to read back from previous layer. 


So how could the "advanced" method be translated into a multipass technique? it sucks to be limited by a number of maximum texture units :'(


Btw here's how it looks as of now. Only 3 textures in the base layer sad.png



Share this post

Link to post
Share on other sites
Well, you could pack multiple terrain textures into a single texture, then use the fractional part of the splat texture coords, with some scaling and offset, to "snip" the texture out of the map for a given layer, as described here. Of course, this has the problem that mip levels and bilinear filtering will introduce possible seam artifacts. (Note that you can eliminate the seams in one direction by using composite textures that lay the textures out in a row in one dimension, rather than in a grid in 2. That way, the top and bottom edges tile only with themselves.)

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!