blender/intern
Weizhen Huang 9fe87646d5 Cycles: replace spot light disk sampling with sphere sampling
The spotlight is now treated as a sphere instead of a view-aligned disk.
The implementation remains almost identical to that of a point light,
except for the spotlight attenuation and spot blend. There is no
attenuation inside the sphere. Ref #108505

Other changes include:
## Sampling
Instead of sampling the disk area, the new implementation samples either
the cone of the visible portion on the sphere or the spread cone, based
on which cone has a smaller solid angle. This reduces noise when the
spotlight has a large radius and a small spread angle.
| Before | After  |
|   --   |   --   |
|![spot_size_before.png](/attachments/04ea864a-6bf9-40fe-b11b-61c838ae70cf)|![spot_size_after.png](/attachments/7077eaf9-b7a8-41b1-a8b6-aabf1eadb4f4)
## Texture
Spot light can now project texture using UV coordinates.
<video src="/attachments/6db989d2-7a3c-4b41-9340-f5690d48c4fb"
title="spot_light_texture.mp4" controls></video>
## Normalization
Previously, the normalization factor for the spotlight was \(\pi r^2\),
the area of a disk. This factor has been adjusted to \(4\pi r^2\) to
account for the surface area of a sphere. This change also affects point
light since they share the same kernel type.
## Versioning
Some pipeline uses the `Normal` socket of the Texture Coordinate node for
projection, because `ls->Ng` was set to the incoming direction at the
current shading point. Now that `ls->Ng` corresponds to the normal
direction of a point on the sphere (except when the radius is zero),
we replace these nodes with a combination of the Geometry shader node
and the Vector Transform node, which gives the same result as before.
![versioning.png](/attachments/5bbfcacc-26c5-4f7f-8360-c42bcd851f68)
Example file see https://archive.blender.org/developer/T93676

Pull Request: https://projects.blender.org/blender/blender/pulls/109329
2023-07-07 17:15:18 +02:00
..
atomic Cleanup: Cmake: use alias target for bf_intern_atomic 2023-07-07 15:37:02 +02:00
audaspace License headers: use SPDX-FileCopyrightText in all sources 2023-06-15 13:35:34 +10:00
clog License headers: use SPDX-FileCopyrightText in all sources 2023-06-15 13:35:34 +10:00
cycles Cycles: replace spot light disk sampling with sphere sampling 2023-07-07 17:15:18 +02:00
dualcon License headers: use SPDX-FileCopyrightText in all sources 2023-06-15 13:35:34 +10:00
eigen License headers: use SPDX-FileCopyrightText in all sources 2023-06-15 13:35:34 +10:00
ffmpeg License headers: use SPDX-FileCopyrightText in all sources 2023-06-15 13:35:34 +10:00
ghost Cleanup: declare const variables 2023-07-07 16:00:50 +10:00
guardedalloc Cleanup: Cmake: use alias target for bf_intern_atomic 2023-07-07 15:37:02 +02:00
iksolver License headers: use SPDX-FileCopyrightText in all sources 2023-06-15 13:35:34 +10:00
itasc Update Eigen to version 3.4.0 2023-07-03 15:09:20 +02:00
libc_compat License headers: use SPDX-FileCopyrightText in all sources 2023-06-15 13:35:34 +10:00
libmv License headers: use SPDX-FileCopyrightText in all sources 2023-06-15 13:35:34 +10:00
locale License headers: use SPDX-FileCopyrightText in all sources 2023-06-15 13:35:34 +10:00
mantaflow Cleanup: remove_cc_flag use in CMake 2023-07-05 13:27:21 +10:00
memutil License headers: use SPDX-FileCopyrightText in all sources 2023-06-15 13:35:34 +10:00
mikktspace Cleanup: Make format 2023-06-15 08:25:49 +02:00
opencolorio Cleanup: simplify struct declarations in C++ 2023-07-02 19:54:26 +10:00
opensubdiv License headers: use SPDX-FileCopyrightText in intern/opensubdiv 2023-06-15 16:47:51 +10:00
openvdb License headers: use SPDX-FileCopyrightText in all sources 2023-06-15 13:35:34 +10:00
quadriflow License headers: use SPDX-FileCopyrightText in all sources 2023-06-15 13:35:34 +10:00
renderdoc_dynload License headers: use SPDX-FileCopyrightText in all sources 2023-06-15 13:35:34 +10:00
rigidbody License headers: use SPDX-FileCopyrightText in all sources 2023-06-15 13:35:34 +10:00
sky License headers: use SPDX-FileCopyrightText in all sources 2023-06-15 13:35:34 +10:00
utfconv License headers: use SPDX-FileCopyrightText in all sources 2023-06-15 13:35:34 +10:00
wayland_dynload License headers: use SPDX-FileCopyrightText in all sources 2023-06-15 13:35:34 +10:00
CMakeLists.txt License headers: use SPDX-FileCopyrightText for CMake files 2023-06-14 23:36:23 +10:00