Houdini 21.0 Heightfields and terrains

Masking

Define zones of interest and detail.

On this page

Masks are one of the most important concepts in conjunction with terrains. Masks allow for the precise shaping of your terrain, but also for controlling parameters and attributes. The fact that there’s a wide range of nodes, dedicated to masking, underlines the importance of masks. A mask lets you define, where to apply effects such as erosion or terracing. Masks always appear in red and everything inside the red area(s) will be affected or modified.

When you work with heightfields, you work with layers. A mask is basically nothing than a layer. You can create several mask layers and store them under different names for different applications. It’s also possible to combine masks to a single layer, or reuse masks, created by nodes like the HeightField Terrace SOP to identify certain regions of interest. Blurring lets you create smooth masks, but there are also modes for expanding, shrinking and sharpen your masks without having to redraw them. Even blurring supports masking, and you can define exactly where the smoothing effect will occur.

You can draw and paint masks. You can also create masks by feature, geometry and occlusion. Another, very convenient way is to load a mask from an image file or Houdini’s COP network. This method lets you draw detailed masks in your favorite image processing software and import it.

Tip

Masks can become very complex and sometimes you have to deal with multiple masks. We therefore recommend to name your masks and nodes accordingly to make them identifiable.

Many nodes provide a separate input for connecting masks, like the HeightField Noise SOP or HeightField Layer SOP. The latter node lets you combine different terrains and you can draw a mask to control, where the heightfields are merged together.

As mentioned, you can also use masks to drive attributes and parameters. The HeightField Erode SOP, for example, provides support for several parameter masks. A dropdown menu indicates where you can apply a masks to control a parameter. The menu’s default choice is Mask Off. When you choose Mask On, you will see an input field for a mask. Once you've connected a mask, the input field becomes accessible. You can also click the

For a clean view of the final terrain it can be helpful to delete the mask. This will also help to save resources. To do so, add a HeightField Layer Clear SOP to your network. For Layer 1, enter mask to delete it.

Painting masks I

This workflow gives you full control over all aspects of a mask. You can exactly define the mask’s area, size, smoothness, and opacity. If you're not happy with the mask’s shape you can completely reset your brush strokes or just erase certain parts. You can profit from all features from Houdini’s paint tools.

  1. Add a HeightField Paint SOP. Connect the paint node’s output to the second input of the node you want the mask to be applied.

  2. Hover the mouse cursor over the viewport and press Enter to turn on the node’s brush mode. A red sphere indicates the brush. Use the to change the brush’s size.

  3. Move the mouse over the terrain with the pressed to draw the mask. Your motions create red strokes on the terrain’s surface.

  4. To change the mask’s opacity/transparency, go to the node’s Opacity value. A value of 1 means full opacity, while 0 is full transparency.

The default Paint Mode is Replace. When you paint over an already masked area, e.g. with an increased FG Value of 0.2, the brush removes the original mask and creates a new one in these areas. With Add, however, you will really add new parts to a mask. When you paint over an existing mask, the mask values will sum up.

You can also use the brush as an eraser. To do this, make sure that Paint Mode is set to Replace. Then, change FG Value to 0 and paint over the region of interest.

Tip

You can directly control FG Value by clicking and dragging the . This way you can draw fine nuances in the mask without leaving the viewport.

There’s also a live mode. For example, with the standard setup, turn on the HeightField Noise SOP’s blue Display/Render flag. Then, click the paint node and turn on the draw mode as described in step #2 above. When you draw the mask, you can see the result of your action directly in the viewport.

Painting masks II

Maybe you've noticed that some heightfield nodes have a Add a Mask Paint button. An example for such a node is the HeightField Terrace SOP. Sometimes it’s active, sometimes not. Unfortunately, there’s no consistent rule. When the button is inactive, connect the upstream node’s output to the second input of the node with the paint button.

When you click the button, Houdini adds a HeightField Paint SOP and connects it automatically. Now you can paint the mask. Your options and tools are the same as described above.

Object masks

The HeightField Mask by Object SOP lets you use arbitrary geometry to create a mask. The object is projected onto the terrain and you’ll see a cross section of the connected geometry. You can combine several objects through a Merge SOP to create complex and individually shaped mask. HeightField Mask by Object provides some interesting features. You can

  • directly blur the mask without a separate HeightField Blur SOP

  • invert the mask

  • create animated masks by moving or deforming the mask geometry

  • add the geometry mask to or subtract it from an already existing mask when you set Combine with Existing to Add.

The screenshots shows an example setup with a HeightField Mask Noise SOP, subtracted from a geometry mask.

Image masks

You can also create images inside your favorite drawing/painting application or import any image and use it as a mask. Another method is to assemble a mask in Houdini’s COP network. A nice feature of image-based masks is that colors are converted into opacity values. This way you can precisely control the strength of the effects you apply to shape your terrain. And you can also create complex patterns.

  1. To import a file, add a HeightField File SOP to your network and connect it.

  2. Click the Open floating file chooser button to load an image from disk. This doesn’t have to be a grayscale image.

  3. Sometimes, images turn out pale or details are hardly visible. In this case, consider the choose another Channel to enhance contrast.

  4. From the Type menu, choose Mask.

  5. Control the dimensions of the image with Size ▸ Size. The value is given in meters and corresponds with the Heightfield SOP’s own Size parameters.

