You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With a dataTexture you can store all vertices so that you have access to all vertices in the shader. With WebGPU, however, it is more desirable to handle this in a more direct and modern way. The storage node can be used to store the vertex data in a buffer. This is done in the WebGPU particle examples. I'm looking in the webgpu backend/nodes/utils how I can now access it in the vertex shader. The vertexIndex node is very useful. What I haven't found yet is an equivalent to:
@group(0) @binding(0) var<storage, read> vertexData: array<f32>; // position
This is what I use here in my native webgpu code example:
so we will certainly be able to retrieve the vertex data in the shader more elegantly with .xyz for the respective vertex index.
Provided we can currently access the storage buffer in the vertex shader with wgslFn and tslFn, and I'm not sure if that's possible. If not, this would be a desirable expansion as this topic is also important for DrawIndirect topics in the future
Solution
The solution would be a three.js analogue to what I do in my CodePen example.
Store the geometry attribute arrays in a storageBuffer and make them accessible in the vertex shader
Alternatives
This is currently possible by storing the attributeArrays in dataTextures. Therefore the label “Enhancement” would be suitable here
Additional context
P.S. It works with tsl. Apparently not with wgslFn. It would be nice to have that for wgslFn too but it's not urgent
The text was updated successfully, but these errors were encountered:
Description
With a dataTexture you can store all vertices so that you have access to all vertices in the shader. With WebGPU, however, it is more desirable to handle this in a more direct and modern way. The storage node can be used to store the vertex data in a buffer. This is done in the WebGPU particle examples. I'm looking in the webgpu backend/nodes/utils how I can now access it in the vertex shader. The vertexIndex node is very useful. What I haven't found yet is an equivalent to:
This is what I use here in my native webgpu code example:
https://codepen.io/Spiri0/pen/poXBpdy
With three.js we can store the data in vec3 type:
so we will certainly be able to retrieve the vertex data in the shader more elegantly with .xyz for the respective vertex index.
Provided we can currently access the storage buffer in the vertex shader with wgslFn and tslFn, and I'm not sure if that's possible. If not, this would be a desirable expansion as this topic is also important for DrawIndirect topics in the future
Solution
The solution would be a three.js analogue to what I do in my CodePen example.
Store the geometry attribute arrays in a storageBuffer and make them accessible in the vertex shader
Alternatives
This is currently possible by storing the attributeArrays in dataTextures. Therefore the label “Enhancement” would be suitable here
Additional context
P.S. It works with tsl. Apparently not with wgslFn. It would be nice to have that for wgslFn too but it's not urgent
The text was updated successfully, but these errors were encountered: