Here is what I manage to build there are probably some ways to refactor this even better, maybe optimise it even more. Anyway big thanks to @torinos for his example and @tonfilm for his tips on how to use a SpreadBuilder.
What is the relation between the amount of emitter’s position and the ElementCount on the BufferResourceHandler ? Does the ElementCount has to be at least the same or bigger ?
Also not related directly to FUSE I guess but it seems that the OnOpen node doesn’t trigger correctly when a scene is loading (an heavy one). How is it possible to cache on startup then ? as to build the Index buffer from a large mesh and large spread needs it.
The ElementCount of the BufferResourceHandler is the number of times the program will be executed per frame in the Compute Shader, which is also the maximum number of particles that can exist in the scene.
This also means that each DispatchThreadIdX node will be assigned an individual sequential id 0 to ElementCount-1, meaning that if this is less than the amount of emitter’s position, there will be elements that are not referenced by the emitter.
However, by generating an appropriate random value seeded with id and time, you can set ElementCount to just enough particles for you, regardless of the number of elements in the input. This, I believe, avoids flattening out duplicate Buffer elements and the need to build a large array of Indexes for that matter.
This is a problem with the Fuse node. Inside this Random node, a random number is always generated as a float in the range of 0.0 to 1.0, cast to the desired type, and then mapped to the range of min to max. If it is specified as an integer, it will be cast to 0 if it is less than 1 value. It is necessary to generate the random number with a float.
Hi. I’ve tryed to check an example from the topic. And after fixes spread of integer to buffer(in the screenshoot) everething works. But after restarting the document or changes a spread count, particles starts to spawn from axis center. Do you have any idea how can i fix it?