Hitting the Slopes

In the previous post, I discussed the Altitude constraints tab on the Surface layer shader.  Today let’s have a look at the next tab over, the Slope constraints.

The whole project file for this post is available here.

Conceptually the Slope constraints work very much like the Altitude constraints, except that the shader looks at how steep the terrain is at the point being rendered rather than how high up it is.

Our Gaussian hill starts out shallow (low slope), gets steep for a while above the base, then flattens out toward the top.  At the very top of the hill there is no slope.  To illustrate the Slope constraints tab, the following picture shows the hill with a base color rendered in dirt color, while everything from 50-60 degrees of slope is rendered in white.  Not very realistic terrain, but useful to see how it works.

Note some white specs above and below the large white bands.  This is due to the “bumpy” nature of the surface (we added some fractal detail).

A common (realistic) use for this kind of constraint is to define zones where grass grows vs. areas that are too steep for it to gain a foothold, allowing underlying terrain to show through.  The following scene just shows a fractal heightmap with a base color mix of brown (high color) and grey (low color), overlayed with a Surface layer of green with a maximum slope of 25 degrees and a fuzzy area of 10 degrees.

This entry was posted in Shaders. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s