Branched path unification #52725
Labels
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
14 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#52725
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I'd like to unify path and branched path tracing, first to deduplicate code and improve performance on GPUs, and then to try to combine the best sampling strategies from both. The big difference between the two is that branched path tracing samples all lights and closures, instead of just 1.
The branched path code is not particularly efficient on either CUDA or OpenCL, and I think the best way to solve that is to use the same mechanism as we use for SSS in the path tracing megakernel, storing the state for each branch and restarting the path from that. This should also significantly simplify and deduplicate code.
The immediate problem is stack memory usage. Users can specify and arbitrarily high number of diffuse/glossy/... samples, and each sample would require extra state to be stored. We can address that in two ways:
Assuming we use 16 x 200 bytes = 3.2kb, that's the same memory usage as the current SSS stack, and not that big compared to the total 21k of the CUDA path tracing kernel. In fact I'm guessing the optimal branch factor for most scenes with GI is much lower than 16, but this needs to be tested with equal time renders of production scenes, which I plan to do in this task.
Changed status to: 'Open'
Added subscriber: @brecht
Added subscriber: @SteffenD
Added subscriber: @SterlingRoth
Added subscriber: @lsscpp
Here's a few initial equal time renders from benchmark scenes, rendered on the CPU. The branched path settings have been tweaked to try to reduce noise, but there may exist better settings. The difficulty of tuning the settings is part of the reason we want to unify this though.
For bmw27, branched path has significantly less noise for the windows, but more noise for the headlights. Fishy cat seems to have some bug where we get different result, but ignoring that, it's difficult to determine a clear winner. The extra samples from path tracing help clean up the specular on the nose for example, but the grass DoF noise isn't reduced. For pabellon the clear winner seems to be path.
The noise on the windows in the bmw27 scene happens because the reflection closure has a very small weight and so very low probability of being sampled, but the area light it reflects is still quite bright due to low roughness. To mitigate this problem we can use defensive sampling (last column), giving the reflection closure a minimum weight. In branched path tracing both the reflection and refraction are always sampled so this problem does not happen (if samples are set to 1, then it's like assigning probability 0.5 to both closures for camera rays).
We can't do defensive sampling through all indirect bounces, since the closure weights compound and the sample weights start deviating too much from the actual contribution. Still there are cases where it makes sense to do for non-camera rays, like looking through a perfect mirror. So the test above is using a heuristic to stop defensive sampling at some point, but this needs further tweaking.
Note this will increase noise in some scenes, it is a matter of finding a balance. I expect this will be helpful also for the principled BSDF with diffuse + specular + coat layers.
Added subscriber: @candreacchio
Added subscriber: @intrah
Added subscriber: @cardboard-2
Added subscriber: @mib2berlin
Added subscriber: @RainerTrummer
Added subscriber: @JasonClarke
Added subscriber: @Stefan_Werner
Here's a comparison using a shot from Agent, where branched path is the clear winner:
This scene has about 20 lights, and it seems to be branched path all light sampling that gives the main improvement. Since path tracing picks one light at random and every shading point is only significantly influenced by a subset of all lights, a lot of samples are wasted. So adding support for all light sampling to path tracing could help (and it's rather simple to implement). Or perhaps better a user specified N light samples. A light tree for importance sampling of many lights would also help (example ).
Branching for SSS is likely helpful as well as those areas are quite noisy. The problem there that we can't share direct lighting computations between BSDFs and BSSRDFs (much), so those pixels really need more samples and branching does that. Adaptive sampling could do this as well.
Added subscriber: @frameshift
Added subscriber: @BeckersC
Added subscriber: @Alaska
Changed status from 'Confirmed' to: 'Archived'
Branched path was removed in 3.0.