Clears the depth buffer in WebGL mode.
clearDepth()
clears information about how far objects are from the camera in 3D space. This information is stored in an object called the depth buffer. Clearing the depth buffer ensures new objects aren't drawn behind old ones. Doing so can be useful for feedback effects in which the previous frame serves as the background for the current frame.
The parameter, depth
, is optional. If a number is passed, as in clearDepth(0.5)
, it determines the range of objects to clear from the depth buffer. 0 doesn't clear any depth information, 0.5 clears depth information halfway between the near and far clipping planes, and 1 clears depth information all the way to the far clipping plane. By default, depth
is 1.
Note: clearDepth()
can only be used in WebGL mode.
Ejemplos
Sintaxis
clearDepth([depth])
Parámetros
amount of the depth buffer to clear between 0 (none) and 1 (far clipping plane). Defaults to 1.