USD Importer - not respecting output channels #96458
Labels
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
7 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#96458
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
System Information
Operating system: Windows
Graphics card: NVIDIA GeForce GTX 1060 6GB
Blender Version
Broken: 3.01,
dc2d180181
, master, 2022-01-25Worked: N/A
Short description of error
Importing USD files that have specific channels of a texture connected to material properties does not work (the channels aren't separated before being connected to the material properties).
Exact steps for others to reproduce the error
Note if you author the same file as GLTF and import that into Blender, it will correctly add a 'Separate RGB' node after the texture, then connect the B output to a 'Metallic Factor' node and then onto the 'Metallic' property, and to the 'Separate RGB' also connect the B output directly to Roughness.
This is how the GLTF shader nodes look:
This is how the USD shader nodes look:
Added subscriber: @scraft
Added subscriber: @OmarEmaraDev
Changed status from 'Needs Triage' to: 'Needs Developer To Reproduce'
Can you attach one such file to make testing easier?
But it does seem like the importer ignores all USD tokens except for the alpha one. So this seems like a limitation than a bug. Tagging the appropriate module for more information.
As a side note, the GLTF specification is a little more rigid for shininess/roughness and metalicity: https:*www.khronos.org/blog/art-pipeline-for-gltf
I appreciate this is GLTF and therefore doesn't apply directly to USD, but at the same time, the formats do sort of go hand-in-hand, ie if you want to author out assets that will be natively consumed on all devices then you have to export to both GLTF and USD. In general, both formats use 'standard' PBR rendering, so the idea is the result should look identical in each format. Because of the above, Green -> Roughness and Blue -> Metallic is very much the standard way of setting ORM (Occlusion, Roughness, and Metallic). It is also what is done by Unity for example when exporting to GLTF or USD.
I only point this out as a note that I am not attempting to do something exotic or unusual (which perhaps can be ignored as somewhat of an edge case) but instead am using a well-defined standard which currently Blender doesn't support.
I will try to make a simple test case USD/GLTF file for you.
Added subscribers: @makowalski, @mont29
Changed status from 'Needs Developer To Reproduce' to: 'Needs User Info'
@scraft Please attach a small reproducible test case, otherwise we'll have to close the report.
@makowalski maybe knows better about this topic though?
I can generate a test case based on the description and will investigate.
Changed status from 'Needs User Info' to: 'Needs Developer To Reproduce'
System Information
Operating system: Windows
Graphics card: NVIDIA GeForce RTX 3070
Blender Version
Broken: 4.0.1, branch: blender-v4.0-release, commit date: 2023-11-16 16:40, hash:
d0dd92834a
, type: releaseWorked: N/A
This problem still exists.
Change status to
Confirm
after 2 years ofNeeds Info from Developers
.Em, we still have to reproduce/check on this, will reset to
Needs Triage
When use Separate Color / XYZ to connect channels to materials, USD export also not correct.
that can be exported, but the channel is always as 'r'.
I can confirm the behavior (and sorry this has been lying around in such unclear state for so long).
BUT: this is not really expected to work in the current state of USD import/export, see https://docs.blender.org/manual/en/4.1/files/import_export/usd.html
Also this comment gives a hint at the limitations (this does not mention the channel mapping explicitly, just saying...):
Improvements unfortunately only come here bit by bit (e.g. in
925fb66693
)I also understand that you are not doing something out of the ordinary, but uncertain at this point if "Green -> Roughness and Blue -> Metallic is very much the standard way of setting ORM" is something we can always assume, but of course, if this is explicitly specified in the USD file, setting up blenders nodes (via a
Separate RGB
node) is the way to go.Maybe @makowalski and/or @CharlesWardlaw can comment on the plans of adding support for more nodes.
That all being said, the issue here is more like a feature request than a "real bug", usually these kinds of reports get closed, but maybe we can keep this as a TODO.
I guess the first (and more straightforward) step would be to tweak the importer (this would just mean adding a single node), the exporter might be a bit more involved (since this would have to traverse all nodes between to target socket and the Image Texture node and the question always is: "what to do if there is additional stuff happening there, not just a channel separation?")
at the current state, this is also what the code intends to do, see the following comment
/* If the input is a float, we connect it to either the texture alpha or red channels. */
Actually, I would like to check on this for a bit, maybe it is just a really quick thing to support
OK, I got a POC working (both on the export and the import side).
A roundtrip looks like this atm.:
Nodetree that gets exported
Nodetree after import
So next to testing some more real-world examples, it "just" needs a bit more work to get node placement right and it might make sense to cache the Separate Color nodes as well (so we dont create multiple of these for a single texture).
@mikan233 @lichtwerk Thanks for following up on this.
My apologies that this issue fell to the wayside. As mentioned above, improvements to the
USD Preview Surface
IO have been incremental. We've been planning to add support for handling texture channels, but no one has started work on this yet, so this contribution is most welcome.@lichtwerk Thanks for the prototype! It seems to me you're on the right track. If you'd like to create a pull request with these changes, I would be happy to review it and also discuss further any issues you're encountering.
You are right. But the USD specification allows that, Blender to be unable to follow the import and export rules of USD. that be incompatible with most supported software.
PR is up , see #117901