Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions src/renderers/WebGLRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1339,13 +1339,27 @@ class WebGLRenderer {

const isWebGL2 = capabilities.isWebGL2;

const currentRenderTarget = _this.getRenderTarget();

// If the current render target has a stencil buffer, then the transmission render target also needs it so that it's rendered the same way.

const needsStencilBuffer = currentRenderTarget !== null ? currentRenderTarget.stencilBuffer : _this.getContextAttributes().stencil;

if ( _transmissionRenderTarget !== null && needsStencilBuffer === true && _transmissionRenderTarget.stencilBuffer === false ) {

_transmissionRenderTarget.dispose();
_transmissionRenderTarget = null;

}

if ( _transmissionRenderTarget === null ) {

_transmissionRenderTarget = new WebGLRenderTarget( 1, 1, {
generateMipmaps: true,
type: extensions.has( 'EXT_color_buffer_half_float' ) ? HalfFloatType : UnsignedByteType,
minFilter: LinearMipmapLinearFilter,
samples: ( isWebGL2 ) ? 4 : 0
samples: ( isWebGL2 ) ? 4 : 0,
stencilBuffer: needsStencilBuffer
} );

// debug
Expand Down Expand Up @@ -1374,7 +1388,6 @@ class WebGLRenderer {

//

const currentRenderTarget = _this.getRenderTarget();
_this.setRenderTarget( _transmissionRenderTarget );

_this.getClearColor( _currentClearColor );
Expand Down