Several inconsistencies in Cycles BSDF #111941

Open
opened 2023-09-04 23:24:42 +02:00 by Weizhen Huang · 0 comments
Member
  1. Defensive sampling
    in bsdf_microfacet_sample() it is checked against (path_flag & PATH_RAY_CAMERA), but bsdf_microfacet_eval() is always using the pdf of defensive sampling, except when fresnel is one. Also, it's worth verifying if defensive sampling is still practical. (bf82f9442c)
  2. sd->Ng or sd->N
    both bsdf_microfacet_sample() and bsdf_microfacet_eval() have an argument Ng, but we pass sd->Ng to the former and sd->N to the later, so checks like dot(Ng, wo) > 0 don't give the same result. (063a9e8964)
    bsdf_is_transmission(sc, wo) checks using smoothed normal sc->N, but in BSDF sampling and evaluation (sd->type & PRIMITIVE_CURVE) ? sc->N : sd->Ng is used.
  3. ClosureLabel
    • In surface_shader_bsdf_sample_closure(), we accumulate the result of all the closures, but label is solely determined by the closure chosen by bsdf_sample(). Maybe this is fine but the logic seems weird.
    • For CLOSURE_BSDF_HAIR_CHIANG_ID, the label is determined by the wo direction in bsdf_label(), but determined by the interaction number in bsdf_sample(). Maybe label should always be LABEL_REFLECT because hair closure handles internal absorption itself.
  4. Anisotropy
    Behaves differently for Glossy and Principled BSDF. Principled BSDF uses remapping from Disney and only allow positive anisotropy. Glossy BSDF does not use remapping, allow both negative and positive anisotropy, and treat the distribution as isotropic if anisotropy < 1e-4f. The last piece of logic is repeated in svm, osl and shader_nodes.cpp
  5. eta and label required by path guiding
    is inconsistent in BSDF sampling and evaluation.
1. Defensive sampling ~~in `bsdf_microfacet_sample()` it is checked against `(path_flag & PATH_RAY_CAMERA)`, but `bsdf_microfacet_eval()` is always using the pdf of defensive sampling, except when fresnel is one. Also, it's worth verifying if defensive sampling is still practical.~~ (bf82f9442c) 2. `sd->Ng` or `sd->N` ~~both `bsdf_microfacet_sample()` and `bsdf_microfacet_eval()` have an argument `Ng`, but we pass `sd->Ng` to the former and `sd->N` to the later, so checks like `dot(Ng, wo) > 0` don't give the same result.~~ (063a9e8964) `bsdf_is_transmission(sc, wo)` checks using smoothed normal `sc->N`, but in BSDF sampling and evaluation `(sd->type & PRIMITIVE_CURVE) ? sc->N : sd->Ng` is used. 3. `ClosureLabel` * In `surface_shader_bsdf_sample_closure()`, we accumulate the result of all the closures, but `label` is solely determined by the closure chosen by `bsdf_sample()`. Maybe this is fine but the logic seems weird. * For `CLOSURE_BSDF_HAIR_CHIANG_ID`, the label is determined by the `wo` direction in `bsdf_label()`, but determined by the interaction number in `bsdf_sample()`. Maybe `label` should always be `LABEL_REFLECT` because hair closure handles internal absorption itself. 4. Anisotropy Behaves differently for Glossy and Principled BSDF. Principled BSDF uses remapping from [Disney](https://www.disneyanimation.com/publications/physically-based-shading-at-disney/) and only allow positive anisotropy. Glossy BSDF does not use remapping, allow both negative and positive anisotropy, and treat the distribution as isotropic if `anisotropy < 1e-4f`. The last piece of logic is repeated in svm, osl and `shader_nodes.cpp` 5. `eta` and `label` required by path guiding is inconsistent in BSDF sampling and evaluation.
Weizhen Huang added the
Type
To Do
Module
Render & Cycles
labels 2023-09-04 23:24:42 +02:00
Weizhen Huang changed title from Several inconsistencies in `bsdf_sample()` and `bsdf_eval()` to Several inconsistencies in Cycles BSDF 2023-09-05 11:54:21 +02:00
Weizhen Huang self-assigned this 2023-09-08 19:18:34 +02:00
Sign in to join this conversation.
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
1 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#111941
No description provided.