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 {
481
481
482
482
if ( ! hit ) {
483
483
484
- if ( i == 0 || transmissiveRay ) {
484
+ if ( i == 0 || transmissiveRay || i == 1 && ! isShadowRay ) {
485
485
486
486
gl_FragColor.rgb += sampleBackground( environmentRotation * rayDirection ) * throughputColor;
487
- gl_FragColor.a = backgroundAlpha;
487
+ gl_FragColor.a = i == 1 && ! isShadowRay ? 1.0 : backgroundAlpha;
488
488
489
489
} else {
490
490
@@ -877,6 +877,14 @@ export class PhysicalPathTracingMaterial extends MaterialBase {
877
877
float envPdf = randomEnvMapSample( envMapInfo, envColor, envDirection );
878
878
envDirection = invEnvironmentRotation * envDirection;
879
879
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
+
880
888
// this env sampling is not set up for transmissive sampling and yields overly bright
881
889
// results so we ignore the sample in this case.
882
890
// 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