Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

RayTracingRenderer

Lucas Crane edited this page Mar 24, 2020 · 4 revisions

Ray Tracing Renderer is modeled after WebGLRenderer.

Constructor

RayTracingRenderer ( parameters : Object )

parameters - (optional) object with properties that define the renderer's initial behavior. The following are valid parameters:

  • canvas - A canvas where the renderer draws its output. This corresponds to the domElement property below. If not passed in here, a new canvas element will be created.

Properties

.bounces : Number

Sets the number of ray bounces generated during the path tracing algorithm. Supported values lie between 1 and 6. A value of 1 produces a directly illuminated render with no global illumination. Higher numbers contribute to global illumination and greater realism but with diminishing returns. Default is 3.

.domElement : HTMLCanvasElement

.maxHardwareUsage : Boolean

Change this property only for debugging purposes. If set to false, the renderer will dynamically scale performance so that each call to render() will consume the amount of time specified by setRenderTime(). This allows the renderer to scale so as to avoid using all of the user's available resources and locking up the system. If set to true, this dynamic scaling is disabled and each call to render() will take as long as necessary to render one frame across the entire screen. Setting this property to true is useful for measuring the rendering speed of the renderer, but should be set to false otherwise. Default is false.

.needsUpdate : Boolean

Specifies that the renderer needs to be reinitialized. This property should be set to true whenever any mesh, material, or geometry in the scene has changed. The renderer will not automatically reflect any changes made to the scene without setting this property. Default is true.

.onSampleRendered : Function

This function will be called when the next sample has finished rendering. The arguments are:
sample - The total number of samples progressively rendered.

timeElapsed - The time elapsed (in ms) between samples.

.renderWhenOffFocus : Boolean

Specifies that the renderer should consume resources and continually render the scene even when the user clicks away from the browser window. When an animation loop uses requestAnimationFrame, the loop is only paused when the browser is switched to a different tab. Setting this property to false will also configure the renderer to pause when the user clicks away from the window (even if the tab is still the active browser tab). Default is true.

.toneMapping : Constant

Methods

.dispose ( ) : Number

Dispose of the current rendering context. This method should be called when the renderer is no longer needed by the application, otherwise garbage collection will fail to free the context's memory usage.

.getPixelRatio ( ) : Number

.getSize ( target : Vector2 ) : Vector2

.render ( scene : Scene, camera : Camera ) : null

.getTotalSamplesRendered ( ) : Number

Returns the total number of samples progressively rendered from the currently held camera angle. This number resets to 0 when the camera moves and the progressive rendering starts over.

.setSize ( width: Integer, height : Integer, updateStyle : Boolean ) : null

Static Methods

.isSupported ( ) : Boolean

Returns true if the browser supports WebGL2 and the required extensions to run the renderer. Otherwise returns false.