Houdini 22.0 Nodes Geometry nodes

Collision Detect CL geometry node

Detects collisions using OpenCL

On this page
Since 22.0

The Collision Detect CL SOP is a low-level node that performs collision detection between polygonal and tetrahedral geometry using OpenCL. It generates collision data as array attributes, which can then be processed in a loop for collision resolution or other custom operations. This SOP is primarily used by the Otis Solver for collision detection workflows.

Note

This SOP only supports triangulated polygonal geometry. Tetrahedral geometry is also supported when using the Intersecting Tetrahedra option.

This SOP uses a few point attributes:

Type

Name

Description

float

pscale

The size of the points for collision detection.

vector

pprevious

The previous position of the point, used for Continuous collision detection.

The following per-particle point attributes can be used to control the behavior of this node:

Type

Name

Description

string

name

Used when Ignore Neighbors with Same Name or Piece is turned on. If present, this attribute is used before piece.

integer

piece

Used when Ignore Neighbors with Same Name or Piece is turned on.

Parameters

Group

The group of polygon primitives to test for collisions.

Tetrahedron Group

The group of tetrahedron primitives to test for collisions when Intersecting Tetrahedra is turned on.

Radius Scale

A scale applied to the pscale point attribute before detecting collisions.

Intersecting Tetrahedra

For Point/Triangle collisions, performs point/tetrahedron collision detection by finding the tetrahedron in the Tetrahedron Group that contains the point, then finding the closest triangle within the Group.

Surface Collision Detection

The type of collision detection to do for the primitives in the specified Group.

None

Do not perform collision detection.

Discrete

Perform discrete collision detection using only the current point position, P.

Continuous

Perform continuous collision detection using the path from each point’s previous position (pprevious), to its current position (P).

Point/Triangle Collisions

Detect collisions between points and triangles.

Edge/Edge Collisions

Detect collisions between triangle edges.

CCD Accuracy

An accuracy test for Continuous Collisions. This should usually be left at its default value.

Ignore Neighbors with Same Name or Piece

When turned on, checks the current point’s name or piece attribute and skips collisions with primitives whose points have the same value. If both attributes exist, name is used.

Several output array attributes record the collisions detected.

Hit Types Attr

The name of an integer array detail attribute containing an entry for the type of each collision. A value of 0 indicates a Point/Triangle collision, and a value of 1 indicates an Edge/Edge collision.

Hit Points Attr

The name of an integer array detail attribute containing four point indices for each collision.

For Point/Triangle collisions, the first point is the colliding point, followed by the three triangle points.

For Edge/Edge collisions, the first two points define the first edge, and the remaining two points define the second edge.

Hit UVs Attr

The name of a float array detail attribute containing two values for each collision.

For Point/Triangle collisions, the uv’s are the barycentric coordinates of the collision point on the triangle.

For Edge/Edge collisions, the first value is the uv along the first edge, and the second value is the uv along the second edge.

Hit Normals Attr

The name of a float array detail attribute containing three values for each collision, representing the collision normal.

Hit Index Attr

The name of an integer array point attribute listing the collisions each point is involved in. These values are indices into the detail attributes described above.

Hit Vertex Attr

The name of an integer array point attribute indicating which vertex (0–3) a point represents within a collision; that is, its position within a single four-point entry of the hitpts array.

For example, if the point is the first vertex of a triangle involved in a collision, the value is 1. If it is the second vertex of the second edge in a collision, the value is 3.

Cache Reset Key

Internal acceleration structures can often be re-used for different point positions if they have not changed over much. If this parameter evaluates to the same value, the tree will only be reset if the topology changes. Negative values will always reset the tree.

Leave on GPU

Fills the output arrays without transferring the data back to the CPU.

When this option is turned on, CPU-based code such as VEX, as well as the Geometry Spreadsheet, cannot access the values. However, OpenCL code can access the arrays directly on the GPU, avoiding the cost of copying large amounts of data back to the CPU.

Note

In SOPs, GPU buffers are cleared outside compiled blocks. If Leave on GPU is turned on, any OpenCL SOP that uses the data must be in the same compiled SOP where the array was created.

Examples

CollisionDetectCLVisualization Example for Collision Detect CL geometry node

This example file shows how to visualize collisions between triangles output from the Collision Detect CL SOP.

See also

Geometry nodes