Custom SubGraph default parameter

I have created a subgraph that, among other ones, takes a Vector2 as a parameter meant for UV input. But quite often that parameter is left assigned to a UV0 node that I create. Is there a way to make the subgraph’s parameter by default to be assigned to a UV0 the way this is done with SameplTexture2D or TilingAndOffset nodes?

This is what I have now:

And this is what I would like to have:

Found out it is called Port Binding but still did not get how to apply it.

This is not currently supported but it’s a feature request we know about and want to work on in the future.

2 Likes

+1 for this request!

It’d be pretty cool to be able to mark Vector2 inputs as a UV channel by default

Roadmap says its released on 2021 LTS, but I don’t see any option to set default values.
How to set default values? Using 2022.2.0b8.

https://portal.productboard.com/unity/1-unity-platform-rendering-visual-effects/c/58-default-values-for-subgraph-inputs?utm_medium=social&utm_source=portal_share

Hey, we would love to use this feature, but aren’t sure how to? Is it actually released?

Edit: Currently when building a Subgraph with a custom UV you provide as a SubGraph-Parameter the preview inside of ShaderGraph is completely unusable, because the UV is always 0,0 for every pixel.
This makes SubGraphs really hard to debug as soon as you want to use anything but the default UV as input.

1 Like

In case it helps anyone, here’s how you can set the default for an input port on a sub-graph in Shader Graph when there’s nothing connected.

The image below shows how to use the Branch On Input Connection node.
You simply pass the input node → both the input and Connected ports, and set NotConnected to your default.

In my case I want the default to be centered UVs for a custom Circle SDF node.

So without anything connected to UVs it correctly shows the default centered UVs.
The default label also displays.

If I actually connect to the uv port, we know it’s now taking the non-centered UV that’s connected.

3 Likes

my input(p) node would not connect to anything

9489415--1335502--upload_2023-11-23_18-24-13.png

Unity 2022.3.0 - BuildInRP

1 Like

I just found that i should enable Custom Binding for the Input

obviously i didn’t quite pay attention to the Mirza’s post :slight_smile:

4 Likes