Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

glTF MaterialX Converter integration #7

Closed
wants to merge 4 commits into from
Closed

Conversation

kwokcb
Copy link

@kwokcb kwokcb commented Sep 9, 2023

Summary

  • Adds the external converter to allows support for bidirectional transfer between glTF and MaterialX for materials. This is embedded as part of MaterialXRender instead of a separate module.
  • Adds Python a wrapper and a Python utility script mxgltf.py
  • Adds save / load to / from glTF in MaterialX Viewer and MaterialX Graph Editor.

Caveats

  • Does not include any tools to perform shader translation nor baking . This can be done as a separate pre-process using the MaterialX Viewer or other means.

@kwokcb
Copy link
Author

kwokcb commented Sep 9, 2023

@emackey , This is the PR to add glTF<->MTLX converter support into the Khronos main branch.

This is sync'ed against the release of 1.38.8. If this is agreed to be merged after review, I will add a Khronos 1.38.8 tag from which a downloadable release can be created.

@@ -0,0 +1,225 @@
/*
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a copy of the code I have, with a small tweak since it's not in a new module but just included as part of the MaterialXRender module.

#define MATERIALX_CGLTF_MaterialHandler_H

// This line added to original source code to place this into the MaterialX Render module.
#define MX_GLTF_API MX_RENDER_API
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simple "re-map" from custom module in external repo vs here which is in MaterialXRender.


/// @class GltfMaterialHandler
/// Wrapper for handling import / export of materials to / from GLTF files
class MX_GLTF_API GltfMaterialHandler : public MaterialHandler
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If JSON export is added and used for conversion then it can derive from the MaterialHandler base class as needed.

@fire
Copy link

fire commented Oct 26, 2023

What aspects of this require work? What is blocking this?

@kwokcb
Copy link
Author

kwokcb commented Oct 27, 2023

Hi @fire . I need to work out some logistics for this.
I will need to close this PR until this is resolved.

@kwokcb kwokcb closed this Oct 27, 2023
@kwokcb kwokcb deleted the 1.38.8_gltf_interop branch November 29, 2023 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants