Fix intersection distance offset in Cycles #107364

Merged
Sergey Sharybin merged 1 commits from Sergey/blender:cycles-denormals-offset into main 2023-04-26 11:36:43 +02:00

The intersection distance offset in Cycles could have returned
a denormal floating point value for the input values of 0 (and
for the denormal input value).

This could lead to a situation when ray is unable to be advanced
when it hits an edge between two triangles: the intersection will
keep bouncing between two adjacent triangles. This is because the
ray->tmin is compared inclusively, and 0 >= .

The solution is to return the smallest possible normalized floating
point value from the intersection_t_offset if the input is zero
or a denormal value (which is covered by the same t == 0 check).

This fix is hard to measure on the user level. The old code did
not cause any infinite traversal loop because of the way how the
integration is organized (some kernels offset ray.P, others check
for the number of bounces). It is possible that this fixes some
corner cases of noise: i.e. if some shadow rays falsefully were
considered occluded due to reached maximum number of bounces.

The actual problematic case was discovered during working on a
prototype which had an in-lined intersection loop with the ray
tmin offset.

The intersection distance offset in Cycles could have returned a denormal floating point value for the input values of 0 (and for the denormal input value). This could lead to a situation when ray is unable to be advanced when it hits an edge between two triangles: the intersection will keep bouncing between two adjacent triangles. This is because the ray->tmin is compared inclusively, and 0 >= <denormal zero>. The solution is to return the smallest possible normalized floating point value from the intersection_t_offset if the input is zero or a denormal value (which is covered by the same t == 0 check). This fix is hard to measure on the user level. The old code did not cause any infinite traversal loop because of the way how the integration is organized (some kernels offset ray.P, others check for the number of bounces). It is possible that this fixes some corner cases of noise: i.e. if some shadow rays falsefully were considered occluded due to reached maximum number of bounces. The actual problematic case was discovered during working on a prototype which had an in-lined intersection loop with the ray tmin offset.
Sergey Sharybin added the
Module
Render & Cycles
label 2023-04-26 11:03:11 +02:00
Sergey Sharybin added 1 commit 2023-04-26 11:03:18 +02:00
buildbot/vexp-code-patch-coordinator Build done. Details
2f9211ed3f
Fix intersection distance offset in Cycles
The intersection distance offset in Cycles could have returned
a denormal floating point value for the input values of 0 (and
for the denormal input value).

This could lead to a situation when ray is unable to be advanced
when it hits an edge between two triangles: the intersection will
keep bouncing between two adjacent triangles. This is because the
ray->tmin is compared inclusively, and 0 >= <denormal zero>.

The solution is to return the smallest possible normalized floating
point value from the intersection_t_offset if the input is zero
or a denormal value (which is covered by the same t == 0 check).

This fix is hard to measure on the user level. The old code did
not cause any infinite traversal loop because of the way how the
integration is organized (some kernels offset ray.P, others check
for the number of bounces). It is possible that this fixes some
corner cases of noise: i.e. if some shadow rays falsefully were
considered occluded due to reached maximum number of bounces.

The actual problematic case was discovered during working on a
prototype which had an in-lined intersection loop with the ray
tmin offset.
Sergey Sharybin added this to the Render & Cycles project 2023-04-26 11:03:25 +02:00
Author
Owner

@blender-bot build

@blender-bot build
Sergey Sharybin requested review from Brecht Van Lommel 2023-04-26 11:03:39 +02:00
Brecht Van Lommel approved these changes 2023-04-26 11:10:11 +02:00
Sergey Sharybin merged commit 02b5c04b2b into main 2023-04-26 11:36:43 +02:00
Sergey Sharybin deleted branch cycles-denormals-offset 2023-04-26 11:36:44 +02:00
Brecht Van Lommel removed this from the Render & Cycles project 2023-05-24 19:05:21 +02:00
Howard Trickey referenced this issue from a commit 2023-05-29 02:51:44 +02:00
Sign in to join this conversation.
No reviewers
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#107364
No description provided.