guc icon indicating copy to clipboard operation
guc copied to clipboard

glTF to USD converter with MaterialX support

guc

guc is a glTF to Universal Scene Description (USD) converter.

Unlike...

guc furthermore supports near-lossless material translation via the MaterialX standard. Shading networks can be encoded as UsdShade and flattened for backwards compatibility.

All glTF features except animation and skinning are implemented and have been tested on Khronos's sample and validation models.

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 22.08 with MaterialX and OpenImageIO 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 \
         -DUSD_ROOT=<USD_INSTALL_DIR> \
         -DCMAKE_BUILD_TYPE=Release

Build the executable:

cmake --build . -j8 --target guc --config Release

Note: If you're using MSVC, be sure to select a 64-bit generator.

Usage

Usage: guc <gltf_path> <usd_path> [params]

Available params:
--emit-mtlx                       Emit MaterialX materials in addition to UsdPreviewSurfaces
--mtlx-as-usdshade                Convert and inline MaterialX materials with UsdMtlx
--flatten-nodes                   Flatten MaterialX glTF PBR nodes to stdlib and pbrlib nodes
--explicit-colorspace-transforms  Explicitly transform colorspaces using MaterialX nodes
--hdstorm-compat                  Apply compatibility tweaks for the USD hdStorm renderer

Both .gltf and .glb file types are valid input. .usda and .usdc USD formats can be written.

Debug logging can be enabled by defining the TF_DEBUG="GUC" environment variable.

Extension support

Name Status                        
KHR_draco_mesh_compression ❌ Not supported
KHR_lights_punctual ✅ Partial 1
KHR_materials_clearcoat ✅ Complete
KHR_materials_ior ✅ Complete
KHR_materials_sheen ✅ Complete
KHR_materials_specular ✅ Complete
KHR_materials_transmission ✅ Complete
KHR_materials_unlit 🚧 Planned
KHR_materials_variants 🚧 Planned
KHR_materials_volume ✅ Partial 2
KHR_mesh_quantization ❌ Not supported
KHR_texture_basisu ❌ Not supported
KHR_texture_transform 🚧 Planned
KHR_xmp_json_ld ❌ Not supported

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

Apple AR Quick Look compatibility

I have no intention of implementing workarounds for Apple's incomplete USD support. usd_from_gltf or Apple's USDZ Tools should be used instead.

License


   Copyright 2022 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.