Houdini 20.5 Nodes Geometry nodes

Ray geometry node

Projects one surface onto another.

On this page

The Ray operator projects rays from each point of the first input geometry in the direction of its normal, and then moves the point to any geometry the ray hits from the second input.

You can use this node to drape clothes over surfaces, shrink-wrap one object with another, and other similar effects.

Using Ray

  1. Click the Ray tool on the Model tab.

  2. Select the points or primitives to project and press Enter to confirm your selection.

  3. Select the primitives to project on and press Enter to confirm your selection.

Note

This tool works best when smaller surfaces are projected onto larger surfaces.

Example

  1. Place a Grid node, set its Orientation to “XY Plane”, and translate it in Z by 2.5. Turn its template flag on.

  2. Append a Point node to the Grid and change Keep Normal to Add Normal on the standard tab of the parameter editor.

  3. Place a Sphere node, set its geometry type to NURBS, set its radius to 2,2,2, and translate it in Z by -2.5 .

  4. Turn on the display of point normals in the viewer’s right side toolbar.

  5. Append a Ray node to the Point node and connect the Sphere to the right input. Turn on its display flag.

  6. Turn the Intersect farthest surface checkbox on to move the projected plane onto the “back” of the sphere.

The Ray op will move the points of the Grid in the direction of the point normals. The first surface of the Collision Source (right input) will be where those points of the grid will rest. You can make those points rest on the other side of the sphere by enabling the Intersect Farthest Surface option. This means that the points should continue to project to the farthest surface of the collision source.

Parameters

Group

Group of primitives or points to project.

Entity

Project points or primitives.

Collision Group

Group of primitives to project on.

Method

Project Rays

Points are projected along their normals until intersecting with collision geometry.

Minimum Distance

Points are placed on the closest point on the collision geometry. This method does not use point normals. Use it to shrinkwrap or project one primitive onto another.

Note: Distances to packed primitives and sphere/tube/circle primitiives with non-uniform scales may not represent the actual closest point as the closest point is found in the untransformed space.

Direction from

How to determine the direction to send rays.

Vector

A ray direction vector is explicitly provided.

Normal

Normals are computed, if necessary, on the input and used as the ray direction.

Attribute

A given attribute is used. It should be a 3-float vector attribute giving the direction to send the rays in.

Ray Direction

Direction to project rays from each point.

Direction Attribute

The point attribute to use to determine ray direction.

Show Guide Geometry

Controls if the geometry being instanced onto is drawn. Does not affect the behavior, only the viewport.

Transform Points

Move the intersected geometry.

Intersect Farthest Surface

Ray source is projected to farthest collision surface instead of the closest.

Point Intersection Normal

Ray point normals gets value of collision normals at points of intersection. These are the surface normals and not interpolated point normals. If you want the interpolated point normals, you will need to turn on Import Attributes from Hits and specify the N attribute. In that case, this option will have no effect.

Point Intersection Distance

Ray point dist attribute gets value of distance to collision source.

Reverse Rays

Set this to make rays fire in the direction opposite to the normals.

Ray Tolerance

Controls the tolerance of the ray intersection. Due to numerical round off, otherwise watertight geometry might let rays pass through it. The ray tolerance decreases the chance of ray leakage by allowing near misses to count as hits. For very small geometry, you may want to decrease the default to avoid false positives. Likewise, very large geometry may need a higher value.

Scale

When transforming points scale the intersection path.

Lift

Offset surface in normal direction after the points have been transformed to their new locations.

Bias

The minimum distance along the normal from the original position of the point where the rays will look for intersections. This allows you to offset the starting position of the rays.

Max Distance

The maximum distance from the original position of the point the rays will look at. No ray intersections outside this range will be detected. If Method is Minimum Distance, any points farther from the surface than this will not be moved.

Sample

Number of rays sent per point. If greater than 1, rays are randomly perturbed and combined using the method specified in Ray Combiner.

Jitter Scale

Controls perturbation of extra rays.

Ray Combiner

This option lets you specify how information from extra rays is used.

Average ray

The fired rays that hit the second input’s geometry are averaged. The point is then moved along its normal direction by the average distance. If you turned on Point Intersection Normal, the resulting normal is also the average from all the fired rays.

Median ray

The median length ray that hits the second input’s geometry is found. The point is then moved along its normal direction by the median ray’s length. If you turned on Point Intersection Normal, the resulting normal is taken from the median ray.

Shortest ray

The shortest ray that hits the second input’s geometry is found. The point is then moved along its normal direction by this ray’s length. If you turned on Point Intersection Normal, the resulting normal is taken from the shortest ray.

Longest ray

The Longest ray that hits the second input’s geometry is found. The point is then moved along its normal direction by this ray’s length. If you turned on Point Intersection Normal, the resulting normal is taken from the longest ray.

Seed

Seeds the random number generator. Each jittered ray will be seeded by this and its point number.

Create Point Group

Point group of all successful intersections.

Ray Hit Group

Name of the point group.

Prim Num Attribute

When enabled, an attribute will be output indicating the number of the primitive hit by each point. Enable this and Prim UVW Attribute for use with Attribute Interpolate, to have the points stick on deforming geometry.

Prim UVW Attribute

When enabled, an attribute will be output indicating the coordinates where each point hit, in the parameter space of the primitive each point hit. Enable this and Prim Num Attribute for use with Attribute Interpolate, to have the points stick on deforming geometry.

Import Attributes from Hits

This allows you to extract point attributes from the hit surface. The extracted attribute will take on an interpolated value according to where the surface is hit. This option works with the Ray Combiner option: the attribute value will either come from the average attribute value from all the hits or the value associated with the median length, shortest or longest ray. The interpolated attribute values are not normalized.

Point Attributes

Specify the point attributes from the second input that you want to extract. If the attributes you specify do not exist in the first input, they will be created. If the attributes you specify have the same name but a different size or type in the first input, they will be overwritten. If you specify the normal attribute here (N), the Point Intersection Normal option will have no effect and the final normal set to each point will be computed by interpolating the point normal from the target surface.

Inputs

Ray points or primitives

The geometry to project onto the geometry in the second input. This geometry must have point normal attributes (use the Point operator to add them).

Collision primitives

The geometry on which to project.

Examples

RayWrap Example for Ray geometry node

The Ray SOP projects one object over the surface contours of another.

It does so by calculating the collisions of the projected object’s normals with the surface geometry of the collided object.

In this example, a Grid is wrapped over the surface of a deformed Sphere using the Ray SOP.

A Facet SOP is used to correct the normals of the wrapped Grid after it is deformed over the surface.

See also

Geometry nodes