#Iterating Through List In ShaderGraph

1 messages · Page 1 of 1 (latest)

subtle ore
#

I'm looking to make a shader where i pass it a radius float and an array of Vector3 world positions. I want the shader to use a different colour based on if the pixel is inside any of these points via the radius. Based on googling it seems i'd need a custom function node with some hlsl, I just wanted some confirmation on that approach?

mint bobcat
#

Could probably just send a texture where rbg = XYZ but then I think you might run into looping problems which you'd then use a custom method anyway

white sapphire
#

If you know the array is a set size you can probably get away with a 4x4 matrix

scenic raven
#

Shadergraph doesn't support arrays as exposed properties, but since you need a custom function node anyway, you can declare the array in the custom function HLSL reference file, and assign the values from script (like for arrays in regular .shader files)

distant grail
#

It'll look something like this

#
float4 _MyArray[16];

void test_position_float(float3 position, out bool result) {
  // do the test and assign result accordingly
}
#

(i honestly forget if you can get away with not specifying the size of the array)

#

i moved all of my stuff over to using buffers and I have no arrays left!