Blender Git Commit Log

Git Commits -> Revision ec62413

Revision ec62413 by Sybren A. Stüvel (master)
December 13, 2019, 09:27 (GMT)
USD: Introducing a simple USD Exporter

This commit introduces the first version of an exporter to Pixar's
Universal Scene Description (USD) format.

Reviewed By: sergey, LazyDodo

Differential Revision: https://developer.blender.org/D6287

- The USD libraries are built by `make deps`, but not yet built by
install_deps.sh.
- Only experimental support for instancing; by default all duplicated
objects are made real in the USD file. This is fine for exporting a
linked-in posed character, not so much for thousands of pebbles etc.
- The way materials and UV coordinates and Normals are exported is going
to change soon.
- This patch contains LazyDodo's fixes for building on Windows in D5359.

== Meshes ==

USD seems to support neither per-material nor per-face-group
double-sidedness, so we just use the flag from the first non-empty
material slot. If there is no material we default to double-sidedness.

Each UV map is stored on the mesh in a separate primvar. Materials can
refer to these UV maps, but this is not yet exported by Blender. The
primvar name is the same as the UV Map name. This is to allow the
standard name "st" for texture coordinates by naming the UV Map as such,
without having to guess which UV Map is the "standard" one.

Face-varying mesh normals are written to USD. When the mesh has custom
loop normals those are written. Otherwise the poly flag `ME_SMOOTH` is
inspected to determine the normals.

The UV maps and mesh normals take up a significant amount of space, so
exporting them is optional. They're still enabled by default, though.
For comparison: a shot of Spring (03_035_A) is 1.2 GiB when exported
with UVs and normals, and 262 MiB without. We probably have room for
optimisation of written UVs and normals.

The mesh subdivision scheme isn't using the default value 'Catmull
Clark', but uses 'None', indicating we're exporting a polygonal mesh.
This is necessary for USD to understand our normals; otherwise the mesh
is always rendered smooth. In the future we may want to expose this
choice of subdivision scheme to the user, or auto-detect it when we
actually support exporting pre-subdivision meshes.

A possible optimisation could be to inspect whether all polygons are
smooth or flat, and mark the USD mesh as such. This can be added when
needed.

== Animation ==

Mesh and transform animation are now written when passing
`animation=True` to the export operator. There is no inspection of
whether an object is actually animated or not; USD can handle
deduplication of static values for us.

The administration of which timecode to use for the export is left to
the file-format-specific concrete subclasses of
`AbstractHierarchyIterator`; the abstract iterator itself doesn't know
anything about the passage of time. This will allow subclasses for the
frame-based USD format and time-based Alembic format.

== Support for simple preview materials ==

Very simple versions of the materials are now exported, using only the
viewport diffuse RGB, metallic, and roughness.

When there are multiple materials, the mesh faces are stored as geometry
subset and each material is assigned to the appropriate subset. If there
is only one material this is skipped.

The first material if any) is always applied to the mesh itself
(regardless of the existence of geometry subsets), because the Hydra
viewport doesn't support materials on subsets. See
https://github.com/PixarAnimationStudios/USD/issues/542 for more info.

Note that the geometry subsets are not yet time-sampled, so it may break
when an animated mesh changes topology.

Materials are exported as a flat list under a top-level '/_materials'
namespace. This inhibits instancing of the objects using those
materials, so this is subject to change.

== Hair ==

Only the parent strands are exported, and only with a constant colour.
No UV coordinates, no information about the normals.

== Camera ==

Only perspective cameras are supported for now.

== Particles ==

Particles are only written when they are alive, which means that they
are always visible (there is currently no code that deals with marking
them as invisible outside their lifespan).

Particle-system-instanced objects are exported by suffixing the object
name with the particle's persistent ID, giving each particle XForm a
unique name.

== Instancing/referencing ==

This exporter has experimental support for instancing/referencing.

Dupli-object meshes are now written to USD as references to the original
mesh. This is still very limited in correctness, as there are issues
referencing to materials from a referenced mesh.

I am still committing this, as it gives us a place to start when
continuing the quest for proper instancing in USD.

== Lights ==

USD does not directly support spot lights, so those aren't exported yet.
It's possible to add this in the future via the UsdLuxShapingAPI. The
units used for the light intensity are also still a bit of a mystery.

== Fluid vertex velocities ==

Currently only fluid simulations (not meshes in general) have explicit
vertex velocities. This is the most important case for exporting
velocities, though, as the baked mesh changes topology all the time, and
thus computing the velocities at import time in a post-processing step
is hard.

== The Building Process ==

- USD is built as monolithic library, instead of 25 smaller libraries.
We were linking all of them as 'whole archive' anyway, so this doesn't
affect the final file size. It does, however, make life easier with
respect to linking order, and handling upstream changes.
- The JSON files required by USD are installed into datafiles/usd; they
are required on every platform. Set the `PXR_PATH_DEBUG` to any value
to have the USD library print the paths it uses to find those files.
- USD is patched so that it finds the aforementioned JSON files in a path
that we pass to it from Blender.
- USD is patched to have a `PXR_BUILD_USD_TOOLS` CMake option to disable
building the tools in its `bin` directory. This is sent as a pull
request at https://github.com/PixarAnimationStudios/USD/pull/1048

