LuxCore icon indicating copy to clipboard operation
LuxCore copied to clipboard

BiDir: Distance dependent brightness on certain light paths

Open CodeFHD opened this issue 5 months ago • 0 comments

Attached is a Blender test scene with a simple setup designed specifically to test some aspects of the BiDir engine:

  • Two square planes with Matte material, at 90° angle to each other with a bit of space in between
  • Two light sources: A Laser and a Spot with narrow angle. The light sources point at the center of the first plane
  • A camera, pointing at the center of the second plane (not actually critical where it points exactly)
  • Three thin Glass blocks: One in front of the light sources, one in front of the camera, one between the two planes.

bidir_distancefalloff_V3.zip

The purpose of the glass blocks is to force certain connections to be possible or not, as a direct connection can not be made through a specular material:

  • The one in front of the light source blocks Direct light sampling
  • The one in front of the camera blocks direct camera connection
  • The one between the planes blocks direct connection between the two diffuse surfaces. In this simple setup, effective allowing only pure path- or light-tracing

The setup works together with very low path depth settings: 1 for eye and light each by default. When activating a glass block, increase the path depth of either light or eye to 3 to allow specific paths.

From this setup, the following observations are made

  • In the default setup, moving either the laser light or the camera along its local z-axis (i.e. closer or further away) changes the rendered brightness of the image.
  • The above effect does not happen with the spot light, indicating a specific issue with the laser light
  • However, adding glass increases the brightness also for the spot light. Applies to light path depth >1, too.
  • When setting the light path depth to >=2, the camera seem to retain brightness.
  • The laser light falloff happens regardless of path depth settings
  • Glass in front of camera or laser fixes brightness falloff for that object (but not the other)
  • With glass between the planes and light depth >=4, the camera falloff is fixed
  • With glass between the planes, light depth = 1 and eye depth >=4, the second plane remains dark.
  • For those setups where the brightness depends on camera distance, the brightness also depends on the FoV size. Can be triggered either by changing the camera focal length, or setting a render subregion in the viewport.
  • When switching to orthographic camera, the 1-1 path depth case remains entirely black

Short summary list of issues to investigate and fix:

  • [ ] Laser light distance falloff
  • [ ] Brightness increase through glass for spot light
  • [ ] Camera distance falloff
  • [ ] Why Eye-path route stays dark with Center Glass
  • [ ] Brightness scaling with FoV
  • [ ] Black image with Orthographic camera

Initial ideas for investigation

  • MIS factors seem to affect the behavior https://github.com/LuxCoreRender/LuxCore/blob/cb7e64dc1c14b028f015eb03026f4b74d12be08a/src/slg/engines/bidircpu/bidircputhread.cpp#L887
  • Handling of cases around variable sampleResult.firstPathVertex
  • f-tan-theta processing of perspective camera involving FoV and screenWindow variables https://github.com/LuxCoreRender/LuxCore/blob/cb7e64dc1c14b028f015eb03026f4b74d12be08a/src/slg/cameras/perspective.cpp#L80

CodeFHD avatar Jul 18 '25 09:07 CodeFHD