USD: Correctly write out and read Mesh velocity data #120771

Merged
Jesse Yurkovich merged 4 commits from deadpin/blender:usd-duplicatevel into main 2024-04-23 20:44:44 +02:00

During Export, we were accidentally duplicating the velocity attribute
data. Once inside the write_surface_velocity function (which was
correct) and again while writing out all "custom" attributes inside
write_custom_data (which was incorrect). Fixed by excluding the
"velocity" attribute inside write_custom_data.

During Import, we were only loading back in those "custom" primvars so
things happened to work, by accident, but only for USD files produced by
Blender. Now we import just the Velocities attribute which should work
with all files.

This should fully address #96182

During Export, we were accidentally duplicating the `velocity` attribute data. Once inside the `write_surface_velocity` function (which was correct) and again while writing out all "custom" attributes inside `write_custom_data` (which was incorrect). Fixed by excluding the "velocity" attribute inside `write_custom_data`. During Import, we were only loading back in those "custom" primvars so things happened to work, by accident, but only for USD files produced by Blender. Now we import just the Velocities attribute which should work with all files. This should fully address #96182
Jesse Yurkovich added 1 commit 2024-04-18 07:28:07 +02:00
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
e13e95dd34
Fix: Correctly write out and read Mesh velocity data
Author
Member

@blender-bot build

@blender-bot build
Jesse Yurkovich requested review from Michael Kowalski 2024-04-18 20:08:47 +02:00

There is some code that does this for primvar:normals as well but I
don't know the history of why that was done or why the preferred data is
taken from the primvar instead of the real attribute if both are present.

@deadpin Regarding the existing code for normals, please see the specification for meshes, in the section A Note About Normals

https://openusd.org/release/api/class_usd_geom_mesh.html#details

which states

If normals and primvars:normals are both specified, the latter has precedence.

> There is some code that does this for primvar:normals as well but I > don't know the history of why that was done or why the preferred data is > taken from the primvar instead of the real attribute if both are present. @deadpin Regarding the existing code for normals, please see the specification for meshes, in the section **A Note About Normals** https://openusd.org/release/api/class_usd_geom_mesh.html#details which states > If _normals_ and _primvars:normals_ are both specified, the latter has precedence.
Author
Member

@makowalski That's interesting, thanks! In this case I guess the check is more for backward compatibility with any USD file produced by blender prior to this change.

I'll leave a comment saying so. Do you think I should flip the order and prefer the real Velocities data first?

@makowalski That's interesting, thanks! In this case I guess the check is more for backward compatibility with any USD file produced by blender prior to this change. I'll leave a comment saying so. Do you think I should flip the order and prefer the real Velocities data first?

Do you think I should flip the order and prefer the real Velocities data first?

I don't see any guideline about this one way or the other. The way you have it now is good, in my opinion.

> Do you think I should flip the order and prefer the real Velocities data first? I don't see any guideline about this one way or the other. The way you have it now is good, in my opinion.
Michael Kowalski approved these changes 2024-04-19 22:15:31 +02:00
Michael Kowalski left a comment
Member

The changes look good! Thanks for the fix!

The changes look good! Thanks for the fix!
Jesse Yurkovich added 3 commits 2024-04-23 20:10:00 +02:00
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
c6c916d419
No need to read old primvar actually
Author
Member

@blender-bot build

@blender-bot build
Jesse Yurkovich merged commit 37cc387fcb into main 2024-04-23 20:44:44 +02:00
Jesse Yurkovich deleted branch usd-duplicatevel 2024-04-23 20:44:47 +02: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
2 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#120771
No description provided.