Pixar USD export does not follow API spec for camera units of attributes like focalLength #91177

Closed
opened 2021-09-04 07:36:44 +02:00 by Harvey Fong · 19 comments

Blender Version
Broken: blender-2.93.5-candidate+v293.ae1a57a05eed-windows.amd64-release

Short description of error
Pixar USD export for camera units does not follow API specification
https://graphics.pixar.com/usd/docs/api/class_usd_geom_camera.html#a911505cf224b975546bc2ea5505a041e

Exact steps for others to reproduce the error
Open blender
File->Export as Universal Scene Description
Save as test.usda
open text.usda in text editor and view camera definition

In Camera prim, note that prim attributes focalLength, horizontalAperture, horizontalApertureOffset, verticalAperture, verticalAperture are written out in mm units. As per the API https://graphics.pixar.com/usd/docs/api/class_usd_geom_camera.html#a911505cf224b975546bc2ea5505a041e the units should 1/10 of the world unit therefore focalLength should be 0.50 (aka decimetre or 0.1m units) when metersPerUnit=1

  def Camera "Camera"
  {
      float2 clippingRange = (0.1, 100)
      float focalLength = 50
      float horizontalAperture = 36
      float horizontalApertureOffset = 0
      token projection = "perspective"
      float verticalAperture = 20.25
      float verticalApertureOffset = 0
  }

Here is an example from Houdini's USD export for a 35mm focal length

  def Camera "camera1"
  {
      float2 clippingRange = (1, 1000000)
      float focalLength = 0.35
      float focusDistance = 4.4
      float fStop = 2.4
      float horizontalAperture = 0.20955
      float horizontalApertureOffset = 0
      token projection = "perspective"
      double shutter:close = 0.25
      double shutter:open = -0.25
      float verticalAperture = 0.1571625
      float verticalApertureOffset = 0
  }
**Blender Version** Broken: blender-2.93.5-candidate+v293.ae1a57a05eed-windows.amd64-release **Short description of error** Pixar USD export for camera units does not follow API specification https://graphics.pixar.com/usd/docs/api/class_usd_geom_camera.html#a911505cf224b975546bc2ea5505a041e **Exact steps for others to reproduce the error** Open blender File->Export as Universal Scene Description Save as test.usda open text.usda in text editor and view camera definition In Camera prim, note that prim attributes focalLength, horizontalAperture, horizontalApertureOffset, verticalAperture, verticalAperture are written out in mm units. As per the API https://graphics.pixar.com/usd/docs/api/class_usd_geom_camera.html#a911505cf224b975546bc2ea5505a041e the units should 1/10 of the world unit therefore focalLength should be 0.50 (aka decimetre or 0.1m units) when metersPerUnit=1 ``` def Camera "Camera" { float2 clippingRange = (0.1, 100) float focalLength = 50 float horizontalAperture = 36 float horizontalApertureOffset = 0 token projection = "perspective" float verticalAperture = 20.25 float verticalApertureOffset = 0 } ``` Here is an example from Houdini's USD export for a 35mm focal length ``` def Camera "camera1" { float2 clippingRange = (1, 1000000) float focalLength = 0.35 float focusDistance = 4.4 float fStop = 2.4 float horizontalAperture = 0.20955 float horizontalApertureOffset = 0 token projection = "perspective" double shutter:close = 0.25 double shutter:open = -0.25 float verticalAperture = 0.1571625 float verticalApertureOffset = 0 }
Author

Added subscriber: @oomer

Added subscriber: @oomer
Member

Added subscribers: @makowalski, @lichtwerk

Added subscribers: @makowalski, @lichtwerk
Member

Changed status from 'Needs Triage' to: 'Archived'

Changed status from 'Needs Triage' to: 'Archived'
Member

Thx for the report!

@makowalski : since this report is on a feature branch (which we usually dont track on this bugtracker): are you aware?
Just want to raise awareness, due to the policy of this tracker, will have to close though.

(@makowalski: also feel free to reopen in case you want this tracked here)

Thanks for the report. It appears that this is reporting on a feature branch.
Feature branches might include (partially) broken or missing functionality (which most of the time developers are already aware of). For this reason, bugs in feature branches are not handled on the bug tracker.
Please also test this on the master branch and if the issue is present there as well, please submit a new report for this.
Thx for the report! @makowalski : since this report is on a feature branch (which we usually dont track on this bugtracker): are you aware? Just want to raise awareness, due to the policy of this tracker, will have to close though. (@makowalski: also feel free to reopen in case you want this tracked here) ``` Thanks for the report. It appears that this is reporting on a feature branch. Feature branches might include (partially) broken or missing functionality (which most of the time developers are already aware of). For this reason, bugs in feature branches are not handled on the bug tracker. Please also test this on the master branch and if the issue is present there as well, please submit a new report for this. ```
Author

Sorry my mistake, I got confused after reviewing the bug report video on getting the latest experimental build. I grabbed the latest daily build instead and edited the report to reflect this. Please reopen as I don't have permission to do so. Thanks

Sorry my mistake, I got confused after reviewing the bug report video on getting the latest experimental build. I grabbed the latest daily build instead and edited the report to reflect this. Please reopen as I don't have permission to do so. Thanks
Member

Changed status from 'Archived' to: 'Needs Triage'

Changed status from 'Archived' to: 'Needs Triage'

@oomer @lichtwerk Thanks for reporting this issue! I'll investigate this further and will report back once I have more information. There are reports that using tenths of world units doesn't always give the expected results, so I'll need to do some additional research. This is an important question to resolve, so thanks for raising it.

