Sfoglia il codice sorgente

Changes for r157 update - Shader changes

master
Palash Bansal 1 anno fa
parent
commit
8990b2196d
Nessun account collegato all'indirizzo email del committer

+ 1
- 1
examples/progressive-hdr-shadows-exp/script.ts Vedi File

@@ -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 );


+ 2
- 2
src/plugins/material/ClearcoatTintPlugin.ts Vedi File

@@ -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,

+ 1
- 2
src/plugins/material/ParallaxMappingPlugin.ts Vedi File

@@ -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(

+ 1
- 1
src/plugins/material/shaders/ParallaxMappingPlugin.relief.glsl Vedi File

@@ -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;
}

+ 1
- 1
src/plugins/pipeline/shaders/SSAOPlugin.patch.glsl Vedi File

@@ -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 );


Loading…
Annulla
Salva