WIP: Cycles: implement faster GGX VNDF sampling #109757

Draft
Weizhen Huang wants to merge 1 commits from weizhen/blender:faster_ggx_vndf into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Member

from paper Sampling the GGX Distribution of Visible Normals at HPG 2023

The function itself uses less cross(), inversesqrt() and sqrtf(), is claimed to be 2.5x faster than the original function and take 3~7% less time in a simple test scene.
However, it doesn't seem to bring any visible speedup in Cycles.
Besides, the original implementation benefits from concentric disk sampling, whereas the new version does not. We could use sample_uniform_cone_concentric() to sample the spherical cap, but that doesn't have low distortion in the lower hemisphere.
Below is a visualization of mapping regular grid points to half vectors using different methods.

old new new with concentric
before.png after.png after_concentric.png

It is not clear if we want to use the new sampling method or not, but still create a pull request for the record.

from paper [Sampling the GGX Distribution of Visible Normals](https://diglib.eg.org/bitstream/handle/10.1111/cgf14867/v42i8_03_14867.pdf) at HPG 2023 The function itself uses less `cross()`, `inversesqrt()` and `sqrtf()`, is claimed to be 2.5x faster than the original function and take 3~7% less time in a simple test scene. However, it doesn't seem to bring any visible speedup in Cycles. Besides, the original implementation benefits from concentric disk sampling, whereas the new version does not. We could use `sample_uniform_cone_concentric()` to sample the spherical cap, but that doesn't have low distortion in the lower hemisphere. Below is a visualization of mapping regular grid points to half vectors using different methods. |old|new|new with concentric| |--|--|--| |![before.png](/attachments/ae94db55-4e27-47f8-9100-ba287456fcb2)|![after.png](/attachments/83712c36-61ed-4525-badc-4571f550b597)|![after_concentric.png](/attachments/7342f416-43b2-4ed7-8822-2e59451510c7)| It is not clear if we want to use the new sampling method or not, but still create a pull request for the record.
Weizhen Huang added the
Module
Render & Cycles
label 2023-07-05 19:57:47 +02:00
Weizhen Huang added 1 commit 2023-07-05 19:57:59 +02:00
from paper "Sampling the GGX Distribution of Visible Normals"
Weizhen Huang changed title from Cycles: implement faster GGX VNDF sampling to WIP: Cycles: implement faster GGX VNDF sampling 2023-07-06 13:04:25 +02:00
Author
Member

There is a new paper at SIGGRAPH Asia 2023
Bounded VNDF Sampling for Smith–GGX Reflections which is based on the above-mentioned paper, but raises the lower bound so that less samples get rejected after reflection.
Note that their method can only be used for GGX reflection, and makes the pdf computation more complicated.

There is a new paper at SIGGRAPH Asia 2023 [Bounded VNDF Sampling for Smith–GGX Reflections](https://gpuopen.com/download/publications/Bounded_VNDF_Sampling_for_Smith-GGX_Reflections.pdf) which is based on the above-mentioned paper, but raises the lower bound so that less samples get rejected after reflection. **Note that their method can only be used for GGX reflection, and makes the pdf computation more complicated.**
Author
Member

About my concerns regarding the lack of concentric mapping, the author of the paper, Yusuke Tokuyoshi, suggested to look at the reflection vectors instead of the half-vectors, as their method can offer lower distortions when the roughness is high.
I'm not convinced by their reply, as the result for lower roughness might still be worse. However, considering the benefit of less rejected samples, it might still worth just trying.

About my concerns regarding the lack of concentric mapping, the author of the paper, Yusuke Tokuyoshi, suggested to look at the reflection vectors instead of the half-vectors, as their method *can* offer lower distortions when the roughness is high. I'm not convinced by their reply, as the result for lower roughness might still be worse. However, considering the benefit of less rejected samples, it might still worth just trying.
This pull request has changes conflicting with the target branch.
  • intern/cycles/kernel/closure/bsdf_microfacet.h

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u faster_ggx_vndf:weizhen-faster_ggx_vndf
git checkout weizhen-faster_ggx_vndf
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
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
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
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#109757
No description provided.