Ray Tracing Camera
The RayTracingCamera is a special camera class that can be used to render a scene using ray tracing. The camera provides the necessary functions to render a scene using ray tracing.
Warning
RayTracingCamera can not be used as a normal camera.
Creating a RayTracingCamera
RayTracingCamera RayTracingCamera.new(Vector2 resolution , float fieldOfView , float nearPlane , float farPlane , CFrame CFrame , string projection [="perspective"] , float orthographicSize? [=1] )
Creates a new RayTracingCamera.
Important
The RayTracingCamera acts as the origin point for the rays. This means that the camera's position and orientation must be set before the camera is used to render a scene.
Note
The camera does not do any rendering itself. It only provides the necessary functions to render a scene using ray tracing. Images can be rendered using the Raytracer class.
Properties
Vector2 Resolution
The resolution of the camera viewport in pixels.
float FieldOfView
The camera's field of view in radians.
Note
FieldOfView is applied only if Projection is "perspective".
float FarPlane
The distance to the far plane.
CFrame CFrame
The camera's position and orientation.
string Projection
The projection type, either "perspective" or "orthographic".
Note
Orthographic projection ignores the field of view and only uses OrthographicSize. Perspective projection uses the field of view to calculate the camera's view frustum.
float OrthographicSize
The size of the orthographic projection in studs, which is applied only if
Note
OrthographicSize is applied only if Projection is "orthographic".
Methods
Vector3 GetFarPlaneSize()
Returns the size of the far plane in studs.
Vector3 GetNearPlaneSize()
Returns the size of the near plane in studs.
CFrame GetNearPlaneCFrame()
Returns the CFrame (position and orientation) of the camera's near plane.
CFrame GetFarPlaneCFrame()
Returns the CFrame of the camera's far plane.
Vector3 origin , Vector3 direction GetRay(Vector2 pixel )
Returns the origin and direction of the ray that passes through the given pixel.