Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Need the positions to drive VFX graph
#1


Hi, I'm very close to achieve greatness  Gran sonrisa
The target: I want just the positions that the ObiParticleRenderer script is getting to render those spheres.
If I go to the solver and get the positions, the result is all the positions of particle in the solver, including non-active particles.
Which explains the bad effect in the video, we have many particles that just lying around.

Unity 2022.3.16f1 URP14, VFX graphs + samples installed.
Script and scene in this package: https://drive.google.com/file/d/1mmDuFSi...sp=sharing
Scene: Assets/Spike/Scenes/FireBreath VFX and Fluid.unity
Script: ObiVFXRenderer.cs

The script will set positions buffer to VFX graph through GraphicsBuffer, since there is no computation here, so no ComputeShader is needed.
All it need is correct positions that are same as the ObiParticleRenderer is using to render the spheres.
If this is doable, then I can have fireBreath effect that can collide with environment and damage character using Obi collisions.
The fire effect should match the particle 100%, so I can't use advection.
Reply
#2
Hi!

The indices of the particles belonging to a specific actor are stored in the actor.solverIndices array (since there may be more than 1 actor per solver). You can iterate this array up to actor.activeParticleCount to process active particles only. See:
http://obi.virtualmethodstudio.com/manua...icles.html
Reply
#3
(14-05-2024, 12:06 PM)josemendez Wrote: Hi!

The indices of the particles belonging to a specific actor are stored in the actor.solverIndices array (since there may be more than 1 actor per solver). You can iterate this array up to actor.activeParticleCount to process active particles only. See:
http://obi.virtualmethodstudio.com/manua...icles.html


Thanks to your pointer, the positions are synced, but now I notice I have to sync the remaining lifetime for this to work, but we don't have that data haha.
Reply
#4
(14-05-2024, 02:19 PM)spikebor Wrote: Thanks to your pointer, the positions are synced, but now I notice I have to sync the remaining lifetime for this to work, but we don't have that data haha.

In Obi 7, the solver.life array contains particle remaining lifetime (in seconds). You can access these just like you access positions.
Reply
#5
(16-05-2024, 01:32 PM)josemendez Wrote: In Obi 7, the solver.life array contains particle remaining lifetime (in seconds). You can access these just like you access positions.




The functionality is perfect, with my terrible writing skill (I release and rewrite the pos and life Buffer everyframe(!?)) yet it still looks like it does not take any performance hit!
Almost feel like magic. Let me know if you want to look into this setup and perfect the function into something to ship with ObiFluid, I name this ObiVFXRenderer.
Reply