diff --git a/examples/webgl_lights_physical.html b/examples/webgl_lights_physical.html index 1b40c70c084340..2d1fff987f43f0 100644 --- a/examples/webgl_lights_physical.html +++ b/examples/webgl_lights_physical.html @@ -111,7 +111,7 @@ roughness: 0.8, color: 0xffffff, metalness: 0.2, - bumpScale: 0.0005 + bumpScale: 1 } ); const textureLoader = new THREE.TextureLoader(); textureLoader.load( 'textures/hardwood2_diffuse.jpg', function ( map ) { @@ -149,7 +149,7 @@ cubeMat = new THREE.MeshStandardMaterial( { roughness: 0.7, color: 0xffffff, - bumpScale: 0.002, + bumpScale: 1, metalness: 0.2 } ); textureLoader.load( 'textures/brick_diffuse.jpg', function ( map ) { diff --git a/examples/webgl_materials_bumpmap.html b/examples/webgl_materials_bumpmap.html index 96fa9db7714a09..835aaa547bc7aa 100644 --- a/examples/webgl_materials_bumpmap.html +++ b/examples/webgl_materials_bumpmap.html @@ -92,7 +92,7 @@ specular: 0x666666, shininess: 25, bumpMap: mapHeight, - bumpScale: 0.1 + bumpScale: 10 } ); loader = new GLTFLoader(); diff --git a/src/renderers/shaders/ShaderChunk/bumpmap_pars_fragment.glsl.js b/src/renderers/shaders/ShaderChunk/bumpmap_pars_fragment.glsl.js index 7ac75145c4a319..07e5c5f84bb41a 100644 --- a/src/renderers/shaders/ShaderChunk/bumpmap_pars_fragment.glsl.js +++ b/src/renderers/shaders/ShaderChunk/bumpmap_pars_fragment.glsl.js @@ -24,8 +24,9 @@ export default /* glsl */` vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) { - vec3 vSigmaX = dFdx( surf_pos.xyz ); - vec3 vSigmaY = dFdy( surf_pos.xyz ); + // normalize is done to ensure that the bump map looks the same regardless of the texture's scale + vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) ); + vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) ); vec3 vN = surf_norm; // normalized vec3 R1 = cross( vSigmaY, vN );