Ray SOP

From TouchDesigner 088 Wiki

Summary

The Ray SOP is used to project one surface onto another. Rays are projected from each point of the input geometry in the direction of its normal. This can be used to drape clothes over surfaces, shrink-wrap one object with another, and other similar effects.

PythonIcon.png raySOP_Class

Parameters

Group /group - If there are input groups, specifying a group name in this field will cause this SOP to act only upon the group specified. Accepts patterns, as described in Pattern Matching.

Method /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 primitve onto another.

Transform Points /dotrans - If selected, it will transform the input points as defined below. Leave this off when only interested in updating the source point attributes.

Intersect Farthest Surface /lookfar - If selected, this option allows the user to choose between intersecting with the closest intersecting object or the furthest. See example, below.

Point Intersection Normal /putnml - If selected, updates each point in the source geometry with the normal at the collision surface it intersects with. If the point doesn't intersect at the collision surface, a normal of (0,0,0) is used.

Point Intersection Distance /putdist - If selected, updates each point intersected with the distance to the collision surface. If the point doesn't intersect at the collision surface a distance of 0 is used. This value is placed in the $DIST point attribute, accessible from the Point SOP.

Scale /scale - A value of zero will leave the input point unaffected. A value of one will land the point on the intersection surface. Negative values and values > 1 are also valid.

Lift /lift - This value further offsets the surface input by offsetting it in the direction of its normal.

Sample /sample - This value determines the number of rays sent per point. If greater than one, the remaining rays are perturbed randomly, and averaged.

Jitter Scale /jitter - Controls the perturbation of the extra sample rays.

Seed /seed - Allows a different random sequence at higher sampling rates.

Create Point Group /newgrp - If selected, it will create a point group containing all the points which were intersected successfully.

Ray Hit Group /hitgrp - Specifies the name of the above point group.

Local Variables

$DIST - Distance of the point to an intersected surface. This can be used in expressions by the Point SOP.

Example

  1. Place a Grid SOP and translate it in TZ by 2.5. Turn it's template flag on.
  2. Append a Point SOP to the Grid and enable the Create Point Normals option.
  3. Place a NURBS Sphere with a Radius of 2,2,2 and translate it in Z by -2.5 .
  4. Display point normals by enabling the option in the Viewport > Display Options.
  5. Append a Ray SOP to the Point SOP and connect the Sphere to the right input. Make it the display SOP.
  6. Toggle the Intersect Farthest Surface button on and off.

The Ray SOP 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.

See Also