Houdini 20.5 Nodes Geometry nodes

Mask by Feature geometry node

Creates a point attribute “mask” based on visibility/lighting, letting you limit the effect of other nodes to areas that are visible, or facing a certain direction, or in shadow.

On this page
Since 18.5

Overview

This node simulates rays cast on geometry from a direction (or from multiple point sources from the second input), creating a point attribute on the output geometry based on which parts of the geometry are hit by the rays.

Many nodes allow you to scale/limit their effect by an attribute on the geometry. You can use this node to create a “mask” on the effect of these other nodes. For example, the Scatter and Align lets you use an attribute to control where on a surface to scatter points. You can use this node to mask the scatter, for example if you want plants to grow on the tops of things, but not in the dark areas below them. Or if you want to use ambient occlusion to scatter rocks into the cracks of other objects.

How to

  • With this node selected in the network editor, press Enter in the viewer or click the Handles tool to see the handles for this node.

  • Use the viewport handles to set the light direction visually.

Tips and notes

  • Ambient occlusion measures how much “ambient” light (that is, light coming from “outside” in all directions, not from a specific light source) falls on each surface in a scene. This can be useful for finding the “underside” of surfaces, shadows, as well as dark corners and cracks. Use the controls in the Ambient Occlusion group to compute occlusion on the surface geometry.

  • You can add additional geometry that casts shadows (that is, occludes the mask) by connecting geometry to the node’s third input.

  • If you are using points as “light sources”, you can use a pscale attribute on the points to give each source its own radius of influence. See the Max Radius parameter under Direction ▸ Sampling.

  • The parameters in the Remap group let you use a ramp to remap the output of any of the masks. You can use this, for example, to boost (or crush) the highs or lows, increase contrast, and other effects.

Inputs

Geometry

The geometry to create the mask on.

Point Cloud

An optional set of points representing light sources.

Additional Shadow Casters

Geometry that can prevent rays from reaching the geometry in the first input, creating “shadows” in the mask.

Parameters

Group

Which primitives (polygon faces), points, or vertices (see Group Type below) to create the attribute on from the first input. This can be a named group or primitive numbers in group syntax. If this is blank, the attribute is created on all geometry in the first input.

Group Type

Whether the names/numbers in Group refer to primitives (polygon faces), points, or vertices. The default is Guess from Group, which automatically picks the level where any given group names/numbers make sense.

Output

Checkboxes

Turn on the checkbox next to mask type to create that attribute on the output geometry.

Combined Mask

Create an attribute showing the combined results of directional rays and and ambient occlusion, with shadowed areas cut out of the mask.

Directional Mask

Create an attribute showing only the hits from direction rays. This mask does not include the results of shadowing.

Shadow Mask

Create an attribute showing only shadowed areas.

Ambient Occlusion Mask

Create an attribute showing only the hits from ambient occlusion rays. This mask does not include the results of shadowing.

Direction

Direction from

Controls how the node casts rays onto the geometry.

Vector

Cast parallel rays along a single direction, controlled by a vector.

Point Cloud

Cast rays from the points in the second input (you can select which points to use with the Source Points parameter below).

Source Points

When Direction from is Point Cloud, which points in the second input to use as light sources. This can be a named group or primitive numbers in group syntax. Leave this blank to use all points in the second input.

Max Points

When Direction from is Point Cloud, limit the number of light sources checked for each point on the surface to this many.

Direction

When Direction from is Vector, the direction along which the rays travel. For example, 0, 1, 0 (the default) casts rays down from above. You can use this node’s handles to set the direction interactively.

(The rays are parallel, with the source effectively placed at infinity.)

Calculate Directional Mask

Whether to compute a mask based on rays from the direction/point sources hitting the surface.

Max Angle

The maximum angle between the ray and the surface normal that will affect in the mask. The more you decrease this angle (below 90, the default), the less shallow “glancing” angles affect the mask, and the more the mask is concentrated on “direct” hits.

Sampling

These parameters are visible when Direction from is Point Cloud.

Clamp Mask at 1.0

Clamp any attribute values greater than 1.0 to 1.0.

Falloff by Distance

Turn this checkbox on to make the “light” (really, influence on the mask) from point sources decrease with distance from the source.

Max Radius

Turn on the checkbox and set the maximum distance “light” (really, influence on the mask) from point sources can travel. If a point source has a pscale attribute, the node multiplies this value by it, so you can use pscale to give each point source a different radius.

Falloff Ramp

When Max Radius is on, this ramp controls how the “light” from point sources falls of with distance. The horizontal axis represents distance, from the point source on the left to the Max Radius on the right. The vertical axis represents how much the source affects the mask at a given distance.

Shadows

Cast Shadows

Whether to subtract occluded (shadowed) areas from the mask. This can include both self-shadowing and shadows cast by geometry in the third input.

Self Shadows

Whether to include shadows cast by the geometry itself.

Number of Samples

How many shadow rays to cast for each point in the surface geometry. The more rays you cast, the more accurate the shadows, but the slower the node runs. You can smooth jagged shadows caused by few samples using the Cone Angle or Blurring Iterations to fuzz the shadow edges.

Blurring Iterations

How much blur to apply to shadows.

Pin Border Points

Fixes all points on unshared edges on a polygonal surface. These points will not be blurred.

Blur Influence Type

Burring requires reading the attributes on a point’s neighbors. This parameter controls how to decide which points are a given point’s neighbors.

Connectivity

Neighbors are points connected to the current point by an edge.

Proximity

Neighbors are points close to the current point in space.

You can set the maximum number of neighbors to find with Blur Max Neighbors, and the maximum search radius with Blur Proximity Radius.

Blur Proximity Radius

When Blur Influence Type is Proximity, the maximum search distance for point neighbors.

Blur Max Neighbors

When Blur Influence Type is Proximity, the maximum number of neighbors to find.

Sampling

Maximum Ray Distance

The maximum distance that rays can travel without hitting a surface before giving up.

Cone Angle

The maximum angle jitter added to rays.

Ray Offset

The position offset of rays from the surface of the geometry in the Light Direction, or the direction toward Light Source Points.

Seed

The seed used for the random jitter added to the rays.

Ambient Occlusion

Calculate Ambient Occlusion

Whether to calculate ambient occlusion on the geometry.

Number of Samples

How many AO rays to cast for each point in the surface geometry. The more rays you cast, the more accurate the occlusion measurement, but the slower the node runs. You can smooth jagged shadows caused by few samples using the Cone Angle or Blurring Iterations to fuzz the occlusion edges.

Bias

Shifts the resulting occlusion values. Values closer to 0 give stronger ambient occlusion.

Blurring Iterations

How much blur to apply to ambient occlusion values.

Pin Border Points

Fixes all points on unshared edges on a polygonal surface. These points will not be blurred.

Blur Influence Type

See above.

Blur Proximity Radius

See above.

Blur Max Neighbors

See above.

Sampling

Maximum Ray Distance

See above.

Cone Angle

See above.

Ray Offset

See above.

Seed

See above.

Remap

Remap checkboxes

Turn on the checkbox to show a ramp to remap the output of this mask.

Ramps

Use this ramp to change the values output to the attribute. The horizontal axis represents the curent value (from the lowest values on the left to the highest values on the right). The vertical axis represents the new remapped value. You can use this, for example, to boost (or crush) the highs or lows, increase contrast, and other effects. The default ramp (a horizontal line from lower left to upper right) makes no change to the output (low values stay low, high values stay high).

Examples

MaskByFeatureBasic Example for Mask by Feature geometry node

This example shows how to create a lighting and shadow mask on a pig head using the Mask by Feature SOP.

See also

Geometry nodes