# Blender for elevation models - split object z coordinate at 0

I'm using the GIS addon (https://github.com/domlysz/BlenderGIS) to import digital elevation models into blender. So far so good, it puts a regular mesh at the right coordinates at the correct scale and everyone is happy. Except... When I start shading, I'd like to use a different gradient along the objects z axis for below sea level geometry than for above sea level geometry and use vertical exaggeration (scaling along z).

In my current setup, I'm using the object coordinates from a texture mapping node, the separate xyz node to get the z component and then create masks for below 0 and above 0 using the math node. I've used the map range to convert fixed boundaries (similar to a map legend, with fixed minimum depth and maximum elevation) to 0 and 1 which seems to work ok I guess. I then use the binary land mask to mix the depth shader with the land shader. However, it feels clunky to do it like that. Also, this doesn't work when vertical exaggeration (scaling along z) is used and then applied to the object. I've attached a screenshot of my shader setup and the current shading (this is in Eevee, but it works in Cycles as well).

As you can see, my setup is quite procedural but it cannot handle vertical exaggeration (when applied to the mesh). I'd love to somehow use the generated coordinates (since they are between 0 and 1), but then I'd need the min and max of z as well and this is where my understanding of the math nodes doe snot get me the desired results.

Any help would be appreciated!

To handle vertical exaggeration in conjunction with the node Map Range, you need to know the height of your mesh.

Since there seems to be no way to process the dimensions of the object in the shader in a mapping node, the following workaround might help:

1. Create a modifier of type Geometry Nodes.

2. Use the node Bounding Box, separate the lowest and the highest value on the Z-axis and store it in an Output Attribute.

3. In the shader you can then read these values with the node Attribute, and use them as minimum and maximum values for your mapping in the node Map Range.

With this, the terrain should always have an even gradient from bottom to top, no matter what dimensions or scaling it has, and should be split at the zero point.

• Thanks a bunch that's really helpful! Haven't looked into geometry nodes yet but they seem to be very powerful indeed. Commented May 6, 2022 at 20:46