| @@ -130,7 +130,7 @@ float ambientOcclusion = getShadow( directionalShadowMap[ ii ], edls.shadowMapSi | |||
| #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 ); | |||
| @@ -67,8 +67,8 @@ vec3 clearcoatTint(const in float dotNV, const in float dotNL, const in float cl | |||
| // Note: clearcoat only considers specular, not diffuse | |||
| 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 | |||
| shader.fragmentShader = shaderReplaceString(shader.fragmentShader, | |||
| @@ -68,8 +68,7 @@ export class ParallaxMappingPlugin extends AViewerPluginSync { | |||
| shader.fragmentShader = shaderReplaceString(shader.fragmentShader, | |||
| // .replace('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>', | |||
| shaderReplaceString( | |||
| @@ -149,7 +149,7 @@ vec3 reliefParallaxPerturbNormal(in float faceDirection, inout vec3 normal){ | |||
| // 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; | |||
| } | |||
| @@ -12,7 +12,7 @@ reflectedLight.indirectDiffuse *= ambientOcclusion; | |||
| #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 ); | |||