Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/pablode/guc

glTF to USD converter with MaterialX support
https://github.com/pablode/guc

gltf materialx usd usdz

Last synced: 3 months ago
JSON representation

glTF to USD converter with MaterialX support

Awesome Lists containing this project

README

        

## guc

![USD v24.05](https://github.com/pablode/guc/actions/workflows/run-tests-usd2405.yml/badge.svg?branch=main)
![USD v24.03](https://github.com/pablode/guc/actions/workflows/run-tests-usd2403.yml/badge.svg?branch=main)

guc is a glTF to [Universal Scene Description](https://github.com/PixarAnimationStudios/USD) (USD) converter.

Unlike...
- [gltf2usd](https://github.com/kcoley/gltf2usd), it aims to be more than a PoC
- [usd_from_gltf](https://github.com/google/usd_from_gltf), it is not AR Quick Look centric
- [Apple's USDZ Tools](https://developer.apple.com/augmented-reality/tools/), it is open-source and freely available

guc furthermore supports near-lossless material translation via the [MaterialX](https://github.com/AcademySoftwareFoundation/MaterialX) standard.

All glTF features except animation and skinning are implemented and get continuously tested in guc's [test suite](https://github.com/pablode/guc-tests).






Wayfair's Iridescent Dish with Olives (CC BY) converted to USD+MaterialX with guc and rendered in hdStorm (left).
The same model in Khronos's glTF Sample Viewer (right).

### Build

You need USD v23.11+ (e.g. v24.05) with MaterialX support enabled.

Do a recursive clone of the repository and set up a build folder:
```
git clone https://github.com/pablode/guc --recursive
mkdir guc/build && cd guc/build
```

Pass following parameters in the CMake generation phase:
```
cmake .. -Wno-dev -DCMAKE_BUILD_TYPE=Release
```

Build the executable:
```
cmake --build . -j8 --config Release
```

> Note: set `BUILD_SHARED_LIBS` for shared builds, and `CMAKE_MSVC_RUNTIME_LIBRARY` to USD's MSVC ABI.

### Usage

```
guc 0.4 - glTF to USD converter

Usage: guc [options] [--]

Options:
-m, --emit-mtlx Emit MaterialX materials in addition to UsdPreviewSurfaces
-u, --mtlx-as-usdshade Convert and inline MaterialX materials into the USD layer using UsdMtlx
-c, --hdstorm-compat Apply compatibility tweaks for the USD Storm Hydra render delegate
-v, --default-material-variant= Index of the material variant that is selected by default
-l, --licenses Print the license of guc and third-party libraries
-h, --help Show the command help
```

Both glTF and GLB file types are valid input. USDA, USDC and USDZ formats can be written.

An example asset conversion is described in the [Structure Mapping](docs/Structure_Mapping.md) document.

### Extension support

Name | Status                        
------------------------------------|----------
KHR_lights_punctual | ✅ Partial 1
KHR_materials_clearcoat | ✅ Complete
KHR_materials_emissive_strength | ✅ Complete
KHR_materials_ior | ✅ Complete
KHR_materials_iridescence | ✅ Complete
KHR_materials_sheen | ✅ Complete
KHR_materials_specular | ✅ Complete
KHR_materials_transmission | ✅ Complete
KHR_materials_unlit | ✅ Complete
KHR_materials_variants | ✅ Complete
KHR_materials_volume | ✅ Partial 2
KHR_texture_transform | ✅ Complete

\[1\] Spotlight cone falloff is ignored.
\[2\] Thickness is not supported by the MaterialX glTF PBR implementation.

### Sdf plugin

The _usdGlTF_ library implements USD's Sdf file format interface. Enable the `GUC_BUILD_USDGLTF` CMake option before building and install it as follows:
```
cmake --install . --component usdGlTF --config Release --prefix /plugin/usd
```

glTF files can now be referenced as layers and opened with USD tooling.
The _emitMtlx_ dynamic Sdf file format argument controls MaterialX material emission.

### License

```

Copyright 2024 Pablo Delgado Krämer

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

```