Divide terrain in sections with specific data

Have spent a while coming up with a prototype. Really it is no more than a proof of concept and would require a lot of development work.

https://musing-joliot-0f7a2f.netlify.com/sections

Move pointer over map.

Code

Could not use a playground because browsers do not like context.getImageData from an external site

Basic process

Generate map in a paint app

Record red, green blue color values for each section (un comment line 85 is one way to get these)

Select each section and paste each section onto a transparent image in correct place, eg

Make sure you save each image with transparency intact.

In Babylon.js

Form two version of terrain one slightly above other. Using a dynamicTexture (so can read pixels) apply map to bottom terrain.

Set up textures for each transparency file using section image files

Use map image to read pixel color, for given pixel color change texture for top terrain.

List is quite a lot of work for just 6 sections would need to find some way of coding to do the image work for many sections. However it shows it is possible.

Improvements from anyone very welcome.

3 Likes