How to pass multiple values to shader?

Hi,

I aready know how to pass floats to shaders via modifying materials with code.
But what if i’ve got multiple floats i need to pass to my shader? f.ex. a list of player positions. How can i do that?

If it’s 1 player, do the same using float3 instead of float.
If you have a max of 4 players, just add 4 values and set the float3 to some value not visible.

Don’t think shader graph has any support for structured buffers

As @DevDunk said there is no support, however if you use custom node it would be possible to sample buffer or array and return calculated value. The thing is the loop must be inside custom node what is rather inconvenient, but still better than writing whole shader from scratch.

1 Like