@oomer @lichtwerk Thanks for reporting this issue! I'll investigate this further and will report back once I have more information. There are reports that using tenths of world units doesn't always give the expected results, so I'll need to do some additional research. This is an important question to resolve, so thanks for raising it.
Author

Thank you

If it helps, here is the thread on the usd-interest forum where the Lead Engineer on USD told me that both Blender and Modo are "outputting incorrect data"

https://groups.google.com/u/3/g/usd-interest/c/6EAeg-d53uI

He also goes into some technical details, that I don't understand, that while everybody would be happier if focal length and aperture could be measured in fixed units like Alembic it is problematic for USD.

Thank you If it helps, here is the thread on the usd-interest forum where the Lead Engineer on USD told me that both Blender and Modo are "outputting incorrect data" https://groups.google.com/u/3/g/usd-interest/c/6EAeg-d53uI He also goes into some technical details, that I don't understand, that while everybody would be happier if focal length and aperture could be measured in fixed units like Alembic it is problematic for USD.
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'

Thanks, @oomer, the link to the discussion is very helpful.

Thanks, @oomer, the link to the discussion is very helpful.

Added subscriber: @RobertS

Added subscriber: @RobertS

Not sure if this belongs here (I searched this site for metersPerUnit and this report seemed to fit), but this is what you get when you try to import a USD file from Blender into Unreal Engine 5.0:
bild.png

Not sure if this belongs here (I searched this site for metersPerUnit and this report seemed to fit), but this is what you get when you try to import a USD file from Blender into Unreal Engine 5.0: ![bild.png](https://archive.blender.org/developer/F10390818/bild.png)

In #91177#1217989, @RobertS wrote:
Not sure if this belongs here (I searched this site for metersPerUnit and this report seemed to fit), but this is what you get when you try to import a USD file from Blender into Unreal Engine 5.0:
bild.png

Thanks for reporting this, @eobet. This issue was previously reported here

https://developer.blender.org/T90519

and has already been fixed in master. The same fix will be released in the universal-scene-description branch experimental build soon.

> In #91177#1217989, @RobertS wrote: > Not sure if this belongs here (I searched this site for metersPerUnit and this report seemed to fit), but this is what you get when you try to import a USD file from Blender into Unreal Engine 5.0: > ![bild.png](https://archive.blender.org/developer/F10390818/bild.png) Thanks for reporting this, @eobet. This issue was previously reported here https://developer.blender.org/T90519 and has already been fixed in master. The same fix will be released in the `universal-scene-description` branch experimental build soon.

Added subscriber: @dr.sybren

Added subscriber: @dr.sybren

The USD documentation reads:

Perspective focal length in millimeters (or, more general, tenths of a world unit).

Blender implements this: focal length in millimeters. The USD spec is ambiguous when the world units are not cm, as in that case the sentence doesn't make much sense. From the above I assume that what's actually meant would be:

Perspective focal length in tenths of a world unit (so millimeters when the world unit is centimeters).

If this is indeed what is actually meant, then I agree the exporter is currently doing the wrong thing.

In #91177#1217351, @oomer wrote:
If it helps, here is the thread on the usd-interest forum where the Lead Engineer on USD told me that both Blender and Modo are "outputting incorrect data"

https://groups.google.com/u/3/g/usd-interest/c/6EAeg-d53uI

This is not a public discussion group, so it's hard to use it as a reference. Fortunately I'm member of that group, to which I posted something similar to what I just wrote here. I ended with:

To resolve this, I would advice an update to the USD documentation. When this is clarified, it should be fairly straight-forward to adjust Blender's behaviour to match.

The [USD documentation](https://graphics.pixar.com/usd/release/api/class_usd_geom_camera.html#a15709b0274673a367bcac5d4978500aa) reads: > Perspective focal length in millimeters (or, more general, tenths of a world unit). Blender implements this: focal length in millimeters. The USD spec is ambiguous when the world units are not cm, as in that case the sentence doesn't make much sense. From the above I assume that what's actually meant would be: > Perspective focal length in tenths of a world unit (so millimeters when the world unit is centimeters). If this is indeed what is actually meant, then I agree the exporter is currently doing the wrong thing. > In #91177#1217351, @oomer wrote: > If it helps, here is the thread on the usd-interest forum where the Lead Engineer on USD told me that both Blender and Modo are "outputting incorrect data" > > https://groups.google.com/u/3/g/usd-interest/c/6EAeg-d53uI This is not a public discussion group, so it's hard to use it as a reference. Fortunately I'm member of that group, to which I posted something similar to what I just wrote here. I ended with: To resolve this, I would advice an update to the USD documentation. When this is clarified, it should be fairly straight-forward to adjust Blender's behaviour to match.
Sonny Campbell self-assigned this 2022-09-20 16:00:41 +02:00

Added subscriber: @codeloadgame

Added subscriber: @codeloadgame
Philipp Oeser removed the
Interest
Pipeline, Assets & IO
label 2023-02-10 08:54:16 +01:00
Bastien Montagne added this to the USD project 2023-02-10 11:08:12 +01:00

Seems that the documentation has been updated since and the specification clarified : “ Perspective focal length in tenths of a scene unit;”

Seems that the documentation has been updated since and the specification clarified : “ Perspective focal length in tenths of a scene unit;”

Yup, that's because I happened to run into the writer of that documentation at SIGGRAPH last year, and expressed my concerns ;-)

Yup, that's because I happened to run into the writer of that documentation at SIGGRAPH last year, and expressed my concerns ;-)

Fixed as part of #112905.

Fixed as part of #112905.
Brecht Van Lommel added
Status
Resolved
and removed
Status
Confirmed
labels 2023-11-28 18:36:23 +01: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
8 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#91177
No description provided.