I'm trying to figure out how setfloats works for compute shaders. I have a shader constant like this: Code (C#): float3 _SizeData : register(u1); //x is the heightscale, or the maximum height possible. y is the gridscale, or the space between each grid position. z is the mip level, the amount of pixels skiped for each pixel calculated. Do I just make an array and pass it like this? Code (CSharp): float[] sizeData = new float[3] { HeightScale, GridSize, MipLevel }; MapCalculator.SetFloats("_SizeData", sizeData); The docs aren't very clear, and I can't seem to get this to work properly.
Pretty sure you want to do: Code (csharp): yourMaterial.SetVector("_SizeData", new Vector3(HeightScale, GridSize, MipLevel); IIRC SetVector handles non Vector4 sizes (if not new up a Vec4 and just leave w 0).
I passed it in as an array, and it seems to be working fine. The method I originally gave works, not the one you provided. Hopefully someone in the future will find this thread help. Thanks for the reply.