Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build/three.cjs

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions build/three.module.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/three.module.min.js

Large diffs are not rendered by default.

Binary file modified examples/screenshots/webgl_animation_keyframes.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/renderers/shaders/ShaderChunk/aomap_fragment.glsl.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default /* glsl */`
// reads channel R, compatible with a combined OcclusionRoughnessMetallic (RGB) texture
float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;

reflectedLight.indirectDiffuse *= ambientOcclusion;
reflectedLight.indirectDiffuse *= computeMultiBounceAO( ambientOcclusion, material.diffuseColor );

#if defined( USE_CLEARCOAT )
clearcoatSpecularIndirect *= ambientOcclusion;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -588,10 +588,27 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia
#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical
#define RE_IndirectSpecular RE_IndirectSpecular_Physical

// Multi-bounce ambient occlusion approximation for diffuse lighting
// ref: https://www.activision.com/cdn/research/Practical_Real_Time_Strategies_for_Accurate_Indirect_Occlusion_NEW%20VERSION_COLOR.pdf
vec3 computeMultiBounceAO( const in float ambientOcclusion, const in vec3 albedo ) {

vec3 a = 2.0404 * albedo - 0.3324;
vec3 b = -4.7951 * albedo + 0.6417;
vec3 c = 2.7552 * albedo + 0.6903;

float x = ambientOcclusion;

return max( vec3( x ), ( ( x * a + b ) * x + c ) * x );

}

// ref: https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {

return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
float specularOcclusion = saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );

// Smoothly disable specular occlusion for very smooth surfaces to prevent over-darkening
return mix( 1.0, specularOcclusion, smoothstep( 0.01, 0.1, roughness ) );

}
`;