USD: improve light units conversion #109795

Manually merged
Brecht Van Lommel merged 4 commits from brecht/blender:usd-light-units into main 2023-07-07 18:27:19 +02:00
  • Use pi factor to convert between radiant flux and intensity
  • Mark lights as normalized on export
  • Add spot light export support
  • Add treatAsPoint support for import and export
  • Empirically match normalized distant light
  • Fix wrong unnormalized point/sphere/disk light unit in Cycles

Overall it should be much closer now for all light types. Point and distant
light units are inconsistent between renderers, so not possible to match
everything there.

Ref #109404

* Use pi factor to convert between radiant flux and intensity * Mark lights as normalized on export * Add spot light export support * Add treatAsPoint support for import and export * Empirically match normalized distant light * Fix wrong unnormalized point/sphere/disk light unit in Cycles Overall it should be much closer now for all light types. Point and distant light units are inconsistent between renderers, so not possible to match everything there. Ref #109404
Brecht Van Lommel added 1 commit 2023-07-06 20:14:52 +02:00
f35d1a6278 USD: improve light units conversion
Use pi factor to convert from radiant flux to intensity, and fix wrong
unnormalized point/sphere light unit in Cycles.

Overall it should be much closer now for all lights. But point and distant
lights are still off and seemingly without a consistent convention in other
Hydra renderers.

Ref #109404
Brecht Van Lommel requested review from Michael Kowalski 2023-07-06 20:15:27 +02:00
Brecht Van Lommel requested review from Weizhen Huang 2023-07-06 20:15:27 +02:00
Brecht Van Lommel added 1 commit 2023-07-06 21:04:00 +02:00
Brecht Van Lommel added 1 commit 2023-07-06 21:21:54 +02:00
Michael Kowalski approved these changes 2023-07-07 02:01:21 +02:00
Michael Kowalski left a comment
Member

@brecht The changes look consistent to me, so I'm approving this PR. Just so I understand the motivation behind this, the goal appears to be to better match Karma lighting, is that right?

@brecht The changes look consistent to me, so I'm approving this PR. Just so I understand the motivation behind this, the goal appears to be to better match Karma lighting, is that right?
Author
Owner

I'm trying to match all Hydra renderers, but unfortunately there is no documented convention and there are inconsistencies in implementations.

  • For sphere, spot, area and disk lights, PRMan and Karma are the same and we match them. Storm can not accurately render these so difficult to compare to, but the old factor of 100 makes no sense and the new one seems okay-ish.
  • For distant lights, the PRMan unit is weird (see #109404). So I matched it to Karma. Storm doesn't support distant lights.
  • For zero radius points lights, I will have another look to see if we can do better. PRMan doesn't support them, Karma for some reason normalizes them differently than sphere lights with very small radius.
I'm trying to match all Hydra renderers, but unfortunately there is no documented convention and there are inconsistencies in implementations. * For sphere, spot, area and disk lights, PRMan and Karma are the same and we match them. Storm can not accurately render these so difficult to compare to, but the old factor of 100 makes no sense and the new one seems okay-ish. * For distant lights, the PRMan unit is weird (see #109404). So I matched it to Karma. Storm doesn't support distant lights. * For zero radius points lights, I will have another look to see if we can do better. PRMan doesn't support them, Karma for some reason normalizes them differently than sphere lights with very small radius.
Weizhen Huang reviewed 2023-07-07 11:10:26 +02:00
@ -10,6 +10,7 @@
#include <pxr/usd/usdLux/sphereLight.h>
#include "BLI_assert.h"
#include "BLI_math_rotation.h"
Member

Seems unnecessary?

Seems unnecessary?
Author
Owner

Indeed, though after the latest changes I did need it for spot lights.

Indeed, though after the latest changes I did need it for spot lights.
brecht marked this conversation as resolved
Weizhen Huang approved these changes 2023-07-07 11:10:49 +02:00
Brecht Van Lommel added 1 commit 2023-07-07 15:00:27 +02:00
Author
Owner

I did various fixes for zero radius point lights, they match Storm now. For Karma it's off by a factor of 4, and the same inconsistency exists in Houdini when switching Karma and Storm. So no hope of matching both and I think matching a sphere light with small radius makes most sense.

I did various fixes for zero radius point lights, they match Storm now. For Karma it's off by a factor of 4, and the same inconsistency exists in Houdini when switching Karma and Storm. So no hope of matching both and I think matching a sphere light with small radius makes most sense.
Brecht Van Lommel manually merged commit 05c97df2de into main 2023-07-07 18:27:19 +02:00
Contributor

Hello @brecht, I want to draw attention to the current ongoing effort to streamline light handling in USD/Hydra-supporting renderers over at the ASWF slack (usd-lux-discussion channel).

As part of this effort, a comparison between different renderers has been conducted, and a tighter specification is being worked out.

Hello @brecht, I want to draw attention to the current ongoing effort to streamline light handling in USD/Hydra-supporting renderers over at the ASWF slack (usd-lux-discussion channel). As part of this effort, a [comparison between different renderers](https://github.com/anderslanglands/light_comparison) has been conducted, and a tighter [specification](https://github.com/anderslanglands/light_comparison/blob/main/specification/specification.md) is being worked out.
Author
Owner

Thanks, I will follow the discussion in usd-lux.

Thanks, I will follow the discussion in usd-lux.
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
4 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#109795
No description provided.