• Skip to primary navigation
  • Skip to main content

Horst Sondermann

Parametric BIM School

Facebook
Instagram
LinkedIn
Twitter
YouTube
  • Rhino/Grasshoppper
  • Archicad
  • Cinema4D
  • Adobe
  • Youtube
  • Print/EBook
  • About
  • Datenschutzerklärung
  • Impressum
Startseite » Rhino/Grasshoppper » Rhino3D Grasshopper: Mesh Slope Colorizer
Rhino3D Grasshopper: Mesh Slope Colorizer

Rhino3D Grasshopper: Mesh Slope Colorizer

In Rhino3D and Grasshopper, colorize a mesh surface dependant on its slope angle. Inspired by Luis Fraguarda’s O’Reilly Course, but the final solution I chose is by David Rutten.

New to Grasshopper? I suggest you read this article in the first place.

Need more learning resources? Check this out.

You can find the O’Reilly online course here. I highly recommend watching it: Lots of useful information, fast, intense. And David Rutten’s explanation can be found here in the Grasshopper forum.

I also advise you to work through some literature like: Arturo Tedeschi, AAD Algorithms-Aided Design: Parametric Strategies using Grasshopper.

Let’s start. The idea is to produce a terrain-like surface and assign colors that refer to the surface’s slope. This works best with a mesh which we’ll derive from a NURBS surface.

Start in Rhino3D: NURBS Surface

rhino3d grasshopper mesh surface height colorizer sondermann horst horstsondermann.com tutorial gradient

rhino3d grasshopper mesh surface height colorizer sondermann horst horstsondermann.com tutorial gradient

This surface is meant to be transformed into a mesh, so let’s add some subdivision via Rebuild: 

rhino3d grasshopper mesh surface height colorizer sondermann horst horstsondermann.com tutorial gradient

rhino3d grasshopper mesh surface height colorizer sondermann horst horstsondermann.com tutorial gradient

To distort our plain surface switch on control point display:

rhino3d grasshopper mesh surface height colorizer sondermann horst horstsondermann.com tutorial gradient

Then select small groups of control points and move them up or down to create a “terrain”.

rhino3d grasshopper mesh surface height colorizer sondermann horst horstsondermann.com tutorial gradient

New to Grasshopper? I suggest you read this article in the first place.

Need more learning resources? Check this out.

Grasshopper: NURBS to Mesh

Pick a Surface input parameter …

rhino3d grasshopper mesh surface height colorizer sondermann horst horstsondermann.com tutorial gradient

… and load your Rhino3D surface:

rhino3d grasshopper mesh surface height colorizer sondermann horst horstsondermann.com tutorial gradient

To keep NURBS and mesh surface apart, produce and offset a copy of the surface via Move:

rhino3d grasshopper mesh surface height colorizer sondermann horst horstsondermann.com tutorial gradient

Choose a distance that makes sense, in my case it’s 20 units:

rhino3d grasshopper mesh surface height colorizer sondermann horst horstsondermann.com tutorial gradient

Tu turn the copied surface into a mesh, pick the Mesh Surface component:

rhino3d grasshopper mesh surface height colorizer sondermann horst horstsondermann.com tutorial gradient

Connect the moved surface’s Geometry output to the Mesh Surface input. This component allows for a customized UV subdivision. Set appropriate values, in my example it’s 50 for both U and V:

rhino3d grasshopper mesh surface height colorizer sondermann horst horstsondermann.com tutorial gradient

Switch off all previews but for the NURBS and mesh surface. Here you are:

rhino3d grasshopper mesh surface height colorizer sondermann horst horstsondermann.com tutorial gradient

New to Grasshopper? I suggest you read this article in the first place.

Need more learning resources? Check this out.

Colorize your Mesh

To colorize the mesh slopes we need access to the corresponding mesh parameters, e.g. the mesh normals. We get these via a Deconstruct Mesh component:

rhino3d grasshopper mesh surface height colorizer sondermann horst horstsondermann.com tutorial gradient

As you can see, this component produces a list of vector coordinates (N) which define the directions of the mesh normals: 

rhino3d grasshopper mesh surface height colorizer sondermann horst horstsondermann.com tutorial gradient

And of course, the higher the Z-value, the steeper the normal. And vice versa: The lower the Z-value, the steeper the slope. So it makes sense to use these Z-values for the coloring. How to extract them? Pick a Deconstruct Vector component and connect it to the N output:

rhino3d grasshopper mesh surface height colorizer sondermann horst horstsondermann.com tutorial gradient

rhino3d grasshopper mesh surface height colorizer sondermann horst horstsondermann.com tutorial gradient

Just for a better understanding what’s going on, I used a Bounds and Deconstruct Domain component to display the Z min and max values. In my example, the lowest Z-value is 0.20327 which defines the steepest slope in my terrain. The highest Z-value is 1, meaning here my terrain is absolutely horizontal.

rhino3d grasshopper mesh surface height colorizer sondermann horst horstsondermann.com tutorial gradient

As I said, this last step’s purpose was only to display the Z-value domain in this mesh. Now let’s move on with colorizing. A Gradient component can be used for our purpose:

rhino3d grasshopper mesh surface height colorizer sondermann horst horstsondermann.com tutorial gradient

Choose a preset with more than one colour, but not too many:

rhino3d grasshopper mesh surface height colorizer sondermann horst horstsondermann.com tutorial gradient

Then, to assign the gradient to the mesh, we need a Mesh Colours component:

rhino3d grasshopper mesh surface height colorizer sondermann horst horstsondermann.com tutorial gradient

Connect the Gradient’s t input to the Deconstruct Vector Z output. Now each Z value will have a gradient colour assigned dependant on its position on the range between our min and max Z-values as shown above.

Connect the Mesh Surface output to the according Mesh Colours input. To make things complete, connect the Gradient’s output to Mesh Colours’ C input.

rhino3d grasshopper mesh surface height colorizer sondermann horst horstsondermann.com tutorial gradient

Already you see that it works:

rhino3d grasshopper mesh surface height colorizer sondermann horst horstsondermann.com tutorial gradient

It may be necessary to tune the gradient to get a more explicit colouring:

rhino3d grasshopper mesh surface height colorizer sondermann horst horstsondermann.com tutorial gradient

rhino3d grasshopper mesh surface height colorizer sondermann horst horstsondermann.com tutorial gradient

That’s fine. Now, as we still have a live connection between NURBS and mesh, feel free to recreate your NURBS surface and observe the change of mesh colours:

rhino3d grasshopper mesh surface height colorizer sondermann horst horstsondermann.com tutorial gradient

rhino3d grasshopper mesh surface height colorizer sondermann horst horstsondermann.com tutorial gradient

That’s it.

New to Grasshopper? I suggest you read this article in the first place.

Need more learning resources? Check this out.

Grasshopper-ARCHICAD-connection: See here for more information.

© 2019 / Horst Sondermann / All Rights reserved

Summary

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Copyright © 2025 · Genesis Sample on Genesis Framework · WordPress · Log in