How to color terrain by height?

Hello all,

I’m using jMonkey to do a bathymery visualization tool so I need to color the terrain according to the height on the heightmap.

The only way I came up to do this so far would be to make a texture the same size of the map with all the colors and then apply it the normal with (alpha map, color everything red). But I get the impression this is not the way to go.

Anybody can point me in the right direction?

Hello Kotoko,

You can use a Shader to do this. It’s actually very simple and you can learn how to do it in a few hours. Read Shaders tutorials on the net.

RenderMonkey is a GUI tool to assist you with writing Shaders. I recommend it a lot. :slight_smile:

I’m a complete beginner in CG world, you sure making a shader isn’t something that will take me days or weeks?

It’s an honest question, it sound really complex and easy to get lost into. 8O

P.S.:RenderMonkey is a windows only thing right?

:slight_smile: It’s the feeling everybody gets, but when you read the tutorials, everything becomes obvious. It’s really a step I recommend to do. You will understand 3D engines a lot better after understanding how Shaders work.

And seriously, coloring a heightmap with a shader is barely one line of code. :wink:

P.S.:RenderMonkey is a windows only thing right?

Ah I think it’s Windows only, yep . You can find other tools to write Shaders if you use Linux, but I don’t know them o.o

Ok I’ll give it a shot.

I was looking at this and was like 8O :cry: 8O

But I guess having a tools should make it simpler.

There is a class from me that allows you to easily create an alphamap from a heightmap:

It might just do the trick for you.

Thanks (looks like a really nice tool btw) but this is not exactly what I was talking about, the idea is to use plain colors, no textures.

Did you end up figuring out what to do with your issue? I want to do the same too