Fix: Cycles spot light spread sampling not considering non-uniform scaling #119661

Merged
Weizhen Huang merged 2 commits from weizhen/blender:fix-spot-light-non-uniform into main 2024-03-19 18:55:44 +01:00

2 Commits

Author SHA1 Message Date
Weizhen Huang 39b62f53bc Fix: Cycles spot light spread sampling not considering non-uniform scaling
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
For spherical spot light, when the shading point is close to the light
source, we switch to sampling the light spread instead of the visible
cone from the shading point. This has the benefit of less noise when the
spread is small.
However, the light spread sampling was not considering non-uniform
object scaling, where the actual spread might be different.
This patch switches sampling method only when the smallest enclosing
spread cone is smaller than the visible cone from the shading point.

An alternative method would be to compute the actual solid angle of the
scaled cone, and sample from the scaled cone. However, that involves
ray transformation and modifying the sampling pdf and angle. Since
non-uniform scaling is rather a niche case, it's probably not worth the
computation effort.
2024-03-19 14:55:33 +01:00
Weizhen Huang 5cedf9088d Cleanup: Cycles: remove unnecessary storage of the spot light axes 2024-03-19 14:55:18 +01:00