Effectively, contours are generally concaves and not convex
This is more the second idea about to create a distinct slice for each distinct materials/depths/altidudes possibles values that seem cool
We make one distinct slice for each depth/elevation map possibles values entries
Where each slice X represent the map of where the material X is present
In the slice 0, we store the index 0 where the detph/elevation/color map is equal to the material 0 (for example, the ground)
In the slice 1, we store the index 1 where the detph/elevation/color map is equal to the material 1 (for example, a wall)
…
In the slice X, we store the index X where the deth/elevation/color map is equal to the material X (for example, another wall)
…
In the slice 255, we store the index 255 where the deth/elevation/color map is equal to 255 (for example, the sky that can to be see as the the more distant possible material)
=> with 4 bits per slice, this seem to can handle pictures like your terrain elevation map with 16 differents elevations values entries
==> with 8 bits per slice and 256 slices, this can handle 256 distincts/differents materials
(where ground and sky are only 2 materials into this palette, so 253 entires are free for others materials like walls, desks, persons …)
The 256 materials palette possibles entries can to be extended for to store a distinct plane equation for each material if we want handling the fact that the ground, sky and walls are generally perpendiculars for example
=> this 256 planes equations palette can perhaps to be used for to construct something like a “paletted BSP” ?
Slices are on very good format for to be compressed because they store only two values 0 or X, so 1bpp
(0 if nothing is present here and X if the objet present here have the material X)
The next step seem now to can raytrace on realtime this 256 planes/slices/materials BSP palette for each pixel displayed on the screen :whistle:
=> the version with only 16 distincts depth/elevation/colors/planes/slice/materials maps values can perhaps to be handled via a pixel shader for example ?
(with multitexturing and 4 RGBA textures, we can already handle 16 differents depths/altitudes/elevations/depth/slices/materials map values entries or 4 planes equations for example)