Commit Details:

Full Hash: ec62413f803ee506633f0e52d1e52b0980c0ed0d
Parent Commit: 6fc016d
Lines Changed: +3922, -7

29 Added Paths:

/build_files/build_environment/cmake/usd.cmake (+101, -0) (View)
/build_files/build_environment/patches/usd.diff (+111, -0) (View)
/build_files/cmake/Modules/FindUSD.cmake (+75, -0) (View)
/source/blender/editors/io/io_usd.c (+240, -0) (View)
/source/blender/editors/io/io_usd.h (+31, -0) (View)
/source/blender/usd/CMakeLists.txt (+81, -0) (View)
/source/blender/usd/intern/abstract_hierarchy_iterator.cc (+559, -0) (View)
/source/blender/usd/intern/abstract_hierarchy_iterator.h (+248, -0) (View)
/source/blender/usd/intern/usd_capi.cc (+218, -0) (View)
/source/blender/usd/intern/usd_exporter_context.h (+44, -0) (View)
/source/blender/usd/intern/usd_hierarchy_iterator.cc (+150, -0) (View)
/source/blender/usd/intern/usd_hierarchy_iterator.h (+71, -0) (View)
/source/blender/usd/intern/usd_writer_abstract.cc (+147, -0) (View)
/source/blender/usd/intern/usd_writer_abstract.h (+78, -0) (View)
/source/blender/usd/intern/usd_writer_camera.cc (+111, -0) (View)
/source/blender/usd/intern/usd_writer_camera.h (+38, -0) (View)
/source/blender/usd/intern/usd_writer_hair.cc (+84, -0) (View)
/source/blender/usd/intern/usd_writer_hair.h (+38, -0) (View)
/source/blender/usd/intern/usd_writer_light.cc (+112, -0) (View)
/source/blender/usd/intern/usd_writer_light.h (+37, -0) (View)
/source/blender/usd/intern/usd_writer_mesh.cc (+463, -0) (View)
/source/blender/usd/intern/usd_writer_mesh.h (+66, -0) (View)
/source/blender/usd/intern/usd_writer_transform.cc (+64, -0) (View)
/source/blender/usd/intern/usd_writer_transform.h (+42, -0) (View)
/source/blender/usd/usd.h (+62, -0) (View)
/tests/gtests/usd/abstract_hierarchy_iterator_test.cc (+202, -0) (View)
/tests/gtests/usd/CMakeLists.txt (+87, -0) (View)
/tests/gtests/usd/hierarchy_context_order_test.cc (+123, -0) (View)
/tests/gtests/usd/usd_stage_creation_test.cc (+72, -0) (View)

26 Modified Paths:

/build_files/build_environment/cmake/harvest.cmake (+3, -0) (Diff)
/build_files/build_environment/cmake/versions.cmake (+4, -0) (Diff)
/build_files/build_environment/CMakeLists.txt (+1, -0) (Diff)
/build_files/cmake/config/blender_full.cmake (+1, -0) (Diff)
/build_files/cmake/config/blender_release.cmake (+1, -0) (Diff)
/build_files/cmake/macros.cmake (+20, -4) (Diff)
/build_files/cmake/platform/platform_apple.cmake (+5, -0) (Diff)
/build_files/cmake/platform/platform_unix.cmake (+8, -0) (Diff)
/build_files/cmake/platform/platform_win32.cmake (+13, -1) (Diff)
/CMakeLists.txt (+4, -0) (Diff)
/release/scripts/startup/bl_ui/space_topbar.py (+3, -1) (Diff)
/release/scripts/startup/bl_ui/space_userpref.py (+15, -0) (Diff)
/source/blender/CMakeLists.txt (+3, -0) (Diff)
/source/blender/editors/io/CMakeLists.txt (+10, -0) (Diff)
/source/blender/editors/io/io_ops.c (+7, -0) (Diff)
/source/blender/editors/space_file/filelist.c (+6, -0) (Diff)
/source/blender/editors/space_file/filesel.c (+3, -0) (Diff)
/source/blender/makesdna/DNA_space_types.h (+1, -0) (Diff)
/source/blender/makesdna/DNA_userdef_types.h (+2, -1) (Diff)
/source/blender/makesrna/intern/rna_userdef.c (+7, -0) (Diff)
/source/blender/python/intern/bpy_app_build_options.c (+7, -0) (Diff)
/source/blender/python/intern/CMakeLists.txt (+4, -0) (Diff)
/source/blender/windowmanager/intern/wm_operator_props.c (+2, -0) (Diff)
/source/creator/CMakeLists.txt (+13, -0) (Diff)
/source/creator/creator.c (+21, -0) (Diff)
/tests/gtests/CMakeLists.txt (+3, -0) (Diff)
By: Miika HämäläinenLast update: Nov-07-2014 14:18MiikaHweb | 2003-2021