Orthographic camera not connecting correctly to light tracing paths
When using the orthographic camera, radiometric differences can be observed between Path- and Light-Tracing. Attached is an example scene created with Blender 4.2.9. It features a matte plane as the floor, illuminated by five spot lights (chosen to make the illumination at separate positions more distinct.)
Both a perspective and orthographic camera are set up, and they are intentionally placed very close to the plane, observing it at an angle. Because LuxCore presently does not render light-tracing beams with only one bounce, a thin glass plate with near-one refractive index is placed below the spot lights. This setup effectively does nothing except provide the necessary additional bounce for light-tracing to be visible.
With path-tracing, all spots appear equal in brightness, as intended. The same is true with the perspective camera for both path- and light-tracing. However, light-tracing with the Ortho-camera shows a front-back gradient.
In the source code (showing BiDir for example purposes here but it is the same with LightCPU), the function camera->SampleLens is called very early in RenderFunc() to get the variable lensPoint that is used already in TraceLightPath():
https://github.com/LuxCoreRender/LuxCore/blob/54ee101247f51b12e666bcdb333e39138d78a41c/src/slg/engines/bidircpu/bidircputhread.cpp#L772
For the perspective camera in its current implementation, this is OK because the lens, with and without DOF simulation, is represented by a fixed shape in space regardless of the sample position in the final image.
However, for the orthographic camera, it is not. Without DOF simulation, each position on the image corresponds to a position in 3D-space with parallel rays emerging from this position (given by the dir variable of the camera class).
In this case, it exaplains the observed brightness problem:
SampleLensreturns the camera origin- Brightness scaling is made with the distance to this point
- With the ortho camera close to the object, the distance should be a variable as a function of the image position.
The correct method should hence be to trace a light path first, then check if a connection to the lens can be made, using a method appropriate to the camera type. This will become more important if new lens camera types are added (part of my plans).
List of needed changes (subject to change):
- [ ] Separate thos functions from
TraceLightPath()that requireslensPoint - [ ] Rewrite the
SampleLensfunction, or write a new separate function, that takes a ray(-intersected point) as one of its arguments - [ ] Call
SampleLensafterTraceLightPathin the rendering functions