Hello, I am writing a WGSL shader where I utilize some vertex buffers. So far, I have been setting the float vertex buffers using Mesh.setVerticesData()
. However, the method only accepts floats and not integers. I have a use case for associating an integer with each vertex and accessing those data in the vertex shader. Is there a way to do this? If not, would it be possible to implement such a feature or is there a WebGPU limitation?
Hello!
It accepts BABYLON.FloatArray
export type FloatArray = number[] | Float32Array;
so you can use integers. Even in Float32Array
you can use integers. Just cast it i32(value)
.
Thanks! I will try this shortly.
You can create a VertexBuffer
and call setVerticesBuffer
:
2 Likes