Hello all, I want to set a vertex shaders position and rotation. Im using the example provided by unity that uses the float4 structuredbuffer for position and rotation of the vertex shader… I have a set of transforms I would like to convert to a vector4 (which include position size scale and rotation) and then feed it to the shader but I am having troubles with converting a transform into a vector4/float4. I’ve looked into matrix4x4’s but then still couldnt find a way to get a vector 4 from the matrix. Any help is appreciated, thanks!

You can not represent translation, rotation and scale with a single vector4. A Vector4 just consists of 4 floating point values. Just rotation could be represented by a single Vector3 (eulerangles) or Vector4 (quaternion). Likewise just translation or scale can be represented by a Vector3. However you can not represent all 3 with a single Vector4 value. That’s why we actually use matrices. For translation, rotation and scale we need a 3x3 matrix (9 float values). Unity only provides a 4x4 matrix (16 float values).

It’s not clear what you actually want to do since what you said just can’t be done.