Does Shader graphs actually work?

I’m testing needle features with a simple project, but got stuck when trying to use very simple shader graph, as you can see in the image I’m using it in a cube and also the ground, but (on the right side) the end result just renders both objects with the default material apparently (I’m guessing that the white is there because of the default material being applied).
My Unity version is 2022.3.4f1 (LTD), the shader itself is an unlit and I’m using the Build-in Render Pipeline.
Am I missing something?

Original Post on Discord

by user 368204675922657280

Hi is the material or shader marked with ExportShader ?

Another thing that you can try is downloading/installing the Needle Engine samples, particularly the custom shader scenes

You have probably seen it, that’s the scene built with shader graph Needle Engine Samples

If it’s not working still let us know and let us know which needle engine versions you’re using too. Thanks

Hi! Thanks for the answer!
What do you mean by “marked”? AssetLabels? Tags? Layers? How do i know if needle is exporting them? (I’m saying this because from what i know, it only re-exports when there are changes in the hierarchy).
Regarding the Samples, i downloaded the samples via package manager and then proceeded to start a local server from the sample scene that you mentioned, yet all meshes appear black :classyblobthink:

My Needle-Engine version is 3.7.5-pre. Regardless i think that these details should appear in the docs or in a video, it would be nice if there was a step by step video for setting up shader exports correctly.

by user 368204675922657280

Docs about shaders/custom shaders are here. Exporting Assets to glTF | Needle Engine Documentation I meant Asset tags

Appear black: that sounds not good - Will open an issue

Thanks for the replies! ill be checking out to see if i can make it work

by user 368204675922657280

Hey, did you get it to work? :slightly_smiling_face:

Yes! I added the ExportShader asset label, close and open Unity again, it throws me a couple of errors but from the typescript code (apparently it does not get rid of previously serialized properties if i delete them after).
The sample scene looks like it works, but the color still appears black, no change on that. Hope this helps someone!


by user 368204675922657280

Can you explain what you mean by apparently it does not get rid of previously serialized properties if i delete them after ?

And can you share the errors that you’re getting?

About the errors:
I had something like this:

export class Player extends Behaviour{
    @serializable()
    anims? : Animator;
    @serializable()
    bullet? : AssetReference;
    //Start function and everything else...
}

Then the errors where:
Missing Serialization for object reference! x2 (one for each property)

After that i did this:

export class Player extends Behaviour{
    @serializable(Animator)
    anims? : Animator;
    @serializable(AssetReference)
    bullet? : AssetReference;
    //The rest of the code...
}

And it solved the reference issues. Now the thing is:
Lets say i don’t want the “anims” property to be serialized anymore, so i just get rid of the “@serializable(Animator)” declaration, but it still appears in the inspector.
Is there a way to hide it to avoid any confusion regarding the references?
image.png

by user 368204675922657280

Nevermind, i found that “private” keyword is also a thing in typescript! :gentleblob:

by user 368204675922657280

you can:

  • make the field private
  • mark it with // @nonSerialized as a comment in the line above you can find the component compiler options in the docs

Ah yes private :slightly_smiling_face:

Hey :wave: It seems that on 2022.3.4f1 using built-in render pipeline results in non functioning custom shaders. If you are able to, please use URP

It works as expected in 2021.3.28 with BiRP too. Going to try with 2022 now

I built a shader like in your example above and it doesnt reproduce here in 2022.3.4 - do you think you can send us the scene with the bugreporter? (Needle Engine / Report a bug)