Cycles Light Tree: Add case for when an emitter is not selected #111292
No reviewers
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
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#111292
Loading…
Reference in New Issue
No description provided.
Delete Branch "Alaska/blender:gracefully-handle-111277-issue"
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?
Discovered during an investigation into #111277
in rare situations (E.G. When normals are NaN), an emitter
won't be selected as part of
light_tree_cluster_select_emitter()
and as a result of that, an
emitter_index
of-1
is passed tokernel_data_fetch(light_tree_emitters, emitter_index)
resulting inan "illegal address" error on some devices.
This commit should also be backported to Blender 3.6 if it is accepted.
Is this still needed after #111294 is merged?
I am expecting
light_tree_cluster_select_emitter()
to pick an emitter if there is one, unless all emitters in the cluster have zeroimportance[0]
. If any input is invalid it suggests that something else is wrong.You're right. An emitter should be selected under normal conditions. But under bad conditions (E.G. When the normals are NaN), an emitter won't be selected and this catch is useful as it stops an illegal address error on the GPU. (E.G. If #111294 wasn't applied, then having this catch would still allow people to render the scene shared in #111277 on a GPU, even though it has NaN normals).
Since #111294 has been merged into main (and is being back ported to 3.6), this pull request is no longer needed to fix any of the issues reported in #111277. But having this pull request merged could still be useful for situations in the future when the normals or some other value is NaN (due to something else being broken in Blender/Cycles) and a user is trying to render on the GPU, because this pull request will stop the Light Tree Sampling code from reaching a kernel_assert and reporting an "illegal address" error on GPUs in those scenes.
It comes down to how you want to handle things.
Or
From the perspective of a Blender user with no knowledge of programming, I would personally like this pull request to be accepted. It means I can keep rendering with the GPU even when something else is broken (especially if the broken thing only takes up a small part of the scene, such as a single face on a chair leg having NaN normals in a render of the exterior of a building).
As a casual developer, I can see both accepting and declining as valid options based on different criteria and preferences. I'll leave the decision up to you.
Extra note because I just remembered it.
It's possible a user could still create a NaN normal with something like a custom OSL script.
You are right, if the normal is wrong it's still visible as an artefact, this patch is just to cover illegal address error, so I think it's fine. Thanks!
Hi, turns out that the selected emitter can be -1 because all the
importance[1]
(min_importance
) are zero, which is allowed at the line you changed, so the tests failed.The problem is that
total_importance[0] == 0
failed to detect the case where all the entries are NaN, a proper fix would be to use!has_importance
instead (c076202e23
). I also moved theselected_emitter < 0
detection a bit earlier.min_importance
seems fine because there is afmaxf(..., 0.0f)
when computing it which is NaN-aware.Again, many thanks for spotting and investigating the issue!
Thanks for implementing a better fix.