I'm curious if there is a better way to draw topography than what I'm currently doing. My process seems really convoluted and long as seen below. is there a better / easier way to achieve this?

as an additional note, lets say I animate some terrain movement and want to watch the topo-lines change/adapt to it, how would i do that? it's impossible with my current method..

  1. subdivide plane and create (mountain or whatever)

  2. add a new plane, attach array modifier (z-axiz), attach boolean(/w select mountain).
    enter image description here

  3. apply array

  4. apply boolean.

  5. select all, delete "only faces". (and manually delete any stray edges) enter image description here

  6. add a material, and use "wire" render

  7. (extra stuff, like lights ortho camera, etc)

enter image description here

  • $\begingroup$ blender.stackexchange.com/questions/76141/… $\endgroup$ Oct 12, 2018 at 22:55
  • $\begingroup$ well, that almost works, except that the lines now vary in width (vectorized?) imgur.com/oxbiu9S. your solution to that is to convert the edges to a curve, or basically what I've done in my original post, which destroys the ability to animate it properly, damn. $\endgroup$
    – kei
    Oct 13, 2018 at 1:24
  • $\begingroup$ I shape tweened the terrian, which gives the desired effect in the UI. (using my original boolean method (not applied)). (to my knowlage) this isn't renderable and leaves unwanted stray edges though :( imgur.com/vaGTHth $\endgroup$
    – kei
    Oct 13, 2018 at 1:28

1 Answer 1


You can achieve this effect using the compositor by extracting the world position, splitting out the 'Z' coordinate and detecting where it crosses a repeating threshold.

First, we need to capture the world coordinate at every point in the scene. For this you can use the following material :


This takes the Object coordinate and converts it into World coordinates, returning the RGB color of the coordinate in world space. This will be used to extract the Height of any point in the scene.

If you need to render the scene normally as well as capture the contours you can use the Render Layer 'Material Override' setting to add a render layer specificaly for this.

In the compositor we now need to extract the 'height' information (the 'B' channel corresponding to 'Z'), split it into bands, and detect the edges. This can be achieved as follows :


The Modulo function is used to split the height into bands (the following Divide re-scales the result so it still spans the 0.0 to 1.0 range). This then passes to a simple edge-detection stage where the image is offset and compared (via Subtract) with a neighboring pixel. If the result of this indicate a large difference then it is deemed to be an 'edge'. By performing this comparison in each direction (once in X direction, once in Y direction, and both doubled up with Absolute) and combining the result we can detect the edge where the modulo jumps from Low to High.

Adjusting the Band, Thickness, Threshold Value nodes allows you to fine tune the banding.

This can produce the following result :


Blend file included

A similar setup can produce the same result from Blender Render. Here are the required material nodes :

material - Blender Render

Note the use of a Mapping node to shift the values in the Z direction. This is due to the limitation of Blender Render to not render values less than 0.0 - the negative values all become limited at 0.0. In my case, adding 500 moves all the coordinates in the scene to above 0.0.


As for the dark areas shown in your supplementary image :

enter image description here

The issue is in how the edge detection is working with the values you have chosen for Threshold and Thickness. Try increasing the Thickness and/or lowering the Threshold until the banding disappears. The edge detection is very simplistic - it only looks for a single contrasting pixel in each direction, excluding diagonals. If the edge is very narrow it's easy for the edge detection to miss the edge - adjusting the settings should help... or a more capable edge detection algorithm - or even render at a higher resolution.

To answer your query regarding the Absolute maths node missing socket, the missing node is simply hidden for clarity since it is not used for Absolute operations. Unused sockets can be hidden by selecting the node and hitting Ctrl+H. The same action can be used to re-show hidden sockets.

  • $\begingroup$ I wouldn't really consider node and compositor setups any 'less convoluted or easier' than my current method, and I totally failed to mention being in Blenders internal renderer. alas, your answer is pretty well thought out and is a solution, so I'll likely accept it (in a day or two). as a side note, I copied your node set up and my "Absolute" has an additional Value which does not appear in your setup, why is that? I also have these 'dark areas' where lines don't show, any idea why? imgur.com/a/kOHXi5k $\endgroup$
    – kei
    Oct 18, 2018 at 1:21
  • 2
    $\begingroup$ @kei I've added an update - hopefully that helps. While this method might not be 'less convoluted or easier' to set up, once it is set up it should be easy to animate - there is no change to geometry for each frame. This should allow you to easily 'animate some terrain movement and want to watch the topo-lines change/adapt to it'. $\endgroup$ Oct 18, 2018 at 6:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .