Fix #125595: Cycles artifacts in overlapping volumes with different phase functions #125676
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
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
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#125676
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "weizhen/blender:fix-overlapping-volume-with-different-phases"
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?
A phase function is normalized over the sphere, it is therefore
incorrect to sum two phase functions together when evaluating for NEE.
It should be a weighted sum with normalized weights, which, according to
volume_shader_phase_pick()
, issample_weight / sum_sample_weight
.Also corrects an error in
volume_shader_phase_pick()
.Each location in an overlapping region is composed of
x_1\%
of volume 1 andx_2\%
of volume 2, so the phase function at that point should bex_1\%p_1+x_2\%p_2
instead ofp_1 + p_2
.The only thing I am not sure is if
x\%
corresponds tosample_weight / sum_sample_weight
, because sample weight includes the color besides density. The proposed implementation at least makes NEE and forward path consistent, I believe we can check the "ground truth" behaviour another time, since we have plans to evaluate overlapping volumes separately anyway.The second commit is a refactor and can be reviewly separately. I will not squash the commits.
@blender-bot build
It seems fine.
I don't have insights on the
x\%
at this time, but as long as NEE and forward paths are consistent, we should be good for now.For the bug fixes we put the
Fix #<number>
in the commit title, making it more clear when looking at one-liner git logs. See https://developer.blender.org/docs/handbook/guidelines/commit_messages/#bug-fixesI usually add # in the commit title, but this commit title is too long for that and I could not think of a good shorter title.
Fix: Cycles rendering overlapping volumes with different phase functions incorrectlyto Fix #125595: Cycles artifacts in overlapping volumes with different phase functions59b508985f
tocd81691098
Weizhen Huang referenced this pull request2024-08-02 12:26:06 +02:00
@ -177,3 +179,1 @@
ccl_private const ShaderVolumeClosure *svc = &phases->closure[sampled];
sum += svc->sample_weight;
}
for (int i = 1; i < phases->num_closure; i++) {
Is there a reason we do sampling here like this instead of the usual
I feel like repeatedly rescaling the random number might lead to numerical issues, but I'm not sure so we could also just keep it for now.
The original code is doing the stuff as the code block you pasted, my first commit didn't change that, if you think that's fine I'll push that first.
Although I didn't measure the performance, reservoir sampling is theoretically faster, and it only rescales for at most the amount of intersection - 1. I don't think people use lots of intersections with different phases, otherwise we would have long ago bug reports about this. Besides, light tree doesn't have problem with rescaling the random number yet.
Fair enough, we can keep it for now. I had just never seen this style before.