Traced Ray
A TracedRay is a ray that has been traced through a scene. The TracedRay handles the ray's position and orientation, as well as runs any shader effects on the ray.
Warning
This class is not meant to be used directly.
Constructor
TracedRay TracedRay.new(Vector3 origin , Vector3 direction , int maxBounces , RaycastParams raycastParams , table<Shader> shaders , dict out? )
Creates a new TracedRay.
Properties
Vector2 Pixel
The viewport pixel the ray originates from.
dict Out
The output of the shader effects applied to the ray. The keys must match the names of the buffers in the Ray Tracer.
Example of the Out property structure
Out = {
Color = Color3.new(1, 0, 1),
Depth = 1,
Normal = Vector3.new(0, 0, 0),
}
dict OutDefaults
Shallow copy of the output of the shader effects applied to the ray. These are provided to rays created using the Continue, Reflect and Refract Shader methods
Static property
This property is not meant to be used directly or modified.
int Bounces
The number of bounces the ray has undergone.
dict {float Distance , Vector3 Normal } InitialCollision
The first collision the ray has undergone.
Vector3 Origin
The origin of the ray.
Vector3 Direction
The direction of the ray.
int MaxBounces
The maximum number of bounces the ray can undergo.
RaycastParams RaycastParams
The raycast parameters used to trace the ray.
table<Shader> Shaders
The shaders that the ray can run.
Color3 Color
The color of the ray.
Deprecated
This property is deprecated. Use the Out property instead.
Methods
TracedRay Trace(... )
Traces the ray and runs any shader effects when the ray terminates. Returns the TracedRay object itself.