blender/intern/cycles
Lukas Stockner 213204c229 Cycles: Change sun lamp to have uniform intensity at high angles
This fixes the issue described in https://projects.blender.org/blender/blender/issues/108957.

Instead of modeling distant lights like a disk light at infinity, it models them as cones. This way, the radiance is constant across the entire range of directions that it covers.

For smaller angles, the difference is very subtle, but for very large angles it becomes obvious (here's the file from #108957, the angle is 179°):
| Old | New |
| - | - |
| ![old_bigsun.png](/attachments/4ef8e7a7-1a29-4bdf-a74c-3cfa103bf1e7) | ![new_bigsun.png](/attachments/d53c7749-2672-40b6-9048-ccf2fffceeb7) |

One notable detail is the sampling method: Using `sample_uniform_cone` can increase noise, since the sampling method no longer preserves the stratification of the samples. This is visible in the "light tree multi distant" test scene.
Turns out we can do better, and after a bit of testing I found a way to adapt the concentric Shirley mapping to uniform cone sampling. I hope the comment explains the logic behind it reasonably well.

Here's the result, note that even the noise distribution is the same when using the new sampling:
| Method | Old | New, basic sampling | New, concentric sampling |
| - | - |- | - |
| Image | ![old.png](/attachments/b3258a70-f015-4065-a774-193974cce439) | ![new_basic.png](/attachments/a9008576-0af6-4152-a687-c800fd958bbd) | ![new_concentric.png](/attachments/769b6c43-34bc-434e-a4fd-ce69addd1ba5) |
| Render time (at higher spp)| 9.03sec | 8.79sec | 8.96sec |

I'm not sure if I got the `light->normalized` handling right, since I don't really know what the expectation from Hydra is here.

Co-authored-by: Weizhen Huang <weizhen@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/108996
2023-07-07 17:20:19 +02:00
..
app License headers: use SPDX-FileCopyrightText in intern/cycles 2023-06-14 16:53:23 +10:00
blender Cleanup: code-comments 2023-07-07 15:11:19 +10:00
bvh Cycles: Embree: Resolve padding-related issue during buffer creations 2023-07-04 13:41:45 +02:00
cmake Merge branch 'blender-v3.6-release' 2023-06-14 18:21:09 +02:00
device Cleanup: Mark unused function arguments as such 2023-07-05 12:02:06 +02:00
doc License headers: use SPDX-FileCopyrightText in intern/cycles 2023-06-14 16:53:23 +10:00
graph License headers: use SPDX-FileCopyrightText in intern/cycles 2023-06-14 16:53:23 +10:00
hydra License headers: use SPDX-FileCopyrightText in intern/cycles 2023-06-14 16:53:23 +10:00
integrator License headers: use SPDX-FileCopyrightText in intern/cycles 2023-06-14 16:53:23 +10:00
kernel Cycles: Change sun lamp to have uniform intensity at high angles 2023-07-07 17:20:19 +02:00
scene Cycles: Change sun lamp to have uniform intensity at high angles 2023-07-07 17:20:19 +02:00
session License headers: use SPDX-FileCopyrightText in intern/cycles 2023-06-14 16:53:23 +10:00
subd License headers: use SPDX-FileCopyrightText in intern/cycles 2023-06-14 16:53:23 +10:00
test CMake: plumbing for modern CMake usage 2023-06-27 20:57:50 +02:00
util Cycles: Change sun lamp to have uniform intensity at high angles 2023-07-07 17:20:19 +02:00
CMakeLists.txt License headers: use SPDX-FileCopyrightText in intern/cycles 2023-06-14 16:53:23 +10:00