| #if defined( USE_ENVMAP ) && defined( STANDARD ) | #if defined( USE_ENVMAP ) && defined( STANDARD ) | ||||
| float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) ); | |||||
| float dotNV = saturate( dot( geometryNormal, geometryViewDir ) ); | |||||
| reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness ); | reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness ); | ||||
| // Note: clearcoat only considers specular, not diffuse | // Note: clearcoat only considers specular, not diffuse | ||||
| shader.fragmentShader = shaderReplaceString(shader.fragmentShader, | shader.fragmentShader = shaderReplaceString(shader.fragmentShader, | ||||
| 'float dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );', | |||||
| 'float dotNVcc = saturate( dot( geometry.clearcoatNormal, -refract(geometry.viewDir, geometry.clearcoatNormal, 1./ccIor) ) );') | |||||
| 'float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );', | |||||
| 'float dotNVcc = saturate( dot( geometryClearcoatNormal, -refract(geometryViewDir, geometryClearcoatNormal, 1./ccIor) ) );') | |||||
| // todo: we are considering all light is coming from env map, but we should consider light coming from light sources by seperating light and env map attenuation | // todo: we are considering all light is coming from env map, but we should consider light coming from light sources by seperating light and env map attenuation | ||||
| shader.fragmentShader = shaderReplaceString(shader.fragmentShader, | shader.fragmentShader = shaderReplaceString(shader.fragmentShader, |
| shader.fragmentShader = shaderReplaceString(shader.fragmentShader, | shader.fragmentShader = shaderReplaceString(shader.fragmentShader, | ||||
| // .replace('texture2D( map, parallaxUv.xy )', 'texture2D( map, parallaxUv.xy )') | // .replace('texture2D( map, parallaxUv.xy )', 'texture2D( map, parallaxUv.xy )') | ||||
| 'texture2D( map, parallaxUv.xy )', | 'texture2D( map, parallaxUv.xy )', | ||||
| this.debugNormals ? 'vec4(normal, 1.); normal = geometryNormal' : 'vec4(parallaxUv.z,0., 0., 1.)') | |||||
| this.debugNormals ? 'vec4(normal, 1.); normal = nonPerturbedNormal' : 'vec4(parallaxUv.z,0., 0., 1.)') | |||||
| shader.fragmentShader = shaderReplaceString(shader.fragmentShader, '#include <normal_fragment_maps>', | shader.fragmentShader = shaderReplaceString(shader.fragmentShader, '#include <normal_fragment_maps>', | ||||
| shaderReplaceString( | shaderReplaceString( |
| // normal = geometryNormal; | // normal = geometryNormal; | ||||
| // todo: modify geometry.position (vViewPosition) for point, spot and area lights | |||||
| // todo: modify geometryPosition (vViewPosition) for point, spot and area lights | |||||
| return parallaxUv; | return parallaxUv; | ||||
| } | } |
| #if defined( USE_ENVMAP ) | #if defined( USE_ENVMAP ) | ||||
| float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) ); | |||||
| float dotNV = saturate( dot( geometryNormal, geometryViewDir ) ); | |||||
| reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness ); | reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness ); | ||||