DepthTexture - Verge3D User Manual - Soft8Soft
Description: Learn how to use DepthTexture in your interactive 3D apps made with Verge3D

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.

## Constructor

### DepthTexture(width : Integer, height : Integer, type : Constant, mapping : Constant, wrapS : Constant, wrapT : Constant, magFilter : Constant, minFilter : Constant, anisotropy : Integer, format : Constant)

- width — width of the texture.
- height — height of the texture.
- type — default is v3d.UnsignedIntType when using DepthFormat and v3d.UnsignedInt248Type when using DepthStencilFormat. See type constants for other choices.
- mapping — see mapping mode constants for details.
- wrapS — the default is v3d.ClampToEdgeWrapping. See wrap mode constants for other choices.
- wrapT — the default is v3d.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 v3d.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 v3d.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 inherited 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.

### # .isDepthTexture : Boolean

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

### type

Default is v3d.UnsignedIntType when using DepthFormat and v3d.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 v3d.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 v3d.NearestFilter. See minification 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.

## Methods

See the base Texture class for inherited methods.

## Source

For more info on how to obtain the source code of this module see this page.