Skip to content

Commit

Permalink
Merge pull request mrdoob#16230 from sneha-belkhale/bpcem_fix
Browse files Browse the repository at this point in the history
Examples: parallax envmaps fix
  • Loading branch information
mrdoob authored Apr 14, 2019
2 parents d6158ec + c4ff20e commit 6f8863b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions examples/webgl_materials_envmaps_parallax.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@
vec3 parallaxCorrectNormal( vec3 v, vec3 cubeSize, vec3 cubePos ) {
vec3 nDir = normalize( v );
vec3 rbmax = ( .5 * ( cubeSize - cubePos ) - vWorldPosition ) / nDir;
vec3 rbmin = ( - .5 * ( cubeSize - cubePos ) - vWorldPosition ) / nDir;
vec3 rbmax = ( .5 * cubeSize + cubePos - vWorldPosition ) / nDir;
vec3 rbmin = ( -.5 * cubeSize + cubePos - vWorldPosition ) / nDir;
vec3 rbminmax;
rbminmax.x = ( nDir.x > 0. ) ? rbmax.x : rbmin.x;
Expand Down Expand Up @@ -356,7 +356,8 @@

boxProjectedMat.onBeforeCompile = function ( shader ) {

shader.uniforms.cubeMapSize = { value: new THREE.Vector3( 200, 100, 100 ) };
//these parameters are for the cubeCamera texture
shader.uniforms.cubeMapSize = { value: new THREE.Vector3( 200, 200, 100 ) };
shader.uniforms.cubeMapPos = { value: new THREE.Vector3( 0, - 50, 0 ) };
shader.uniforms.flipEnvMap.value = true;

Expand Down

0 comments on commit 6f8863b

Please sign in to comment.