RayTrace

Raycast Geometry

RayCast

The RayCast node allows rays to be cast into the scene. The rays are “fired” from the Position input vector and will travel in the direction of the Direction input vector. This is the fastest way of tracing rays through the scene, as the ray casting only returns the length the ray traveled before it hits another surface (on any object including the objects whose hit point is currently being evaluated). Both the Position and Direction inputs must be specified in world coordinates (the Transform and Transform2 nodes can be used as required). If the ray fired does not hit another object, then the Length is returned as being -1.0.

RayClosest

This node returns the distance to the closest mesh element in the hemisphere above the position supplied and in the direction supplied. This means that a Scalar value is output that can shade nearby geometry. In the example pictured we have used the settings to drive the colors of the outside edges of the LightWave logo.

RayTrace

The RayTrace node allows rays to be traced through the scene. The rays are “fired” from the Position input vector and will travel in the direction of the Direction input vector. As with the RayCast node, the ray trace function returns the length the ray traveled before it hit another surface. However, with RayTrace, the surface which the ray hits is also evaluated, and the result is returned as the Color output. This means that it may be used to trace reflection and refraction. Both the Position and Direction inputs must be specified in world coordinates (the Transform and Transform2 nodes can be used as required). It the ray fired does not hit another object, then the length is returned as being -1.0 and the color black.