1
\$\begingroup\$

I have an heightmap generated using libnoise (c++). I am loading it from the babylon.js framework (3dWebGL).

I have my heightmap image file and also a river position image file, also generated using libnoise. I am able to load the heightmap, apply materials, etc.. everything looks good.

But I have two questions: 1.- How can I apply a river material to specifics parts of the loaded terrain according with the river map file or what should be a generic approach to do this?

2.- After everything is loaded and in place, I can see the ground, see and rivers. What is a good approach to interact with all this information? I mean, once I load the materials, How do I know when a position is water or not? Should I keep the river map in memory and check it?

I am sure all this sounds quite basic, but I just want to have a general idea to develop it and follow way that is well known that works before starting implement crazy ideas.

\$\endgroup\$
  • \$\begingroup\$ Your heightmap is a grayscale image right? your image file could be a B&W image ?(or make it one), then let yourbackend code apply the river on the heightmap (lower the heightmap pixels to zero where there should be a river) . after you create your ground, create a river plane (with same width.length of your ground) inside your ground at y=0, make sure your ground starts at -0.1 for example and you will have the lowest parts of the ground display the river plane .. not best solution but uses less resources as you have to process the heightmap image once \$\endgroup\$ – Ronan Dejhero Jun 2 '14 at 15:32