Splat more than 3 textures on a terrain?

Hi there, I know my Java, but am a complete newbie regarding 3d, games etc.

Busy doing the tutorials, on HelloTerrain. I see the “splatting”, merging 3 different textures using the RGB channels of an image. Nice.

Now, how would I merge more than 3 textures?

It looks to me that the splatting may actually be done in Terrain.frag, so am I right in guessing that I would need to make a new Material, and implement the splatting in a new .frag that I would need to write?

Also, about the .frag, this is GLSL, right? Its OpenGL shader language, right?

I see the material definition references the .frag like this:

VertexShader GLSL100: Common/MatDefs/Terrain/Terrain.vert

Wikipedia tells me there are multiple different versions of GLSL. Would that line look the same regardless of what version of GLSL the .frag is written in? Or is the version number encoded in the GLSL100 thing?

Lastly, any guidance on which version of GLSL I should learn/target?

I’m not sure about the texture merging, but you’re correct that the *.frag files are GLSL shaders. Vertex shaders go in *.vert files, fragment shaders go in *.frag files. (If you’re not sure what those are, OpenGL has some very nice online documentation. :wink:)

GLSL100 is the version line, 100 is the version number. Any shaders compatible with GLSL version 100 would have that line, but a shader that required a different version would have that version number following the GLSL.

You can splat up to 12 textures on terrain using TerrainLighting material.

please see

1 Like

Thanks, the advanced terrain test looks like it includes everything I will need.