diff --git a/examples/jsm/postprocessing/SSRPass.js b/examples/jsm/postprocessing/SSRPass.js index 1e139cbbe8d490..c1662ab52345dd 100644 --- a/examples/jsm/postprocessing/SSRPass.js +++ b/examples/jsm/postprocessing/SSRPass.js @@ -219,9 +219,9 @@ var SSRPass = function ( { renderer, scene, camera, width, height, selects, enco } this.ssrMaterial = new ShaderMaterial( { - defines: Object.assign( { - MAX_STEP: Math.sqrt( window.innerWidth * window.innerWidth + window.innerHeight * window.innerHeight ) - }, SSRShader.defines ), + defines: Object.assign( {}, SSRShader.defines, { + MAX_STEP: Math.sqrt( this.width * this.width + this.height * this.height ) + } ), uniforms: UniformsUtils.clone( SSRShader.uniforms ), vertexShader: SSRShader.vertexShader, fragmentShader: SSRShader.fragmentShader, diff --git a/examples/jsm/shaders/SSRShader.js b/examples/jsm/shaders/SSRShader.js index 6d289809bac05d..ac411ad715bead 100644 --- a/examples/jsm/shaders/SSRShader.js +++ b/examples/jsm/shaders/SSRShader.js @@ -163,7 +163,7 @@ var SSRShader = { float totalStep=max(abs(xLen),abs(yLen)); float xSpan=xLen/totalStep; float ySpan=yLen/totalStep; - for(float i=0.;i=totalStep) break; vec2 xy=vec2(d0.x+i*xSpan,d0.y+i*ySpan); if(xy.x<0.||xy.x>resolution.x||xy.y<0.||xy.y>resolution.y) break;