Skip to content

Commit

Permalink
Water: Fix reflection bug similar to Reflector.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mugen87 committed Apr 2, 2020
1 parent 4d8781a commit 754a6b8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions examples/js/objects/Water.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,9 @@ THREE.Water = function ( geometry, options ) {
renderer.shadowMap.autoUpdate = false; // Avoid re-computing shadows

renderer.setRenderTarget( renderTarget );

renderer.state.buffers.depth.setMask( true ); // make sure the depth buffer is writable so it can be properly cleared, see #18897

if ( renderer.autoClear === false ) renderer.clear();
renderer.render( scene, mirrorCamera );

Expand Down
3 changes: 3 additions & 0 deletions examples/jsm/objects/Water.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,9 @@ var Water = function ( geometry, options ) {
renderer.shadowMap.autoUpdate = false; // Avoid re-computing shadows

renderer.setRenderTarget( renderTarget );

renderer.state.buffers.depth.setMask( true ); // make sure the depth buffer is writable so it can be properly cleared, see #18897

if ( renderer.autoClear === false ) renderer.clear();
renderer.render( scene, mirrorCamera );

Expand Down

0 comments on commit 754a6b8

Please sign in to comment.