Particle systems + custom vector field + FUSE

Hello guys!
I’m moving my first steps in the fuse library world… and I would like to ask you an advice :)

I would like to simulate a black hole behavior on particles system in a 3D world and I’m wondering which is the most efficient (and working) way to do it.

My particles should have this behavior:

The image is taken from a processing sketch I’ve created as a first simulation prototype.
Basically it shows a particle system immersed in a bidimensional vector field where each arrow (force vector) is the result of two main contributions (the black hole attractor and the accretion disk rotation around it).

The arrows represent the force vectors with a particular direction and length (magnitude) according to the position in space (2D plane) we are examining.
The vectors all point toward the center of the attractor (black hole) with an intensity that is inversely proportional to the square of the distance from it (basic gravitation simulation here for the moment).
In addition, these vectors are deflected by the rotational contribution of the accretion disk near the contour of the black hole.

Particles moving in this space are affected by these vectors according to their position (and will change their acceleration, velocity and position accordingly).

Looking at the fuse library, I think that the best way to reproduce this behavior is to calculate all of the forces of the force field in advance for every 3D space tasselation element (let’s say I will divide the entire 3D space in a fixed number of little 3D cubes, where the center of each represents the point of application of the force vector).

Then I can apply this calculated force to the particles system using the Force [Fuse.Particles.Force] node, according to the Position (Particle) [Fuse.Particles.Attribute] of each particle.
I think this approach, at least for my way of thinking, may be better for me, and that’s why I have excluded:

  • 3DFluids that have different behaviours from the ones I need;
  • to use different force nodes and attractors on the particle system (like ConformToSphere and directional forces, for example) because It seems to me using them I should have used a different approach to the problem.

Does my plan makes any sense to you?
What are the VVVV nodes I should start working on in order to implement my ideas?

What do you think?
Thanks a lot fro any support and suggestions
bests

1 Like

if you are fine with a 2d vector field then have a look at this. I don’t know if there is an implementation for 3d textures already.

this post . fuse has an optical flow vector field node which should exactly do what you want. you do not have to use it with the fluid sim, you can use it with any gpu particles.

just bake your vectorfield to texture (or generate it dynamically), then feed it into the optical flow vector field node and use this to modify emitted particles.

Thanks for the answer @schlonzo, but I would like to work in 3D world.

I’ve done some tests, and something is happening:

I’m applying two forces to the particle system:

  1. the node Target force (the black hole center)
  2. the node Force (the tangential force), that should be activated only when a particle is inside the accreditation disk (the spherical area around the black hole)

Let’s say I want to apply the tangential force only on particles that are inside the accreditation disk, and I also want to kill the particle that enter in the black hole center.

The problem is that i’m not able to compare the particle attributes (position, lifetime, …) with the spheres coordinates and dimensions. I’ve tried to convert the Particle Position attribute (a GpuValue - vector3 value) into vector3 value using the node TypeVector3.

What am I doing wrong?

Please find the patch attached.

Test18_using force target (blackHole)+centripetal force- forum.vl (95.2 KB)

Thank you so much for your support!

Hi there,

your patch is not working for me. I think there are subpatches and assets missing. Tooltips also not working and exceptions popping up… check if the particle is inside a sphere like this:

step(sphereRadius, distance(particle, sphereCenter) )

this will be 1 if the particle is outside, and 0 if it is inside. you can use this as a conditional, and multiply stuff with it. I did not find a kill particles node, but if there is one, you can do the same to kill them in the center.

have a look at the HLSL documentation to find out what those “math” nodes are doing.
smoothstep is your friend!

1 Like

@schlonzo I’ve started making some experiment with shaders in GLSL language (I used Processing as the first step for prototyping, taking inspiration from some interesting ShaderToy shader)

Now I would like to port the color shader I’ve created inside VVVV.
It seems to me there’s no way of simply import the .glsl file in a VVVV patch. Instead I have to rewrite the shader in the SDSL language (which is the shading language used by Gamma). Is it correct?

Could you suggest me some resources where I can study the syntax of SDSL applied to practical use inside Gamma?

Online I’ve found the Stride documentation but it seems to me to be quite obscure because I’m not able to see a practical application of it inside Gamma.

At the moment I was able to create a very simple shader (creating a file with termination _TextureFX.sdsl inside a subfolder called shader next to the .vl patch).

The problem for me now is figuring out how to implement, for example, uniforms so that I can have shader inlets exposed on the vl patch side.

Thank you so much for you help

correct. basically it’s HLSL but stride implements some convenience functions via the SDSL superset. It makes setting up dataflow between shader stages easier. And other stuff.

greybook:
https://thegraybook.vvvv.org/reference/libraries/3d/shaders.html?q=shader

You have to strictly follow those naming conventions. Watch out: Pins on nodes will just show if the variable is used within your code! There should also be a video in the workshops from the last NODE. they are public but I don’t know where.

I also recommend Tebjans Shader Explorer. It’s explained in the workshop.

1 Like


Hello Moscardo, I can not read your patch (I was having the same problem). COuld you send the correct one? Thanks

ok thansk

is hard to read. can u send it again?