-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TSL 'property', using array of float or vec, or mat etc.. #30097
Comments
That's what the storage buffer is for. I use it for something like that |
I'm not familiar with the storage buffer yet, but it does not really fit the same purpose if that is a uploaded buffer. |
You can use it like this in a wgslFn
With the wgslFn you can work in wgsl raw code. This helps me a lot because I can use the W3C documentation directly. Only the binding management continues to be done by the node system, but I think that's good. |
Well I could, but this need to work for both WebGL backend and WebGPU backend in TSL |
Then I'm sorry I can't help because I only work with webgpu |
Wouldn't you be looking for const array = uniformArray( [ new Vector3( 1, 1, 1 ), new Vector3( 1, 1, 1 ), new Vector3( 1, 1, 1 ) ] );
const element = bloomTintColors.element( 0 ) |
hey @sunag ! Well, not really, this won't be data passed as uniforms since those will never change but as defines, the same way we can do : property( vec4 ), but working with array instead |
I find the uniformArray an elegant solution for this case where WebGL / WebGPU compatibility is important. In the end, the data is also in the GPU. A new node that is either converted into glsl code or into wgsl code in the backend that has also be done by the cpu first, ends up in the same result as using uniformArray, where the data is only sent to the gpu once if you don't change it. |
Well, it is just that we are able to write a property => const myproperty = property('float', 'whatever).assign( 0.5 ) This one translates into a hardcoded value in the shader and isn't a uniform or a buffer. To write an array at the moment the way it to use a uniformArray, but the actual data is purely static and does not need to be a uniform, but a sort of define |
Description
Still porting Legacy shaders into TSL, bumped into something,
Using Legacy shaders, we could replace a string in a chunk to inject =>
Using 'property' in TSL to write hardcoded float, vec, mat etc.. is available
Been looking for an example in the repo that shows support on TSL 'property' for arrays of vec, float, mat etc.. but could not find it ( unless I completely missed it )
The text was updated successfully, but these errors were encountered: