I have a logical grid of square areas. They have discrete heights. Ground Level, Height 1, Height 2, etc. What I’d like is to generate a ground plane that utilizes a heightmap so that the terrain basically creates plateaus where my elevated terrain is, with a slope between the two discrete values. I’m a complete beginner when it comes to 3d engines, so I’m not sure how to best go about building the heightmap that produces the effect I want in my ground plane.
Since a dynamicTexture is just a canvas you can do anything on it that you can on a canvas. The important part for an image heightmap is that it is all shades of grey with white being the high points and black the low points. So the next step is to draw the plateaus in appropriate shades.
In this next stage I am taking a simple as possible interpretation as of your stated requirements. If needed you can build on this later.
Start with a grid of cells with r rows and c columns. Each cell being square of size s, in the center of each cell is a square plateau of size p with a height ranging from minPlateaulHeight to maxPlateauHeight. The data is stored in an array].
Each height needs to be converted to a value between 0 and 1 and set as a shade of grey. Regions between the plateaus need to be shaded so as to form slopes from plateau to plateau.
Here is the first stage, drawing plateaus of various heights https://www.babylonjs-playground.com/#RED5PM#1
Now using an array https://www.babylonjs-playground.com/#RED5PM#2.
Tomorrow the start of the slopes.
Have added some generalisation and slopes to sides and front and back, this leaves holes so complete those next.
Hopefully this gives you something to work on https://www.babylonjs-playground.com/#RED5PM#5
a few +1 or -1 about to overcome rounding errors since we need to deal with whole pixels.
I’ve been tied up with work for a few days and haven’t had an opportunity to pursue my project any further but I wanted to say thank you for all of the effort you put into your responses. The examples were extremely helpful. It is greatly appreciated!