Optional
parameters: WebGLRendererParametersDefines whether the renderer should automatically clear its output before rendering.
If autoClear is true, defines whether the renderer should clear the color buffer. Default is true.
If autoClear is true, defines whether the renderer should clear the depth buffer. Default is true.
If autoClear is true, defines whether the renderer should clear the stencil buffer. Default is true.
Compiles all materials in the scene with the camera. This is useful to precompile shaders before the first rendering. If you want to add a 3D object to an existing scene, use the third optional parameter for applying the target scene. Note that the (target) scene's lighting should be configured before calling this method.
Asynchronous version of compile(). The method returns a Promise that resolves when the given scene can be rendered without unnecessary stalling due to shader compilation. This method makes use of the KHR_parallel_shader_compile WebGL extension.
Debug configurations.
A Canvas where the renderer draws its output. This is automatically created by the renderer in the constructor (if not provided already); you just need to add it to your page.
Readonly
isDefault is LinearEncoding.
Use .outputColorSpace in three.js r152+.
Use .shadowMap.cullFace instead.
Use .shadowMap.enabled instead.
Use .shadowMap.type instead.
Defines whether the renderer should sort objects. Default is true.
Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733.
Use .xr instead.
Color space used for output to HTMLCanvasElement. Supported values are SRGBColorSpace and LinearSRGBColorSpace.
Use .setAnimationLoop() instead.
Copies the pixels of a texture in the bounds sourceBox in the desination texture starting from the given position.
Specifies the bounds
Specifies the pixel offset into the dstTexture where the copy will occur.
Specifies the source texture.
Specifies the destination texture.
Optional
level: numberSpecifies the destination mipmap level of the texture.
Use .setScissorTest() instead.
Use .getRenderTarget() instead.
Use .capabilities.getMaxAnisotropy() instead.
Use .capabilities.precision instead.
Returns the current render target. If no render target is set, null is returned.
Initializes the given texture. Can be used to preload a texture rather than waiting until first render (which can cause noticeable lags due to decode and GPU upload overhead).
The texture to Initialize.
Optional
activeCubeFaceIndex: numberRender a scene or an object using a camera. The render is done to a previously specified WebGLRenderTarget#renderTarget .renderTarget set by calling .setRenderTarget or to the canvas as usual.
By default render buffers are cleared before rendering but you can prevent this by setting the property autoClear to false. If you want to prevent only certain buffers being cleared you can set either the autoClearColor, autoClearStencil or autoClearDepth properties to false. To forcibly clear one ore more buffers call .clear.
Use .state.reset() instead.
A build in function that can be used instead of requestAnimationFrame. For WebXR projects this function must be used.
The function will be called every available frame. If null
is passed it will stop any already ongoing animation.
Sets the clear color, using color for the color and alpha for the opacity.
Optional
alpha: numberSets the active render target.
The renderTarget that needs to be activated. When null
is given, the canvas is set as the active render target instead.
Optional
activeCubeFace: numberSpecifies the active cube side (PX 0, NX 1, PY 2, NY 3, PZ 4, NZ 5) of WebGLCubeRenderTarget.
Optional
activeMipmapLevel: numberSpecifies the active mipmap level.
Sets the scissor area from (x, y) to (x + width, y + height).
Optional
y: numberOptional
width: numberOptional
height: numberSets the viewport to render from (x, y) to (x + width, y + height). (x, y) is the lower-left corner of the region.
Optional
y: numberOptional
width: numberOptional
height: numberUse .extensions.get( 'EXT_blend_minmax' ) instead.
Use .extensions.get( 'WEBGL_compressed_texture_pvrtc' ) instead.
Use .extensions.get( 'WEBGL_compressed_texture_s3tc' ) instead.
Use .extensions.get( 'OES_texture_float' ) instead.
Use .extensions.get( 'OES_texture_half_float' ) instead.
Use .extensions.get( 'ANGLE_instanced_arrays' ) instead.
Use .extensions.get( 'OES_standard_derivatives' ) instead.
Use .capabilities.vertexTextures instead.
The WebGL renderer displays your beautifully crafted scenes using WebGL, if your device supports it. This renderer has way better performance than CanvasRenderer.
see https://github.com/mrdoob/three.js/blob/master/src/renderers/WebGLRenderer.js|src/renderers/WebGLRenderer.js