0

I'm in the Unity ShaderGraph and want to add displacement to my shader. I have this Voronoi setup example, which leaves me with a Vector 1 output. I can plug that into the multiply and displacement works without problem.

enter image description here

But if try that with the texture, it somehow doesn't work. I thought, that the Vector4 output doesn't work makes sense, but the R,G,B,A are all just Vector1s who shouldn't be different than the voronoi output.

What am I missing?

Bart
  • 19,692
  • 7
  • 68
  • 77
  • 1
    It's like saying "A Matrix is just numbers therefore matrix multiplication is just like multiplying every number by a scalar". If you have a Vector4, that's not compatible with a Vector1. You can split the Vector4 and work with the single values, or combine it to the required format. – kek5chen Feb 27 '23 at 11:04
  • 1
    @kek5chen Thank you for your reply. But isn't the SampleTexture2D already splitting it up? For example the R value, is a vector1. isn't it? I tried using that, and expected it to behave as the voronoi "Out" output (-which is also a vector1), but for some reason I cant use it similarily. – Marc Teuber Feb 27 '23 at 11:08
  • For what it's worth, it seems to function fine here if the connection is what doesn't work on your side. If you mean that the effect you're getting is not the same, please define what you mean by "doesn't work". – Bart Feb 27 '23 at 11:37
  • Yeah by "doesnt work" I meant that I cant connect any of the SampleTexture2D outputs to the bottom input of the multiply. – Marc Teuber Feb 27 '23 at 11:52
  • Okay, don't know what to tell you then. Here on Shadergraph 14.0.4 that seems to work as expected ... – Bart Feb 27 '23 at 11:56
  • I tried your setup in my project (Unity 2021.3.19) and I can connect both the Voronoi and the texture output to the multiply node. Since you said Vector 1, I suspect that you may be using an older version of Unity. Vector 1 has been changed to Float. Maybe it's about your version. – Doruk Feb 27 '23 at 12:03
  • My version is 2021.3.18f1, so I dont quite think its that. What I forgot to mention is, that this is based on the "HDRP | Fabric | Cotton Wool " Shadergraph. Maybe that is significant – Marc Teuber Feb 27 '23 at 12:19
  • Yeah, that's strange. It should work. Try rebooting? Lol – Louis Ingenthron Feb 27 '23 at 17:48

1 Answers1

0

"Sample Texture 2D" is a pixel shader node and can not be used for the vertex output. "Sample Texture 2D LOD" node will work instead.

I wish they had a clear indication of why it won't connect. Original solution was found here.

halfer
  • 19,824
  • 17
  • 99
  • 186
Serj Zaharchenko
  • 2,621
  • 1
  • 17
  • 20