Fine tune WebGL book indirect lighting
This commit is contained in:
@@ -552,13 +552,14 @@ function configureBookShadowReceiver(material, strength) {
|
|||||||
float tableReach = 1.0 - smoothstep(0.0, 0.34, tableDistance);
|
float tableReach = 1.0 - smoothstep(0.0, 0.34, tableDistance);
|
||||||
float sideReach = 1.0 - smoothstep(0.02, 0.62, tableDistance);
|
float sideReach = 1.0 - smoothstep(0.02, 0.62, tableDistance);
|
||||||
float grazingSide = 1.0 - pow(abs(worldNormal.y), 0.65);
|
float grazingSide = 1.0 - pow(abs(worldNormal.y), 0.65);
|
||||||
|
float upFacing = smoothstep(0.24, 0.88, worldNormal.y);
|
||||||
float underside = smoothstep(0.16, 0.88, -worldNormal.y);
|
float underside = smoothstep(0.16, 0.88, -worldNormal.y);
|
||||||
float sideFill = grazingSide * sideReach;
|
float sideFill = grazingSide * sideReach;
|
||||||
float tableFill = tableReach * (0.22 + underside * 0.24);
|
float tableFill = tableReach * (0.16 + underside * 0.22) * (1.0 - upFacing * 0.58);
|
||||||
float pageFill = smoothstep(0.02, 0.2, tableDistance) * (1.0 - smoothstep(0.24, 0.72, tableDistance));
|
float pageFill = smoothstep(0.02, 0.2, tableDistance) * (1.0 - smoothstep(0.24, 0.72, tableDistance));
|
||||||
vec3 tableWarmth = vec3(0.08, 0.045, 0.024) * tableFill;
|
vec3 tableWarmth = vec3(0.058, 0.039, 0.026) * tableFill;
|
||||||
vec3 roomWarmth = vec3(0.045, 0.033, 0.024) * sideFill;
|
vec3 roomWarmth = vec3(0.04, 0.034, 0.028) * sideFill;
|
||||||
vec3 pageWarmth = vec3(0.05, 0.041, 0.029) * pageFill * grazingSide;
|
vec3 pageWarmth = vec3(0.045, 0.041, 0.034) * pageFill * grazingSide * (1.0 - upFacing * 0.42);
|
||||||
vec3 indirect = tableWarmth + roomWarmth + pageWarmth;
|
vec3 indirect = tableWarmth + roomWarmth + pageWarmth;
|
||||||
return albedo * indirect * mix(1.0, 0.72, shadow);
|
return albedo * indirect * mix(1.0, 0.72, shadow);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user