Lighting HeightBasedTerrain Material

Hi Monkeys,

Does anyone have a solution for a lighting based “Common/MatDefs/Terrain/HeightBasedTerrain.j3md”
material for terrains? Even better will be if I can get one that is PBR as well.

1 Like

I don’t know of any that currently exist, but I think it wouldn’t be too difficult if you were to copy the PBR lighting code from the other PBR/Lighting terrain shaders, then plug in the final albedo and normal values that you get from the height-based textures the way the HeightBasedTerrain shader does it.

Another idea (that wouldn’t involve creating a new shader) would be to use the existing TerrainLighting or PBRTerrain shader, and then write some Java code using the ImageRaster class to generate an alpha map where each color channel is splatted according to the height of that point in the terrain. So it would achieve the same thing, with the only difference being that you’d be using one more texture read for every 4 textures since you’d be using an alpha map instead of sampling each point’s height in the shader.


Interesting, thanks for the ideas.
I will try it by myself then but if anyone else have a ready to use solution I would much appreciate it.
Over the years with jME I realized I am definitely not a shader developer.

A forum search brought up this: