Skip to main content

Texture

DepthTexture

This class can be used to automatically save the depth information of a rendering into a texture. When using a WebGL 1 rendering context, DepthTexture requires support for the WEBGL_depth_texture extension.

Examples

[example:webgl_depth_texture depth / texture]

Constructor

DepthTexture

function DepthTexture( width: Number, height: Number, type: Constant, mapping:
Constant, wrapS: Constant, wrapT: Constant, magFilter: Constant, minFilter:
Constant, anisotropy: Number, format: Constant ): void;

width -- width of the texture.
height -- height of the texture.
type -- Default is THREE.UnsignedIntType when using DepthFormat and THREE.UnsignedInt248Type when using DepthStencilFormat. See type constants for other choices.
mapping -- See mapping mode constants for details.
wrapS -- The default is THREE.ClampToEdgeWrapping. See wrap mode constants for other choices.
wrapT -- The default is THREE.ClampToEdgeWrapping. See wrap mode constants for other choices.
magFilter -- How the texture is sampled when a texel covers more than one pixel. The default is THREE.NearestFilter. See magnification filter constants for other choices.
minFilter -- How the texture is sampled when a texel covers less than one pixel. The default is THREE.NearestFilter. See minification filter constants for other choices.
anisotropy -- The number of samples taken along the axis through the pixel that has the highest density of texels. By default, this value is 1. A higher value gives a less blurry result than a basic mipmap, at the cost of more texture samples being used. Use renderer.getMaxAnisotropy() to find the maximum valid anisotropy value for the GPU; this value is usually a power of 2.
format -- must be either DepthFormat (default) or DepthStencilFormat. See format constants for details.

Properties

See the base Texture class for common properties - the following are also part of the texture class, but have different defaults here.

format

Either DepthFormat (default) or DepthStencilFormat. See format constants for details.

type

Default is THREE.UnsignedIntType when using DepthFormat and THREE.UnsignedInt248Type when using DepthStencilFormat. See format constants for details.

magFilter

How the texture is sampled when a texel covers more than one pixel. The default is THREE.NearestFilter. See magnification filter constants for other choices.

minFilter

How the texture is sampled when a texel covers less than one pixel. The default is THREE.NearestFilter. See magnification filter constants for other choices.

flipY

Depth textures do not need to be flipped so this is false by default.

.generateMipmaps

Depth textures do not use mipmaps.

isDepthTexture

isDepthTexture: Boolean;  

Read-only flag to check if a given object is of type DepthTexture.

compareFunction

compareFunction: number;  

This is used to define the comparison function used when comparing texels in the depth texture to the value in the depth buffer. Default is null which means comparison is disabled.

See the texture constants page for details of other functions.

Methods

See the base Texture class for common methods.

Source

src/textures/DepthTexture.js