diff --git a/docs/api/en/renderers/WebGLRenderTarget.html b/docs/api/en/renderers/WebGLRenderTarget.html
index 7f264688672929..88729fdb4d0f14 100644
--- a/docs/api/en/renderers/WebGLRenderTarget.html
+++ b/docs/api/en/renderers/WebGLRenderTarget.html
@@ -93,6 +93,15 @@
[property:DepthTexture depthTexture]
If set, the scene depth will be rendered to this texture. Default is null.
+ [property:WebGLRenderbuffer ownDepthBuffer]
+
+ If set, the texture will use the user provided WebGLRenderBuffer instead of the one created by the renderer for this texture. Default is undefined.
+
+ Usage:
+
+ const myTarget = new THREE.WebGLRenderTarget( 512, 512 );
+myTarget.ownDepthBuffer = gl.createRenderBuffer();
+
Methods
diff --git a/docs/api/zh/renderers/WebGLRenderTarget.html b/docs/api/zh/renderers/WebGLRenderTarget.html
index 072a5efe405acb..f74447e2774917 100644
--- a/docs/api/zh/renderers/WebGLRenderTarget.html
+++ b/docs/api/zh/renderers/WebGLRenderTarget.html
@@ -89,6 +89,15 @@ [property:DepthTexture depthTexture]
如果设置,那么场景的深度将会被渲染到此纹理上。默认为null
+ [property:WebGLRenderbuffer ownDepthBuffer]
+
+ 如果设置,纹理将使用用户提供的 WebGLRenderBuffer,而不是渲染器为此纹理创建的缓冲区。默认是 undefined
+
+ 用法:
+
+ const myTarget = new THREE.WebGLRenderTarget( 512, 512 );
+myTarget.ownDepthBuffer = gl.createRenderBuffer();
+
方法
diff --git a/src/renderers/WebGLRenderTarget.js b/src/renderers/WebGLRenderTarget.js
index 41ad23cccf91f4..ece3cc07ce0c41 100644
--- a/src/renderers/WebGLRenderTarget.js
+++ b/src/renderers/WebGLRenderTarget.js
@@ -35,6 +35,7 @@ class WebGLRenderTarget extends EventDispatcher {
this.depthBuffer = options.depthBuffer !== undefined ? options.depthBuffer : true;
this.stencilBuffer = options.stencilBuffer !== undefined ? options.stencilBuffer : false;
this.depthTexture = options.depthTexture !== undefined ? options.depthTexture : null;
+ this.ownDepthBuffer = undefined;
}
diff --git a/src/renderers/webgl/WebGLTextures.js b/src/renderers/webgl/WebGLTextures.js
index 6e4bd81906579f..79d5533302fc85 100644
--- a/src/renderers/webgl/WebGLTextures.js
+++ b/src/renderers/webgl/WebGLTextures.js
@@ -1294,7 +1294,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
state.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );
renderTargetProperties.__webglDepthbuffer = _gl.createRenderbuffer();
- setupRenderBufferStorage( renderTargetProperties.__webglDepthbuffer, renderTarget, false );
+ setupRenderBufferStorage( renderTarget.ownDepthBuffer || renderTargetProperties.__webglDepthbuffer, renderTarget, false );
}