Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,7 @@ test/assets/fbx/*.usd
test/assets/gltf/*.usd
test/assets/obj/*/*.usd
test/assets/ply/*.usd
test/assets/stl/*.usd
test/assets/stl/*.usd

# Other
.DS_Store
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ option(USD_FILEFORMATS_FETCH_DRACO "Forces FetchContent for Draco" OFF)
option(USD_FILEFORMATS_FETCH_ZLIB "Forces FetchContent for Zlib" OFF)
option(USD_FILEFORMATS_FETCH_LIBXML2 "Forces FetchContent for LibXml2" ON)
option(USD_FILEFORMATS_FETCH_HAPPLY "Forces FetchContent for Happly" ON)
option(USD_FILEFORMATS_FETCH_SPHERICAL_HARMONICS "Forces FetchContent for SphericalHarmonics" ON)
option(USD_FILEFORMATS_FETCH_FMT "Forces FetchContent for Fmt" ON)
option(USD_FILEFORMATS_FETCH_FASTFLOAT "Forces FetchContent for FastFLoat" ON)
option(USD_FILEFORMATS_ENABLE_CXX11_ABI "Use the CXX 11 ABI on Linux" OFF)
option(USD_FILEFORMATS_ENABLE_ASM "Enables ASM material representation" OFF)
option(USD_FILEFORMATS_FETCH_SPHERICAL_HARMONICS "Forces FetchContent for SphericalHarmonics" ON)

# This is a future looking option which turns on/off writing MaterialX Shaders
# when importing a file per the OpenPBR spec:
Expand Down
41 changes: 24 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/kwblackstone/264643f3d2acacc5369a0ba70854dfb6/raw/windows-2022-2411-ALL.json)](https://github.com/adobe/USD-Fileformat-plugins/actions/workflows/ci.yml) [![](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/kwblackstone/264643f3d2acacc5369a0ba70854dfb6/raw/windows-2022-2408-ALL.json)](https://github.com/adobe/USD-Fileformat-plugins/actions/workflows/ci.yml) [![](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/kwblackstone/264643f3d2acacc5369a0ba70854dfb6/raw/windows-2022-2311-ALL.json)](https://github.com/adobe/USD-Fileformat-plugins/actions/workflows/ci.yml) [![](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/kwblackstone/264643f3d2acacc5369a0ba70854dfb6/raw/windows-2022-2308-ALL.json)](https://github.com/adobe/USD-Fileformat-plugins/actions/workflows/ci.yml)

[![](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/kwblackstone/264643f3d2acacc5369a0ba70854dfb6/raw/macOS-14-2411-ALL.json)](https://github.com/adobe/USD-Fileformat-plugins/actions/workflows/ci.yml) [![](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/kwblackstone/264643f3d2acacc5369a0ba70854dfb6/raw/macOS-14-2408-ALL.json)](https://github.com/adobe/USD-Fileformat-plugins/actions/workflows/ci.yml) [![](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/kwblackstone/264643f3d2acacc5369a0ba70854dfb6/raw/macOS-14-2411-ALL.json)](https://github.com/adobe/USD-Fileformat-plugins/actions/workflows/ci.yml)
[![](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/kwblackstone/264643f3d2acacc5369a0ba70854dfb6/raw/macOS-14-2411-ALL.json)](https://github.com/adobe/USD-Fileformat-plugins/actions/workflows/ci.yml) [![](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/kwblackstone/264643f3d2acacc5369a0ba70854dfb6/raw/macOS-14-2408-ALL.json)](https://github.com/adobe/USD-Fileformat-plugins/actions/workflows/ci.yml) [![](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/kwblackstone/264643f3d2acacc5369a0ba70854dfb6/raw/macOS-14-2405-ALL.json)](https://github.com/adobe/USD-Fileformat-plugins/actions/workflows/ci.yml)

[![](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/kwblackstone/264643f3d2acacc5369a0ba70854dfb6/raw/macOS-13-2411-ALL.json)](https://github.com/adobe/USD-Fileformat-plugins/actions/workflows/ci.yml) [![](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/kwblackstone/264643f3d2acacc5369a0ba70854dfb6/raw/macOS-13-2408-ALL.json)](https://github.com/adobe/USD-Fileformat-plugins/actions/workflows/ci.yml)[![](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/kwblackstone/264643f3d2acacc5369a0ba70854dfb6/raw/macOS-13-2405-ALL.json)](https://github.com/adobe/USD-Fileformat-plugins/actions/workflows/ci.yml) [![](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/kwblackstone/264643f3d2acacc5369a0ba70854dfb6/raw/macOS-13-2311-ALL.json)](https://github.com/adobe/USD-Fileformat-plugins/actions/workflows/ci.yml) [![](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/kwblackstone/264643f3d2acacc5369a0ba70854dfb6/raw/macOS-13-2308-ALL.json)](https://github.com/adobe/USD-Fileformat-plugins/actions/workflows/ci.yml)

Expand Down Expand Up @@ -41,17 +41,19 @@ The following tools are needed:
The following dependencies are needed:
|Dependency|Version|Affects|Optional|
|--|--|--|--|
| [Pixar USD](https://github.com/PixarAnimationStudios/USD) | 23.08 | all | no |
| [GTest](https://github.com/google/googletest.git) | 1.11.0 | all tests | yes |
| [FBX SDK](https://aps.autodesk.com/developer/overview/fbx-sdk) | 2020.3.7 | usdfbx | no |
| [LibXml2](https://gitlab.gnome.org/GNOME/libxml2) | 2.10.0 | usdfbx | no |
| [Zlib](https://github.com/madler/zlib.git) | 1.2.11 | usdfbx | no |
| [TinyGltf](https://github.com/syoyo/tinygltf) | 2.8.21 | usdgltf | no |
| [Draco](https://github.com/google/draco.git) | 1.56 | usdgltf | yes |
| [Fmt](https://github.com/fmtlib/fmt.git) | 10.1.1 | usdobj | no |
| [FastFloat](https://github.com/lemire/fast_float.git) | 1.1.2 | usdobj | no |
| [Happly](https://github.com/nmwsharp/happly.git) | cfa2611 | usdply | no |
| [Substance](https://developer.adobe.com/substance3d-sdk/) | 9.1.2 | usdsbsar | no |
| [Pixar USD](https://github.com/PixarAnimationStudios/USD) | 23.08 | all | no |
| [GTest](https://github.com/google/googletest.git) | 1.11.0 | all tests | yes |
| [Eigen](https://gitlab.com/libeigen/eigen) | 3.4.0 | usdply | no |
| [FBX SDK](https://aps.autodesk.com/developer/overview/fbx-sdk) | 2020.3.7 | usdfbx | no |
| [LibXml2](https://gitlab.gnome.org/GNOME/libxml2) | 2.10.0 | usdfbx | no |
| [Zlib](https://github.com/madler/zlib.git) | 1.2.11 | usdfbx | no |
| [TinyGltf](https://github.com/syoyo/tinygltf) | 2.8.21 | usdgltf | no |
| [Draco](https://github.com/google/draco.git) | 1.56 | usdgltf | yes |
| [Fmt](https://github.com/fmtlib/fmt.git) | 10.1.1 | usdobj | no |
| [FastFloat](https://github.com/lemire/fast_float.git) | 1.1.2 | usdobj | no |
| [Happly](https://github.com/nmwsharp/happly.git) | cfa2611 | usdply | no |
| [Spherical Harmonics](https://github.com/google/spherical-harmonics) | ccb6c7f | usdply | no |
| [Substance](https://developer.adobe.com/substance3d-sdk/) | 9.1.2 | usdsbsar | no |

## Build

Expand Down Expand Up @@ -141,8 +143,6 @@ where:
| -DUSD_FILEFORMATS_FETCH_FASTFLOAT | Forces FetchContent for FastFLoat | ON | usdobj |
| -DUSD_FILEFORMATS_ENABLE_ASM | Generate a ASM based material network on layerwrite | OFF |

Note that `Dpxr_ROOT` is *not* an optional parameter - a reference to the OpenUSD installation path **has** to be passed.

ZLIB, Draco and OpenImageIO packages are hinted to search into the USD installation by default. Override this by setting their ROOT or their FETCH variables (no fetch for OIIO).

The previous commands will place intermediate files into the folder `build` and install binaries into the folder `bin`.
Expand All @@ -157,7 +157,7 @@ Also, make the plugins discoverable by USD to complete installation, by adding t
```bash
python ./USD/build_scripts/build_usd.py ./usd-install --build-shared --usd-imaging --tools --generator <GENERATOR> --openimageio --build-variant release
```
#### For Linux/Mac:
#### For Linux:
```bash
python ./USD/build_scripts/build_usd.py ./usd-install --use-cxx11-abi=1 --build-shared --usd-imaging --tools --generator <GENERATOR> --openimageio --build-variant release
```
Expand All @@ -175,12 +175,19 @@ Environment Variables
set PATH=%PATH%;.\USD-Fileformat-plugins\bin\bin;.\USD-Fileformat-plugins\bin\plugin\usd
set PXR_PLUGINPATH_NAME=%PXR_PLUGINPATH_NAME%;.\USD-Fileformat-plugins\bin\plugin\usd
```
#### For Linux/Mac
#### For Linux
```bash
export PATH=$PATH:./USD-Fileformat-plugins/bin/bin:./USD-Fileformat-plugins/bin/plugin/usd
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./USD-Fileformat-plugins/bin/lib:./USD-Fileformat-plugins/bin/lib64
export PXR_PLUGINPATH_NAME=$PXR_PLUGINPATH_NAME:./USD-Fileformat-plugins/bin/plugin/usd
```
#### For Mac
```bash
export PATH=$PATH:./USD-Fileformat-plugins/bin/bin:./USD-Fileformat-plugins/bin/plugin/usd
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./USD-Fileformat-plugins/bin/lib
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:./USD-Fileformat-plugins/bin/lib
export PXR_PLUGINPATH_NAME=$PXR_PLUGINPATH_NAME:./USD-Fileformat-plugins/bin/plugin/usd
```

Or Copy plugins:
* Copy the installed plugins and dependent shared libraries to the specified folder:
Expand Down Expand Up @@ -259,4 +266,4 @@ To generate the documentation go to the project root folder and enter:
```
doxygen
```
The resulting documentation will be placed at the `docs` folder.
The resulting documentation will be placed at the `docs` folder.
27 changes: 27 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
v1.1.0 January 31st, 2025
fbx:
- add display name to USD to save imported names for export
- import specular roughness from autodesk standard surface
- interpolate diffuse color on export for intermediate metallic values
- avoid creating extra root nodes during import & export
- adjust mesh and mesh instancing setup
gltf:
- add display name to USD to save imported names for export
- ignore invalid indices on export
- adjust mesh and mesh instancing setup
ply:
- add spherical harmonics support
- detect nan values for gsplat opacity and convert to 0
- fix for loading ply files with non-ascii characters in filename
sbsar
- updated the list of sbsar engines for mac x64 to include metal
- add emissive intensity of 1 when we find emissive color
- set scale and bias correctly for normal map reader nodes
utility:
- update required env vars for Mac in Readme
- print OIIO error on failure
- restrict XForm collapsing to DefaultPrim
- usd v24.11 cleanup
- refactor utility exporting, cmake cleanup, rename files, remove extra logs


v1.0.10 November 19th, 2024
fbx:
- small fbx spot light fixes
Expand Down
33 changes: 33 additions & 0 deletions cmake/CPM.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
set(CPM_DOWNLOAD_VERSION 0.40.2)

if(CPM_SOURCE_CACHE)
set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
elseif(DEFINED ENV{CPM_SOURCE_CACHE})
set(CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
else()
set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
endif()

# Expand relative path. This is important if the provided path contains a tilde (~)
get_filename_component(CPM_DOWNLOAD_LOCATION ${CPM_DOWNLOAD_LOCATION} ABSOLUTE)

function(download_cpm)
message(STATUS "Downloading CPM.cmake to ${CPM_DOWNLOAD_LOCATION}")
file(DOWNLOAD
https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake
${CPM_DOWNLOAD_LOCATION}
)
endfunction()

if(NOT (EXISTS ${CPM_DOWNLOAD_LOCATION}))
download_cpm()
else()
# resume download if it previously failed
file(READ ${CPM_DOWNLOAD_LOCATION} check)
if("${check}" STREQUAL "")
download_cpm()
endif()
unset(check)
endif()

include(${CPM_DOWNLOAD_LOCATION})
63 changes: 63 additions & 0 deletions cmake/FindEigen3.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
if(TARGET Eigen3::Eigen)
return()
endif()

option(EIGEN_WITH_MKL "Use Eigen with MKL" OFF)
option(EIGEN_DONT_VECTORIZE "Disable Eigen vectorization" OFF)

if(EIGEN_ROOT)
message(STATUS "Third-party (external): creating target 'Eigen3::Eigen' for external path: ${EIGEN_ROOT}")
set(EIGEN_INCLUDE_DIRS ${EIGEN_ROOT})
else()
message(STATUS "Third-party (external): creating target 'Eigen3::Eigen'")

include(CPM)
CPMAddPackage(
NAME eigen
GIT_REPOSITORY https://gitlab.com/libeigen/eigen.git
GIT_TAG 3.4.0
DOWNLOAD_ONLY ON
)
set(EIGEN_INCLUDE_DIRS ${eigen_SOURCE_DIR})

install(DIRECTORY ${EIGEN_INCLUDE_DIRS}/Eigen
DESTINATION include
)
endif()

add_library(Eigen3_Eigen INTERFACE)
add_library(Eigen3::Eigen ALIAS Eigen3_Eigen)

include(GNUInstallDirs)
target_include_directories(Eigen3_Eigen SYSTEM INTERFACE
$<BUILD_INTERFACE:${EIGEN_INCLUDE_DIRS}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
target_compile_definitions(Eigen3_Eigen INTERFACE EIGEN_MPL2_ONLY)

if(EIGEN_DONT_VECTORIZE)
target_compile_definitions(Eigen3_Eigen INTERFACE EIGEN_DONT_VECTORIZE)
endif()

if(EIGEN_WITH_MKL)
# TODO: Checks that, on 64bits systems, `mkl::mkl` is using the LP64 interface
# (by looking at the compile definition of the target)
include(mkl)
target_link_libraries(Eigen3_Eigen INTERFACE mkl::mkl)
target_compile_definitions(Eigen3_Eigen INTERFACE
EIGEN_USE_MKL_ALL
EIGEN_USE_LAPACKE_STRICT
)
endif()

# On Windows, enable natvis files to improve debugging experience
if(WIN32 AND eigen_SOURCE_DIR)
target_sources(Eigen3_Eigen INTERFACE $<BUILD_INTERFACE:${eigen_SOURCE_DIR}/debug/msvc/eigen.natvis>)
endif()

# Install rules
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME eigen)
set_target_properties(Eigen3_Eigen PROPERTIES EXPORT_NAME Eigen)
install(DIRECTORY ${EIGEN_INCLUDE_DIRS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(TARGETS Eigen3_Eigen EXPORT Eigen_Targets)
install(EXPORT Eigen_Targets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/eigen NAMESPACE Eigen3::)
100 changes: 100 additions & 0 deletions cmake/FindSphericalHarmonics.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
#[=======================================================================[.rst:
----

Finds or fetches the spherical-harmonics library.
If USD_FILEFORMATS_FORCE_FETCHCONTENT or USD_FILEFORMATS_FETCH_SPHERICAL_HARMONICS are
TRUE, spherical-harmonics will be fetched. Otherwise it will be searched via find commands.

Imported Targets
^^^^^^^^^^^^^^^^

This module provides the following imported targets, if fetched:

``SphericalHarmonics::SphericalHarmonics``
The SphericalHarmonics library

Result Variables
^^^^^^^^^^^^^^^^

This will define the following variables:

``SphericalHarmonics_FOUND``

Cache Variables
^^^^^^^^^^^^^^^

The following cache variables may also be set:

``SH_INCLUDE_DIR``
The directory containing ``sh/spherical_harmonics.h``.

#]=======================================================================]

if(TARGET SphericalHarmonics::SphericalHarmonics)
return()
endif()

if (NOT TARGET Eigen3::Eigen)
find_package(Eigen3 REQUIRED)
endif()

if(USD_FILEFORMATS_FORCE_FETCHCONTENT OR USD_FILEFORMATS_FETCH_SPHERICAL_HARMONICS)
message(STATUS "Fetching SphericalHarmonics")
include(FetchContent)
FetchContent_Declare(
spherical_harmonics_git
GIT_REPOSITORY "https://github.com/google/spherical-harmonics.git"
GIT_TAG "ccb6c7fec875a1cd5ce5eb1315a9fa7603e0919a"
)
FetchContent_MakeAvailable(spherical_harmonics_git)

if(spherical_harmonics_git_POPULATED)
set(SphericalHarmonics_FOUND TRUE)
set(SH_SRC_FILES
${spherical_harmonics_git_SOURCE_DIR}/sh/spherical_harmonics.cc
${spherical_harmonics_git_SOURCE_DIR}/sh/spherical_harmonics.h
${spherical_harmonics_git_SOURCE_DIR}/sh/image.h
)
add_library(SphericalHarmonics STATIC)
target_sources(SphericalHarmonics PRIVATE ${SH_SRC_FILES})
set(SH_INCLUDE_DIR "${spherical_harmonics_git_SOURCE_DIR}")
target_include_directories(SphericalHarmonics PUBLIC ${SH_INCLUDE_DIR})
target_link_libraries(SphericalHarmonics PUBLIC Eigen3::Eigen)
set_property(TARGET SphericalHarmonics PROPERTY POSITION_INDEPENDENT_CODE ON)
set_property(TARGET SphericalHarmonics PROPERTY CXX_STANDARD 17)
target_compile_definitions(SphericalHarmonics PRIVATE "_USE_MATH_DEFINES")
add_library(SphericalHarmonics::SphericalHarmonics ALIAS SphericalHarmonics)
endif()
else()
include(FindPackageHandleStandardArgs)

find_path(SH_INCLUDE_DIR
NAMES sh/spherical_harmonics.h
)

find_package_handle_standard_args(SphericalHarmonics
REQUIRED_VARS SH_INCLUDE_DIR
)

if(SphericalHarmonics_FOUND)
set(SH_SRC_FILES
${SH_INCLUDE_DIR}/sh/spherical_harmonics.cc
${SH_INCLUDE_DIR}/sh/spherical_harmonics.h
${SH_INCLUDE_DIR}/sh/image.h
)
add_library(SphericalHarmonics STATIC)
target_sources(SphericalHarmonics PRIVATE ${SH_SRC_FILES})
set(SH_INCLUDE_DIR "${SphericalHarmonics_SOURCE_DIR}")
target_include_directories(SphericalHarmonics PUBLIC ${SH_INCLUDE_DIR})
target_link_libraries(SphericalHarmonics PUBLIC Eigen3::Eigen)
set_property(TARGET SphericalHarmonics PROPERTY POSITION_INDEPENDENT_CODE ON)
set_property(TARGET SphericalHarmonics PROPERTY CXX_STANDARD 17)
target_compile_definitions(SphericalHarmonics PRIVATE "_USE_MATH_DEFINES")

add_library(SphericalHarmonics::SphericalHarmonics ALIAS SphericalHarmonics)
elseif(${SphericalHarmonics_FIND_REQUIRED})
message(FATAL_ERROR "Could not find SphericalHarmonics")
endif()
endif()


4 changes: 3 additions & 1 deletion fbx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
|Skeletons |✅|✅|
|Skeleton Animations |✅|⚠️|
||||
|Materials |✅||
|Materials |✅|⚠️|



Expand Down Expand Up @@ -74,6 +74,8 @@ opacity → phongSurface::TransparentColor
ior → Not been used.
displacement → phongSurface::DisplacementColor

Note that PBR materials are not supported on export, only Phong

- Only point, directional, and spot lights are imported. Other light types are exported as point lights.

- **OBS: The image files used by the UsdPreviewShader node will be extracted from the USDZ file and saved as PNG files in the same folder as the generated fbx. If the source file is USD the files should also be copied from the USD folder into the FBX folder.**
Expand Down
2 changes: 1 addition & 1 deletion fbx/src/fbx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ governing permissions and limitations under the License.
#include "fbx.h"
#include "debugCodes.h"
#include <algorithm>
#include <common.h>
#include <fileformatutils/common.h>
#include <fbxsdk.h>
#include <fstream>
#include <pxr/base/gf/matrix3d.h>
Expand Down
2 changes: 1 addition & 1 deletion fbx/src/fbx.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ governing permissions and limitations under the License.
#include <pxr/pxr.h>
#include <sstream>
#include <string>
#include <usdData.h>
#include <fileformatutils/usdData.h>
#include <utility>


Expand Down
Loading