Forum

Emit from cloud of triangle's center

Hi,

following this post here : Emit particle from center of triangle

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.

ModelTriangleCenterEmitter.zip (658.5 KB)

Two questions :

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.

About on open guess you should trigger from project loading completed…

Not sure with FUSE part, but for increasing loading times would serialise as binary and read as binary basically dump…

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.

2 Likes

Ok thanks, I have it working now.

Only the left part was emitting if I use DisplatchThreadIDX.

Now replacing DisplatchThreadIDX. as you mentioned by Random does work
ModelTriangleCenterEmitter.zip (660.8 KB)

Why it has to be a Random Float32 instead of Integer32 ? as Index are always Integer as far as I know

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.

2 Likes

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?
ModelTriangleCenterEmitter-BufferOfTriangleCenter_2022.05.03-18.03.47

One issue on the Fuse side is that it appears that references to the buffers re-created by the Spread update are not being updated by the if regions inside the ProbabilityEmitter node.

I think if we enclose the particle nodes in an if region to prevent those references from being set before the model has finished loading, the restart will work.


ModelTriangleCenterEmitter_0505.zip (675.8 KB)

Great! Now it works. Thanks for advice!