pablode / guc Goto Github PK
View Code? Open in Web Editor NEWglTF to USD converter with MaterialX support
License: Apache License 2.0
glTF to USD converter with MaterialX support
License: Apache License 2.0
Currently, libguc prints error messages and returns false on convert(..)
. But calling applications may want to handle different types of errors differently. Identify error groups and return error codes instead.
Similar to usd_from_gltf, we could provide an Sdf file format plugin which implicitely converts glTF to USD+MaterialX files.
Extension spec: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_texture_transform
It should be mappable to the UsdShade Transform2d node and MaterialX's place2d node.
Set up GitHub Actions pipelines to produce binaries for Windows, Linux and MacOS. Consider using a USD docker image from the aswf-docker repo.
Unfortunately, there are multiple issues with UsdUtilsCreateNewUsdzPackage when it comes to layer referencing:
These two bug reports might be related:
Use 'group', 'assembly', 'component' and 'subcomponent' kind metadata of the UsdModelAPI to classify prims.
The glossary has an overview: https://graphics.pixar.com/usd/release/glossary.html#usdglossary-kind
We can create a displayColor primvar with 'constant' interpolation by taking the base_color factor or average texture color. It might even be possible to extract vertex colors by unwrapping the UV coordinates.
The generated values are not vertex colors and they should not be referenced by the MaterialX shading graph.
Really nice library! How difficult do you think it would be to be able to build it for wasm?
glTF supports an arbitrary number of COLOR accessors. We should expose them in a way while still translating COLOR_0 to displayColor
, preferably without duplicate data.
See also: https://groups.google.com/g/usd-interest/c/VOkh0aj-8bU/m/zxrMQ-pJAgAJ
NVIDIA distributes an MDL implementation of the glTF PBR as part of the MDL SDK: https://github.com/NVIDIA/MDL-SDK/blob/master/examples/mdl/nvidia/sdk_examples/gltf_support.mdl
It supports all material extensions except unlit and seems straightforward to implement.
guc has a version defined in the top-level CMakeLists.txt, but it is not propagated to the library and application. We should
--version
flag to the executable#define
the major, minor and patch version numbers in the libguc headerFurthermore, it might make sense to include the commit hash in non-release version strings.
Currently, many errors which occur during conversion are fatal. Revisit some of the handling since an asset with a missing material or mesh is more useful than no asset at all.
Translate the 'extras' field of all glTF entities into a corresponding USD representation. Do we want to dump a single metadatum or do we additionally decode key-value dicts?
Do you happen to have more detailed instructions on how to build this for someone who has never used cmake? Unsure how to build it after cloning the repository.
glTF animations are currently not supported. They are described in spec section 3.11.
Currently, meshes, cameras, lights and materials are instanced. But the glTF scenegraph is a DAG, which means that hierarchy parts can be instanced, too. Can this behaviour be replicated with USD?
Extension spec: https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_materials_variants/README.md
USD has native support for variants. Mapping should be quite easy.
Skinning (glTF spec 3.7.3) is currently not supported. We should be able to map it to the UsdSkel API.
I’m interested in converting JSON to C++ Object Notation (CPPON), such that JSON data can be included in C++ binaries without string literals.
I don’t have any examples of glTF myself and I’ve been relying on Khronos and Microsoft for their examples. I don’t know if I feel comfortable sharing my glTF CPPON examples, but I can share examples of X3D CPPON examples. I originally converted X3D documents to C++ to test X3D C++ SAI. Then I wrote a grammar for ANTLR4 for CPPON.
What I’m looking for is a good C++ API to convert glTF to. I have been working on my own interface for glTF, but it relies on examples, and is in no ways functional.
I have some experience with code-based skinning and converting Blender BVH export to X3D HAnim animation export. I would say I’m a glTF newbie.
if you have some C++ examples of building glTF or USD, that would be interesting for me.
The USD glossary says:
Gprims are boundable, and should always submit to computing an extent (even if it be an empty extent), and valid UsdGeom scene description should always provide an authored extent on a gprim that captures its changing shape (if its shape is animated).
We therefore should calculate a prim's bounding box and call SetExtentsHint.
Hi! I tried to get guc working with the custom resolver I've been working on but unfortunately it fails upon trying to load the file:
Failed to open "iroh://doc/pajzuzssv2l7wg7iruxixkbc7nfcm42gqfqbmzz5hux4im4v2yea/m5wfirrpirqw2ylhmvseqzlmnvsxilthnr2gmaa.gltf" - unable to parse glTF file: file not found
The problem is that this code assumes that resolvedPath
is on the local filesystem:
guc/src/libguc/src/fileFormat.cpp
Lines 97 to 106 in 0fb7f76
Ideally you'd call something like ArGetResolver().OpenAsset(resolvedPath)
to get an ArAsset
and then use the bytes from ArAsset::GetBuffer
to load the glTF data. This is a bit of a hastle not gonna lie, but it would mean that assets using custom URI schemas (iroh://
for me, but also http://
) would load perfectly.
Extension spec: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_unlit
The extension can not be correctly represented with a UsdPreviewSurface, but we might be able to emulate it using the emissive color.
In MaterialX, this feature should be covered by the recently introduced 'unlit' shader node: AcademySoftwareFoundation/MaterialX#860
Set up the testing infrastructure for..
Some open questions are:
Small but important fix in makeStSetName(). The index should only be appended if the index is > 0.
guc automatically generates unique names for prims, shading nodes and image files. This functionality is not covered by the Khronos validation and sample models. Custom test assets need to be created.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.