URP : Shader Graph : Cannot connect an Add (3) node to Vertex Position (3) Master Node

Hello, I am using Unity 2021.2.3f1 and using URP. In Shader Graph, I cannot connect the output of an Add Node (3) to the Vertex Position (3) in the Master Node. Can you tell me what I done wrong ? Thanks a lot.

What is before multiply node? Certain nodes are not supported in vertex stage and will prevent you from connecting to vertex node.

1 Like

Hi, here what is before the multiply. The only weed thing it did was to construct a vector3 from a float…

Try and use Sample Texture 2D LOD node?

1 Like

Ok, I did a test that demonstrate the bug… The graph doesn’t want to connect a float from a TextureSampler (let’s say Alpha, but it doesn’t matter, R, G, B does not work either). But a simple float from the Shader’s Input works… I don’t understand:

@Simon_E_Sorensen : Thanks, a Texture2D LOD works. But, my point here is : Don’t fail silently, if the graph cannot connect tell us why. Because it is frustrating to see the color of the port to be the same, the type to be the same and cannot connect… Thanks again…

4 Likes

Yes, I’d like to know why this is also. Just playing with packing height into texture albedo alpha and boom won’t connect.

lol

1 Like

I second this. Spent way too long trying to resolve an issue that looked more like an editor bug than an actual one.

“This Node is useful for sampling a Texture in the vertex Shader Stage as the Sample Texture 2D Node is unavailable in this Shader Stage.”
That’s what I found on the description of this node.

Vertex Shader Stage is happening before Fragment one and not all nodes are possible to connect there.

The solution I came up with for this was to use a CustomFunction node. The inputs are a Bare Texture 2D, a Bare Sampler State and a Vector 2. The output is a Vector 3.

void VertexTextureSample_float(
    Texture2D tex,
    SamplerState texSampler,
    float2 uv,
    out float3 result)
{ 
    result = tex.SampleLevel(texSampler, uv, 0).rgb;
}
2 Likes