LuxCore icon indicating copy to clipboard operation
LuxCore copied to clipboard

[Bug Report] BiDir and PathLightTracing Shadows Color have different effects

Open FarbigeWelt opened this issue 6 months ago • 6 comments

Please describe the differences between the expected and observed results: Caustics missing in BiDir if Material Shadow is White.

Steps to reproduce: Change Shadow Color in File attached.

Please provide a simple test scene as a .blend-file:

Glasses, 4.2.11.blend.zip

Screenshots or rendered images:

Image Image Image Image

Error message from Blender console: none

Operating System: Sequoia 15.5 Blender version: 4.2.11, LTS BlendLuxCore version: 2.10.0 Pyluxcore version: 2.10.0 CPU and GPU model: M1, ARM

FarbigeWelt avatar Jun 18 '25 13:06 FarbigeWelt

I can reproduce the effect shown. Intuitively I would also expect BiDir to show the caustics. I note that the caustics disappear immediately once shadow color is not, so I assume it is an issue with some flag such as an if (!shadowTransparency.Black()) evaluation.

I will move the Issue to LuxCore because this is a core effect.

CodeFHD avatar Jun 19 '25 11:06 CodeFHD

As I suspected, it seems to be this block here: https://github.com/LuxCoreRender/LuxCore/blob/54ee101247f51b12e666bcdb333e39138d78a41c/src/slg/engines/bidircpu/bidircputhread.cpp#L599

See the associated description.

Removing the condition produces equal renderings for the example scene (within noise limits).

  • [x] Before I permanently remove it, should consider possible side effects to other scenes.

CodeFHD avatar Jun 19 '25 11:06 CodeFHD

The condition was added explicitly because of Issue https://github.com/LuxCoreRender/LuxCore/issues/576, discussed in detail on the forums here: https://forums.luxcorerender.org/viewtopic.php?f=4&t=4219

The scene presented there is a bit different from the one here: Flat window glass vs. a complex structure creating strong caustic shapes. In the latter case, the shadow-color usage doesn't produce a visibly displeasing result, but in the window case it does, as the two paths add up to a different total intensity.

The whole shadow color mechanism is of course unphysical, so its not so obvious what to do. Best that comes to mind right now is an override condition for the above conditional check. As long as that doesn't overcomplicate things further. Ultimately, the physically correct rendering must not be compromised and performance not additionally suffer.

There also is the difference between BiDir and Path+Light, I can check if it is possible to implement the same condition for light tracing.

Open ToDo items:

  • [x] Check if the same condition can be implemented for Path + Light tracing
  • [x] Check if a simple override can be created
  • [ ] ~~Consider the radiometry, if the light path samples and the shadow ray samples can be added in such a way to not offset the total in case of the window-scene~~

Edit: Notes to self about parked commits in branches: LuxCore: bugfix_OrthoLightTrace BlendLuxCore: feature_shadowoverride

CodeFHD avatar Jun 19 '25 20:06 CodeFHD

Interesting topic 🙂 For windows there is the choice to enable architectural Glass.

FarbigeWelt avatar Jun 19 '25 22:06 FarbigeWelt

I have adapted light tracing to match the behavior of BiDir:

  • If shadow color is not Black, then light tracing rays will be blocked by default
  • Additionally, I will add an override condition (exposed in BlendLuxCore) that allows both paths for artistic effects.

I will open a pull request into the for_v2.11 branch to include this.

Closing this Issue as completed.

CodeFHD avatar Oct 10 '25 20:10 CodeFHD

Reopening because I found a remaining bug:

  • [ ] When GPU backend is OCL (not CUDA), then the connection is still made. Looks like the actual setting of shadow color is ignored after some point. When it is black, light tracing still appears leading to wrong brightness, as per the original issue. When the shadow color is set to anything else, it is treated like full white shadow color. Doesn't accept a color hue either,

CodeFHD avatar Oct 13 '25 21:10 CodeFHD