Pass float3 to ComputeShader

Hey everyone!

I guess there’s no way to do this, since the docs don’t include this, but still: Can I pass float3 to ComputeShaders somehow?

Best wishes,
Shu

You have to set a Vector4 instead using ComputeShader.SetVector. The variable can still be a float4 (or float2) in the compute shader, though. The rest just gets ignored.

1 Like

I see. Thanks for clarifying! I just though about possibly populating a float3 array using Jobs and Burst, then pass that data to GPU, but I guess I need to convert to Vector4 and pass Vector4 back to float3 on GPU.