File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -481,10 +481,10 @@ export class PhysicalPathTracingMaterial extends MaterialBase {
481481
482482 if ( ! hit ) {
483483
484- if ( i == 0 || transmissiveRay ) {
484+ if ( i == 0 || transmissiveRay || i == 1 && ! isShadowRay ) {
485485
486486 gl_FragColor.rgb += sampleBackground( environmentRotation * rayDirection ) * throughputColor;
487- gl_FragColor.a = backgroundAlpha;
487+ gl_FragColor.a = i == 1 && ! isShadowRay ? 1.0 : backgroundAlpha;
488488
489489 } else {
490490
@@ -877,6 +877,14 @@ export class PhysicalPathTracingMaterial extends MaterialBase {
877877 float envPdf = randomEnvMapSample( envMapInfo, envColor, envDirection );
878878 envDirection = invEnvironmentRotation * envDirection;
879879
880+ // TODO: This shadow ray needs to be determined by whether the _new_ evn-sampled direction is a shadow ray
881+ // not the last randomly sampled ray direction
882+ if ( i <= 1 && ! isShadowRay ) {
883+
884+ envColor = sampleBackground( envDirection );
885+
886+ }
887+
880888 // this env sampling is not set up for transmissive sampling and yields overly bright
881889 // results so we ignore the sample in this case.
882890 // TODO: this should be improved but how? The env samples could traverse a few layers?
You can’t perform that action at this time.
0 commit comments