🧵#MaterialX sample
Hello, we will look into this asap. Thanks for the headsup.
<@1470207245663867074> the sample was simply outdated. Sorry about that. We'll have a new deployment + new sample scene ready today for you to try.
That being said: MaterialX just works as documented here https://engine.needle.tools/docs/how-to-guides/export/materialx.html when using ShaderGraph materials. Just the sample deployment wasn't using the ShaderGraph features yet.
Thank you for the quick check! I’ll look forward to the new sample.
To be honest, I thought it might be my browser settings because I was getting a similar "white-out" issue when exporting a simple URP Lit shader in Unity 6.
I will organize the details of my situation and ask about that separately later.
Once the sample is updated, I’ll check if it displays correctly on my end and let you know. Thanks again!
To be honest, I thought it might be my browser settings because I was getting a similar "white-out" issue when exporting a simple URP Lit shader in Unity 6. Did you get any error in Unity? by white-out you mean it was not rendering? Did you install the MaterialX npmdef package in your web project?
Just updated the website sample - an update to the samples package for Unity will come later
https://materialx-zubckswjke1.needle.run/ (+ https://engine.needle.tools/samples/material-x)
Hi <@1470207245663867074> please try the sample URL linked above (it shoud look like the screenshot) - a new samples package has been released as well
Let me know if you still face issues in Unity 6000
Thank you for updating the website sample! I confirmed it now displays beautifully in Chrome, Edge, and iOS Safari. MaterialX looks stunning.
However, my own project still renders as a flat white material. I have attached a comprehensive screenshot of my current setup using an extremely simple shader to help diagnose the issue.
Here is my current status:
Packages: I have re-installed all npm packages, including @needle-tools/materialx, in the web project folder from the VS Code terminal.
Setup: I am using Unity 6 (6000.0.x). I've added the MaterialX npmdef to the dependencies in the ExportInfo component.
Result: The shape of the cube renders correctly, but the color is completely flat white (as seen in the browser screenshot).
Could you please check the attached screenshot and let me know if there are any missing settings or known issues with Unity 6 + MaterialX exports?
Thanks in advance!
Thanks for the new sample URL and the package release! I'll test them out later today and report back to you on how they work.
Good morning, thanks for the comprehensive feedback. One thing i notice in your screenshot is the react template and my suspicion is that this is the reason you dont see your shader right now. In the current version of Needle Engine we have a vite plugin that is injecting code to register our MaterialX loader to the engine and i believe this is what's not working correctly here. For testing could you try adding these lines in your web project in global scope:
import { useNeedleMaterialX } from "@needle-tools/materialx/needle";
useNeedleMaterialX();
I will further test this later but hope this will unblock you right away.
Good morning!
I added the lines you suggested, and it worked! The simple URP Lit color is now rendering correctly (you can see the green cube in my latest test). Thank you so much for the precise advice, it's a huge relief!
Now I’m going to test the updated sample to see if I can reproduce it on my end. I noticed a glTF-related error when I first imported it, so I’ll update everything to the latest version and try again.
Your support has been incredibly helpful. I really appreciate it!
Happy to help and glad it worked! Let me know if you encounter any other problems or errors.
Hello <@1470207245663867074> just wanted to let you know that Needle Engine 4.13.0 added MaterialX support to it's core. So it shouldnt be necessary anymore to call any special function - Needle Engine will just detect the materiax data and load it automatically
Additionally we also have a few fixes and improvements for some ShaderGraph features in the works that should be included in one of the next versions - not sure if you have encountered any of these issues yet 🙂 Either way if you have any feedback please let me know and I'll try to take it into account for the next version.
Sorry for the late reply! Yesterday was a public holiday in Japan, so I was away from my desk.
Thank you for the update! I’ve confirmed that scenes now export correctly without adding those extra lines. I really appreciate your quick response.
I’m now trying to export some existing shaders to share them across different projects, but I’m seeing some warnings and errors. I suspect it’s a compatibility issue with certain shader nodes. Do I need to adjust my Shader Graph to better fit Needle Engine’s requirements?
Even with the warnings, some shaders seem to look quite close to how they appear in Unity. I cannot share the visual result due to confidentiality, but I’ve attached the warning logs for your reference.
Could you please take a look at the logs? Thank you!
Regarding the warnings and errors I mentioned, I’ve extracted the key issues from my logs. It seems several Shader Graph nodes are currently unsupported in the MaterialX export.
Unsupported Nodes:
Unknown node: UnityEditor.ShaderGraph.ViewVectorNode
Unknown node: UnityEditor.ShaderGraph.CameraNode
Unknown node: UnityEditor.ShaderGraph.MetalReflectanceNode
Could not create MaterialX element for ViewVectorNode / CameraNode
Ignored Properties & Space Issues:
Property is unknown or not implemented and will be ignored: SurfaceDescription.Occlusion
Property is unknown or not implemented and will be ignored: SurfaceDescription.Specular
For geometry attribute "viewdirection", the space "Tangent" is currently not supported (defaulting to model/object space).
Since some of my shaders rely on these nodes, could you let me know if there are planned updates for these, or if I should adjust my graphs to use alternative nodes?
Thank you for your help!
Hi there! Thanks for the feedback.
There are some nodes that don't map nicely to MaterialX's way of describing the world, so we either have approximations in place or skip them. And some groups of nodes (e.g. everything that is view-dependant or non-realistic) only got added to the MaterialX spec recently, so we might not fully support them yet.
And others that just conceptually don't exist in MaterialX and you need to replace:
- for example, the "ViewVectorNode" does not exist at all. But instead, there is a "facing" node in MaterialX, which you can leverage by using the Fresnel nodes within Shader Graph.
- "CameraNode" we should be able to support at least partially (extracting position or rotation), I'll take a look
- "MetalReflectanceNode" I have to take a look, honestly never used that one in Unity, can you send an reproduction shader that uses it?
- Can you also send an reproduction shader that reproduces the viewdirection/Tangent message?
Happy to answer more questions – ideally if you can send small example/reproduction shaders we can take a look and make more cases work, in the realm of possibility with MaterialX.
Thanks!
Thank you for the detailed explanation! Conceptually replacing ViewVector with Fresnel nodes makes sense, and I’ll look into adjusting my graphs.
To help with the other nodes, I’ve prepared a reproduction package (attached). Since my original project contains confidential assets, I have created a simplified version for testing.
This package includes:
A dummy object and a cropped texture.
A simple shader graph using the Metal Reflectance node.
A shader graph that reproduces the viewdirection / Tangent space warning.
Please use these files to investigate how these nodes could be mapped to MaterialX or if there are any potential improvements for future versions.
I hope this helps! Looking forward to your feedback.
Hey, thanks, this helps a lot! I can reproduce the warnings you mentioned.
I'd say the shader doesn't look perfect but relatively close in Needle Engine – would you mind telling me what's the difference that annoys you the most? (likely more visible on your actual meshes than on my shaderball here)
Oh and by the way, as part of Enterprise licenses we do have SLAs that cover things like this (looking into why things might not look right, or fixing bugs with the exporter, etc.) – just so you know 🙂