Comments (9)
Hi Mitch,
That's a great question. I have very limited knowledge about Mari's shading system, but for the question about a MaterialXGenMari library the answer is yes this would definitely be possible, it would be the appropriate solution to derive a custom code generator targeting Mari. This is how the MaterialX shadergen system is designed to work, where you can inherit from existing generator classes (when possible) and customize for new targets.
MaterialXGenGlsl is generating vertex/pixel shader pairs for a quite simple forward renderer, mainly targeting the MaterialXView application. But it would be a good start to derive from, and depending on how different this is from Mari's render pipeline you can override and customize smaller or larger parts of this.
For example, in Maya the viewport is similar in the sense that GLSL code fragments are stitched together using an XML based fragment system. For this we have derived generator classes targeting Maya by inheriting from classes in MaterialXGenGlsl. Code for this library can be found in our fork: https://github.com/autodesk-forks/MaterialX/tree/adsk_contrib/dev/source/MaterialXGenOgsXml
I hope others can share more details on Mari's shading system and maybe how/if they have used MaterialX codegen already targeting Mari in some form.
from materialx.
The latest USD change log from Pixar hints there are initial support for MaterialX in hdStorm in the upcoming 21.05 release:
PixarAnimationStudios/OpenUSD@f57e281
This might be another good source of inspiration for how to integrate MaterialX codegen to another viewport renderer. I don't know the details yet but I think this is based on MaterialXGenGlsl as well.
from materialx.
Okay, thanks for the response Niklas!
I'll take a look around the MaterialXGenGlsl code and your Maya viewport fork to see what they're all about. I've written a fair amount of custom shader code for Mari, so this should give me a rough idea of what's involved and how much to expect out of a possible MaterialXGenMari.
mitch
from materialx.
@mprater Good question, and I agree with the notes from @niklasharrysson above. Pixar's integration of MaterialX code generation into Hydra/Storm is definitely a good example to look at, and here's the declaration of the HdStMaterialXShaderGen
class which specializes MaterialX::GlslShaderGenerator
for Hydra/Storm:
I know that Karen Lucknavalai at Pixar has plans for this system in the future, and it could be worthwhile to bring her into the conversation once you have an initial framework. On the MaterialX side, I believe we can also do a more thorough job of providing virtual methods for ShaderGenerator subclasses to override, and we're open to ideas and contributions in this area.
from materialx.
Hi Jonathan! I think the biggest issue here will be the shading limitations imposed by Mari. Rather than being a (relatively simple) glsl rendering system, it imposes a great deal of structure onto the shading components in order to operate as a paint system. As such, it uses individual shading nodes whose purposes fall into a very small number of functional categories corresponding to paint layer manipulation, and Mari assembles the shading network into its final OpenGL form to be used in the viewport. From what I've gathered so far about the MaterialXShaderGen process, this shading framework doesn't align very well. Is it possible to use (or modify) the MateralXShaderGen process to generate partial shaders (shader functions essentially), that use a narrowly defined API?
from materialx.
Hold on - now that I've thought about it, instead of trying to impose Mari's shading framework on MaterialX, I should turn that around. Mari has a custom shader category called a "standalone" shader, which is essentially what MaterialX generates as I understand it. Yes... I think this could work. I'll take a closer look at how the vertex and fragment shaders are generated by MaterialX - Mari has a fixed vertex shader and its own set of semantic interfaces, but it seems like those should be surmountable.
from materialx.
@mprater One interesting use case for this technology would be the ability to render MaterialX shading models directly in Mari, converting the underlying MaterialX Physically Based Shading graph into Mari GLSL/XML on demand. Shading models such as Autodesk Standard Surface and UsdPreviewSurface, which have public MaterialX definitions, would be supported automatically in Mari. And studios with their own custom shading models could simply provide MaterialX PBS graphs to Mari to enable their use in painting workflows.
from materialx.
Yes, it's definitely worth pursuing. Unfortunately, it's not anywhere near the top of my to-do list right now.
from materialx.
No problem at all, @mprater, and I'll close this issue for now. Feel free to reopen it in the future, if either your team or the Mari team at Foundry end up taking on this project, and we're happy to provide guidance.
from materialx.
Related Issues (20)
- Document adding custom nodes to MaterialXView HOT 1
- Interoperability of visual appearance between applications using MaterialX should not require knowledge of the authoring application's coordinate system conventions HOT 1
- Desktop entries and mime types for MaterialX Graph Editor and View HOT 3
- Incomplete build or build failure with support of OpenImageIO HOT 5
- Web Viewer: When loading file that contains both surfacematerial and a nodegraph with single output, only one material is displayed HOT 3
- ESSL Shader generation COMPLETE and REDUCED options under/over expose uniforms
- SUG: Make Web Viewer more known publicly HOT 3
- WebViewer: Drag+Drop of materials with image dependencies does not work
- SUG: Add limits to standard library nodes for UI HOT 2
- MaterialX Node Editor Suggestion: Handle Nodegraph Implementations in Non-Library files.
- Add API call to convert channels attributes to nodes
- Add a default value input for geomcolor HOT 4
- Attribute `space` is ignored for `viewdirection` node HOT 1
- Versioning Numerics Of Some bxdf Nodes Incompatable With USD 23.08 HOT 4
- Names defined in MaterialX documents displace library names and cause strange behavior HOT 2
- Graph Editor: Deleting a node with multiple output does not update down-nodes properly
- Update UsdUVTexture to single-output signatures in 1.39
- Add support for disabled nodes in shader generation HOT 1
- Suggestion: Add way to determine MaterialX release used for shipped library / nodes HOT 2
- Suggestion: Publish MaterialX Core Javascript package
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from materialx.