Fix #103977: Cycles handling ray visibility inconsistent for forward and nee #107747
Open
Sebastian Herholz
wants to merge 6 commits from
When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
sherholz/blender:light-visibility-fix
into main
pull from: sherholz/blender:light-visibility-fix
merge into: blender:main
blender:main
blender:asset-browser-frontend-split
blender:blender-v3.3-release
blender:blender-v3.6-release
blender:universal-scene-description
blender:temp-sculpt-dyntopo
blender:brush-assets-project
blender:asset-shelf
blender:anim/armature-drawing-refactor-3
blender:temp-sculpt-dyntopo-hive-alloc
blender:tmp-usd-python-mtl
blender:tmp-usd-3.6
blender:blender-v3.5-release
blender:blender-projects-basics
blender:blender-v2.93-release
blender:temp-sculpt-attr-api
blender:realtime-clock
blender:sculpt-dev
blender:gpencil-next
blender:bevelv2
blender:microfacet_hair
blender:xr-dev
blender:principled-v2
When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Reviewers
Request review
No reviewers
Labels
Clear labels
This issue affects/is about backward or forward compatibility
Issues relating to security: https://wiki.blender.org/wiki/Process/Vulnerability_Reports
Apply labels
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
This issue affects/is about backward or forward compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
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
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
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
Issues relating to security: https://wiki.blender.org/wiki/Process/Vulnerability_Reports
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 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 & 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
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
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
Milestone
Set milestone
Clear milestone
No items
No Milestone
Projects
Set Project
Clear projects
No project
Assignees
Assign users
Clear assignees
No Assignees
6 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#107747
Reference in New Issue
There is no content yet.
Delete Branch "sherholz/blender:light-visibility-fix"
Deleting a branch is permanent. Although the deleted branch may exist for a short time before cleaning up, in most cases it CANNOT be undone. Continue?
Reopening the PR to fix the ray visibility inconsistency on light sources (#103977)
@brecht to reduce the additional per state memory consumption I was thinking of using RGBE compressed values.
http://www.graphics.cornell.edu/online/formats/rgbe/
What do you think?
Added SpectrumRGBE support, that stores a float3 into an int32 using 8bit RGB and a shared exponent.
No visual difference between using float3.
Fix T103977: Cycles handling ray visibility inconsistent for forward and neeto Fix #103977: Cycles handling ray visibility inconsistent for forward and nee@blender-bot package
Package build started. Download here when ready.
Did not deeply check on the algorithm/math yet, was trying to get the patch to testable state. There is some technical feedback so far.
Would need to have a closer look to see if we can probably lower the memory impact further.
Please also check the output of the buildbot: https://builder.blender.org/admin/#/builders/136/builds/1170
@ -0,0 +11,4 @@
ccl_device_inline SpectrumRGBE SpectrumToSpectrumRGBE(const Spectrum &spec)
{
SpectrumRGBE specRGBE;
char *specRGBEPtr = (char *)&specRGBE;
Can we define
SpectrumRGBE
asand avoid such memory casts, and casts between signed/unsigned
char
?This also seems to a bit arbitrary place to have such utility functions. Within the current file structure it seems
types_spectrum.h
is the most fitted place for it.sure no problem.
@Sergey done.
I am not sure if you can compress the data even more.
The positive side on this approach is that we can realize handling scalar ray types light interactions straight forward instead of only binary ones.
Another thing worth considering is moving the conversion methods to a different place (not into
visibility.h
).Do you have a good suggestion for it?
The immediate thought is
kernel/util/color.h
. There is alreadyspectrum_to_rgb
so intuitively feels likespectrum_to_spectrum_rgbe
could fit there as well.@blender-bot package
Package build started. Download here when ready.
@blender-bot package
Package build started. Download here when ready.
@blender-bot package
Package build started. Download here when ready.
@blender-bot package
Package build started. Download here when ready.
If this can solve the problem without serious downsides it will be great, but I think this needs to be checked more closely.
@brecht I will do some deeper evaluation and report the results later.
On my first tests on my RTX2070 I did not measure any performance difference.
I think if there is one, it will only happen on the GPU, and then it will be mainly caused by the bigger state.
Additional computing is only performed when I light source with visibility flags it hit, and in all the standard scenes, this feature is not used so often (e.g., barbershop scene (2 light sources) and Dark Interior (also 2 light sources)).
About RGBE, I am quite surprised that it works so well. In my test scene, I couldn't even see a difference in the EXR images when I made a diff (float3 vs RGBE) and pulled up the exposure. I will post the images later.
I think one reason why the compression works well, in this case, is that we are not working with really high dynamic range values, mainly BSDF_evals/pdfs.
These values only get large if the BSDF has a large value and the PDF is suuuper low.
I will try to set up a scene like the one you described.
@ -246,3 +246,3 @@
if (bsdf_pdf != 0.0f) {
bsdf_eval_accum(result_eval, sc->type, eval * sc->weight);
if (!_surface_shader_exclude(sc->type, light_shader_flags)) {
I wonder, shouldn't the function
surface_shader_bsdf_eval_pdfs()
just below it follow the same logic and be corrected too?@Sebastian-Herholz Any progress with the benchmarking and testing? Apart from performance there are two extra topics which I am wondering here:
Reviewers