# Create Topography map lines

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).

3. apply array

4. apply boolean.

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

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

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

• blender.stackexchange.com/questions/76141/… – Duarte Farrajota Ramos Oct 12 '18 at 22:55
• 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. – kei Oct 13 '18 at 1:24
• 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 – kei Oct 13 '18 at 1:28

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 :

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.