Fix: Cycles spot light spread sampling not considering non-uniform scaling #119661

Merged
Weizhen Huang merged 2 commits from weizhen/blender:fix-spot-light-non-uniform into main 2024-03-19 18:55:44 +01:00
Member

For spherical spot light without Soft Falloff, when the shading point is
close to the light source, we switch to sampling the light spread instead
of the visible cone from the shading point. This has the benefit of less
noise when the spread is small.
However, the light spread sampling was not considering non-uniform
object scaling, where the actual spread might be different.
This patch switches sampling method only when the smallest enclosing
spread cone is smaller than the visible cone from the shading point.

An alternative method would be to compute the actual solid angle of the
scaled cone, and sample from the scaled cone. However, that involves
ray transformation and modifying the sampling pdf and angle. Since
non-uniform scaling is rather a niche case, it's probably not worth the
computation effort.

Before After
before.png after.png
For spherical spot light without Soft Falloff, when the shading point is close to the light source, we switch to sampling the light spread instead of the visible cone from the shading point. This has the benefit of less noise when the spread is small. However, the light spread sampling was not considering non-uniform object scaling, where the actual spread might be different. This patch switches sampling method only when the smallest enclosing spread cone is smaller than the visible cone from the shading point. An alternative method would be to compute the actual solid angle of the scaled cone, and sample from the scaled cone. However, that involves ray transformation and modifying the sampling pdf and angle. Since non-uniform scaling is rather a niche case, it's probably not worth the computation effort. | Before | After | | -------- | -------- | | ![before.png](/attachments/bbc2b509-6b4f-45ab-961c-fcd54b68c987) | ![after.png](/attachments/7257ccad-f12d-4e02-852d-633c671b239c) |
Weizhen Huang added 2 commits 2024-03-19 15:03:04 +01:00
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
39b62f53bc
Fix: Cycles spot light spread sampling not considering non-uniform scaling
For spherical spot light, when the shading point is close to the light
source, we switch to sampling the light spread instead of the visible
cone from the shading point. This has the benefit of less noise when the
spread is small.
However, the light spread sampling was not considering non-uniform
object scaling, where the actual spread might be different.
This patch switches sampling method only when the smallest enclosing
spread cone is smaller than the visible cone from the shading point.

An alternative method would be to compute the actual solid angle of the
scaled cone, and sample from the scaled cone. However, that involves
ray transformation and modifying the sampling pdf and angle. Since
non-uniform scaling is rather a niche case, it's probably not worth the
computation effort.
Weizhen Huang added the
Module
Render & Cycles
label 2024-03-19 15:03:20 +01:00
Weizhen Huang changed title from fix-spot-light-non-uniform to Fix: Cycles spot light spread sampling not considering non-uniform scaling 2024-03-19 15:05:02 +01:00
Author
Member

@blender-bot package

@blender-bot package
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR119661) when ready.
Author
Member

@brecht do you want to review this?
The first commit is cleaning up, wanted to test together if they build on other platforms, not sure what that "AppleEvent timed out" means.

@brecht do you want to review this? The first commit is cleaning up, wanted to test together if they build on other platforms, not sure what that "AppleEvent timed out" means.
Brecht Van Lommel approved these changes 2024-03-19 18:22:17 +01:00
Brecht Van Lommel left a comment
Owner

Looks good.

Not sure what is going on with that timeout, unrelated to this PR in any case.

Looks good. Not sure what is going on with that timeout, unrelated to this PR in any case.
Weizhen Huang merged commit a2bb547b9a into main 2024-03-19 18:55:44 +01:00
Weizhen Huang deleted branch fix-spot-light-non-uniform 2024-03-19 18:55:47 +01: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
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#119661
No description provided.