Fix #115998: Cycles volume too dark when shadow ray visibility is off #126139

Merged
Weizhen Huang merged 3 commits from weizhen/blender:fix-volume-shadow-visibility into main 2024-08-19 15:52:57 +02:00
Member

when tracing shadow ray through a volume and no hit is registered, we
consider the whole ray segment inside the volume.

However, no hit registered could also happen when the volume is
invisible to shadow ray. We should explicitly check this case and skip
rendering the volume segment instead.

when tracing shadow ray through a volume and no hit is registered, we consider the whole ray segment inside the volume. However, no hit registered could also happen when the volume is invisible to shadow ray. We should explicitly check this case and skip rendering the volume segment instead.
Weizhen Huang added this to the Render & Cycles project 2024-08-09 15:36:36 +02:00
Author
Member

Note that the tests camera_in_volume_camera_and_volume and camera_in_volume_camera_only fail, because the volume in those scenes are invisible to shadows. With this fix, the volume does not occlude itself and becomes brighter.

Note that the tests `camera_in_volume_camera_and_volume` and `camera_in_volume_camera_only` fail, because the volume in those scenes are invisible to shadows. With this fix, the volume does not occlude itself and becomes brighter.
Weizhen Huang requested review from Sergey Sharybin 2024-08-09 16:01:36 +02:00
Weizhen Huang requested review from Lukas Stockner 2024-08-09 16:01:48 +02:00
Lukas Stockner approved these changes 2024-08-10 02:16:13 +02:00
Sergey Sharybin requested changes 2024-08-14 17:29:46 +02:00
Dismissed
Sergey Sharybin left a comment
Owner

Correct and consistent way of getting visibility for the current path is to use path_state_ray_visibility().

Correct and consistent way of getting visibility for the current path is to use `path_state_ray_visibility()`.
Author
Member

path_state_ray_visibility() requires ConstIntegratorState and state->path, but volume_shader_eval() uses ConstIntegratorGenericState and might require shadow_state->shadow_path, I can not call this function directly.

I could write a version of the function that is compatible with shadow paths, but what situation does this function resolve? It feels like an overkill, as the path_flag is just PATH_RAY_SHADOW for shadow paths.

volume_shader_eval<true>(kg, state, sd, PATH_RAY_SHADOW, volume_read_lambda_pass);

`path_state_ray_visibility()` requires `ConstIntegratorState` and `state->path`, but `volume_shader_eval()` uses `ConstIntegratorGenericState` and might require `shadow_state->shadow_path`, I can not call this function directly. I could write a version of the function that is compatible with shadow paths, but what situation does this function resolve? It feels like an overkill, as the `path_flag` is just `PATH_RAY_SHADOW` for shadow paths. https://projects.blender.org/blender/blender/src/commit/58aa349f689c1bf15118603e51a2c7b49869d88a/intern/cycles/kernel/integrator/shade_volume.h#L79

Ah, there is this difference indeed.
On a quick thought we can move integrate_intersect_shadow_visibility to path_state.h (with an updated name).

Ah, there is this difference indeed. On a quick thought we can move `integrate_intersect_shadow_visibility` to `path_state.h` (with an updated name).
Weizhen Huang force-pushed fix-volume-shadow-visibility from 79c1a7698e to a5b8165b59 2024-08-19 14:44:48 +02:00 Compare
Weizhen Huang added 1 commit 2024-08-19 14:46:31 +02:00
Sergey Sharybin approved these changes 2024-08-19 14:47:37 +02:00
Weizhen Huang added 1 commit 2024-08-19 14:58:58 +02:00
update test images
All checks were successful
buildbot/vexp-code-patch-lint Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-darwin-arm64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
0ba93fcba3
Author
Member

@blender-bot build

@blender-bot build
Weizhen Huang merged commit be0d2e19b5 into main 2024-08-19 15:52:57 +02:00
Weizhen Huang deleted branch fix-volume-shadow-visibility 2024-08-19 15:53:00 +02:00
Sign in to join this conversation.
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 Assignees
3 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#126139
No description provided.