Skip to content

Commit 3923a4b

Browse files
committed
Apply cone-traced AO factor to ambient color.
1 parent 52db141 commit 3923a4b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/apps/ch11_voxel/ch11_voxel/resources/shaders/ch11_Pbr.frag

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ void main(void)
370370
// TODO: Address this expensive calculation. Should everything happen in world space?
371371
vec3 shadingNormal_world = mat3(ub_cameraToWorld) * shadingNormal_view;
372372

373-
float voxelAoFactor;
373+
float voxelAoFactor = 1;
374374

375375
LightContributions indirect =
376376
applyIndirectLight_pbr(position_aabb,
@@ -389,11 +389,12 @@ void main(void)
389389
* u_LightingFactors.w
390390
;
391391

392-
393392
// Sum contributions
394393
// Note: the ambient term is a quick hack, to be removed when IBL is in place
395394
// We multiply it by the diffuse color, so metals do not have ambient terms, and dielectrics have their tint.
396-
vec3 ambient = ub_AmbientColor.rgb * material.ambientColor.rgb * pbrParameters.diffuseColor;
395+
vec3 ambient = ub_AmbientColor.rgb * material.ambientColor.rgb
396+
* pbrParameters.diffuseColor
397+
* voxelAoFactor;
397398
vec3 diffuse = diffuseAccum * material.diffuseColor.rgb;
398399
vec3 specular = specularAccum * material.specularColor.rgb;
399400

0 commit comments

Comments
 (0)