Cycles: Rework component layering in Principled BSDF #110864
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#110864
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "LukasStockner/blender:layering-principled"
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?
Overall, this PR reworks the component layering in the Principled BSDF in order to ensure that energy is preserved and conserved.
This includes:
layer()
functionNote that this changes the look of the Principled BSDF noticeably in some cases, but that's needed, since the cases where it looks different are the ones that strongly violate energy conservation (mostly grazing reflections with strong Specular).
@blender-bot package
Package build started. Download here when ready.
I have not checked every line in detail, but the overall approach looks great to me.
Some images and timings would be nice.
@ -71,2 +71,4 @@
float3 weight_stack[16];
ccl_private const OSLClosure *closure_stack[16];
int layer_stack_level = -1;
float3 layer_albedo;
Typically better for the GPU compiler to initialize this.
Render time and look differences seem within an acceptable range.
In the regression tests,
render passes specular direct
seems wrong, there is a checker texture visible in that pass.@ -114,0 +141,4 @@
/* We just finished processing the top layers of a Layer closure, so adjust the weight to
* account for the layering. */
weight *= saturatef(1.0f - reduce_max(layer_albedo / weight));
/* TODO: Skip if weight zero */
Is this still intended to be resolved?
Yep, resolved now. I had tried to find a way to not repeat the stack popping code, but didn't come up with anything.
I've improved the color pass now by extending and improving the precomputed tables that are used to lookup the expected Fresnel effect depending on roughness, instead of just using the smooth surface approximation.
With this change, the checkerboard is completely gone when using the material in a "sphere in front of white background" setup.
However, in the test scene it's still slightly visible. This is expected - bounce rays at grazing angles are occluded by the back wall, while more vertical rays aren't. And since the Fresnel effect depends on angle, the effective mix between F0 (checkerboard) and F90 (white) changes, and so the precomputed value no longer fits perfectly.
In case you're wondering how this worked before the change (as I did): The material has Specular set to zero, and the old formulation of the Principled BSDF had a weird quirk where the Specular input affected the Fresnel curve that was used for metals. By setting it to zero, Fresnel was effectively disabled. If you increase Specular, you also get the checkerboard in old builds.
Lukas Stockner referenced this pull request2023-08-10 10:23:31 +02:00
Thanks, looks good to me now.
86100d921b
to6a3c2f62c5