If you want to use a COP-based image instead, set Source to COP. On the COP Network parameter, click the Open floating file chooser button and navigate to the COP node you want to convert into a mask.

It’s also possible to combine image-based masks with other, already existing masks. On the Layering section you can find a Layer Mode menu with several options. The image map’s content doesn’t play a role and Houdini will convert any image into a mask.

Noise masks

A noise mask is a fast way to create a random mask with spots or areas of different size. Basically, noise masks work like any other noise-based node or function in Houdini. You choose a noise type and then you adjust the noise pattern through various parameters. The main difference to other nodes, e.g. the Attribute Noise SOP, is the missing Animation section.

  • To create a noise mask, add a HeightField Mask Noise SOP to your network and connect it.

  • With Element Size you can control the noise pattern’s size. Smaller values produce more spots. This is a global size factor, while Scale lets you stretch or squeeze the pattern differently along its axes.

As with other types, you can combine noise masks with other, already existing masks. The Combine Method provides several options, e.g. for adding or subtracting masks to create complex patterns.

Feature masks

Terrains have various characteristics like height, slope or curvature. You can use these features for the creation of masks. Feature masks use natural properties, they create convincing results. You can also combine multiple features without losing control. Each feature has its own set of parameters and a customizable ramp.

Again, you can combine a feature mask with other, already existing masks by the choosing one of the mode from the Combine with Existing dropdown menu.

Combining masks

Most mask-based nodes provide a Combine with Existing dropdown menu that lets you choose from different methods to merge different masks. Now, imagine a scene with two masks, e.g. a HeightField Paint (A) and a HeightField Mask By Feature SOP (B).

The dropdown menu’s default method is Replace. When you turn on the blue Display/Render flag for mask B, you will only see this mask. Mask B replaces mask A and the painted mask is no longer visible.

Now, choose Add from the menu. What you get is a combination of mask A and B. There are also modes for subtracting, multiplying and blending masks, along with some others.

Masks don’t have to range between 0 and 1, but you can also apply values greater than 1. The strength of a mask has direct influence on your terrain or its attributes.

Mask layers

In many situations you need more than just one mask. The problem, however, is that Houdini’s heightfields only have one mask layer. What, if you want to create masks for different purposes or effects? What, if you need various types of masks to feed a VEX script? There’s a standard workflow for turning a mask layer into a new layer.

You start with the creation of a default mask layer, for example through a HeightField Mask by Feature SOP. There you choose one of the features like Mask by Curvature and then you want to save the result in a separate curvature layer.

  1. After you've specified the mask, add a HeightField Copy Layer and connect its input with the output of the mask node.

  2. On the copy node, go to Destination and enter the name of the new layer. Here, it’s curvature.

  3. If you don’t want to override the original mask layer, add a HeightField Mask Clear SOP. This node doesn’t delete the mask layer, but sets its values to 0.

To make the new curvature layer visible, lay down a HeightField Visualize SOP. There you can see nine Layer parameters with associated dropdown menus. You can open any menu and choose curvature. The layer should appear in the viewport with the corresponding color. If you're not happy with the color, you can change it, of course.

Clearing masks

Clearing a mask doesn’t mean that the mask will be deleted, but you assign a constant value to each mask point instead.

  1. Add a HeightField Layer Clear SOP to your network and place it after the node where the mask was used for the last time.

  2. Go to Number of Clears and enter the number of masks you want to clear. The node will create a parameter set for each layer/mask you want to work on.

  3. Each Layer (n) parameter provides a dropdown menu. From there you can choose the appropriate mask.

  4. Use the Value (n) parameter to determine the constant mask value. When you enter 0, the mask layer will still be present, but won’t affect your heightfield operation(s).

Deleting masks

If you want to delete a mask (or any other layer), you can use a Delete SOP. Let’s assume you've created an erosionmask mask. Now you don’t need it anymore, so you want to delete it completely and free memory.

  1. Add and connect a Delete SOP to your network at that point where the mask is no longer required.

  2. Go to the Group parameter’s associated dropdown menu on the right. From there, choose erosionmask. The entry changes to @name=erosionmask.

  3. If you only want to keep erosionmask and delete any other layer (including mask, height), set Operation to Delete Non-Selected.

Note

Instead of a Delete SOP you can also use a Blast SOP.

Parameter masks

You can use masks to drive parameters. Some parameters, for example Erosion Rate or Deposition Rate on the HeightField Erode SOP’s Hydro section, have associated dropdown menus. The default choice is Mask Off, but when you choose Mask On, you’ll be able to enter the name of a mask that will control the parameter’s influence.

Heightfields and terrains

Creation

Scattering

Masking

  • Masking

    Define zones of interest and detail.

  • Light masks

    Create masks from the sunlit areas on a terrain.

Natural effects

  • Erosion

    Turn mountains into dust.

  • Slump

    When mountains crumble to rocks.

  • Flow fields

    Let it flow (down the mountain).

VEX

Texturing

Shallow Water Solver