Skip to content
Merged
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
10 changes: 3 additions & 7 deletions src/renderers/common/Background.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ class Background extends DataMap {

// compute vertex position
const modifiedPosition = isOrtho.select( positionLocal.mul( orthoScale ), positionLocal );
let viewProj = cameraProjectionMatrix.mul( modelViewMatrix.mul( vec4( modifiedPosition, 1.0 ) ) );

// By using a w component of 0, the skybox will not translate when the camera moves through the scene
let viewProj = cameraProjectionMatrix.mul( modelViewMatrix.mul( vec4( modifiedPosition, 0.0 ) ) );

// force background to far plane so it does not occlude objects
viewProj = viewProj.setZ( viewProj.w );
Expand All @@ -127,12 +129,6 @@ class Background extends DataMap {
backgroundMesh.frustumCulled = false;
backgroundMesh.name = 'Background.mesh';

backgroundMesh.onBeforeRender = function ( renderer, scene, camera ) {

this.matrixWorld.copyPosition( camera.matrixWorld );

};

function onBackgroundDispose() {

background.removeEventListener( 'dispose', onBackgroundDispose );
Expand Down