Light Linking: Select one of dedicated lights #107739

Merged
Sergey Sharybin merged 3 commits from Sergey/blender:cycles-light-linking-multiple-light into cycles-light-linking 2023-05-16 16:24:34 +02:00

Before this change the shadow ray for shadow linking was picking the
closest light. Now a random light on the ray is chosen.

This is more noisy than integrating all lights in the direction of the
main path, but this is the only way to properly support complex
scenarios where there are multiple blockers between the shading point
and the light sources, with different linked settings.

Another unfortunate aspect of this change is increased state size.
This is because the light sample needs to be scaled, so some extra
information is needed. From the intersection kernel it is not yet
possible to write to the shadow path state as this intersection kernel
is marked as not generating shadow rays for the performance reasons.

Perhaps proper solution would be to run profiler to see if the current
dedicated light intersection + shading kernel split actually gives
speedup (by allowing the shadow and main path to run in parallel as
much as possible) or if the speedup is neglectable and it is better to
save memory of the state.

Ref #104972

Before this change the shadow ray for shadow linking was picking the closest light. Now a random light on the ray is chosen. This is more noisy than integrating all lights in the direction of the main path, but this is the only way to properly support complex scenarios where there are multiple blockers between the shading point and the light sources, with different linked settings. Another unfortunate aspect of this change is increased state size. This is because the light sample needs to be scaled, so some extra information is needed. From the intersection kernel it is not yet possible to write to the shadow path state as this intersection kernel is marked as not generating shadow rays for the performance reasons. Perhaps proper solution would be to run profiler to see if the current dedicated light intersection + shading kernel split actually gives speedup (by allowing the shadow and main path to run in parallel as much as possible) or if the speedup is neglectable and it is better to save memory of the state. Ref #104972
Sergey Sharybin added the
Module
Render & Cycles
label 2023-05-08 14:54:26 +02:00
Sergey Sharybin added 1 commit 2023-05-08 14:54:34 +02:00
b5ca99a10c Shadow linking: Select one of dedicated lights
Before this change the shadow ray for shadow linking was picking the
closest light. Now a random light on the ray is chosen.

This is more noisy than integrating all lights in the direction of the
main path, but this is the only way to properly support complex
scenarios where there are multiple blockers between the shading point
and the light sources, with different linked settings.

Another unfortunate aspect of this change is increased state size.
This is because the light sample needs to be scaled, so some extra
information is needed. From the intersection kernel it is not yet
possible to write to the shadow path state as this intersection kernel
is marked as not generating shadow rays for the performance reasons.

Perhaps proper solution would be to run profiler to see if the current
dedicated light intersection + shading kernel split actually gives
speedup (by allowing the shadow and main path to run in parallel as
much as possible) or if the speedup is neglectable and it is better to
save memory of the state.

Ref #104972
Sergey Sharybin added this to the Render & Cycles project 2023-05-08 14:55:00 +02:00
Sergey Sharybin requested review from Brecht Van Lommel 2023-05-08 14:55:05 +02:00
Sergey Sharybin requested review from Weizhen Huang 2023-05-08 14:55:20 +02:00
Sergey Sharybin reviewed 2023-05-12 11:02:58 +02:00
@ -336,0 +350,4 @@
* feature check. */
kernel_assert(kernel_data.kernel_features & KERNEL_FEATURE_SHADOW_LINKING);
if ((isect->prim != PRIM_NONE) && (lcg_step_float(lcg_state) < 1.0f / num_hits)) {
Author
Owner

I think this should actually be lcg_step_float(lcg_state) > 1.0f / num_hits

Edit: Sorry for the noise, was looking into the code while being a bit distracted by other tasks. it is actually probably correct, but need to review it with a bit more focused mind.

I think this should actually be `lcg_step_float(lcg_state) > 1.0f / num_hits` Edit: Sorry for the noise, was looking into the code while being a bit distracted by other tasks. it is actually probably correct, but need to review it with a bit more focused mind.
Sergey Sharybin changed title from Shadow linking: Select one of dedicated lights to Light Linking: Select one of dedicated lights 2023-05-12 19:53:18 +02:00
Brecht Van Lommel approved these changes 2023-05-16 15:51:13 +02:00
@ -336,0 +345,4 @@
++num_hits;
#ifdef __SHADOW_LINKING__
if constexpr (!is_main_path) {

CUDA 10 does not support C++17, so can't use if constexpr.

Leaving it out should give the same result I think.

CUDA 10 does not support C++17, so can't use `if constexpr`. Leaving it out should give the same result I think.
Sergey Sharybin added 2 commits 2023-05-16 16:14:48 +02:00
Sergey Sharybin merged commit 689062e067 into cycles-light-linking 2023-05-16 16:24:34 +02:00
Sergey Sharybin deleted branch cycles-light-linking-multiple-light 2023-05-16 16:24:35 +02:00
Brecht Van Lommel removed this from the Render & Cycles project 2023-05-24 19:05:21 +02:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#107739
No description provided.