Optical Flow Port

Hi,

since I was repeatedly asked to post this somewhere, here’s the Simple 2D Optical Flow I implemented almost exclusively with fuse nodes.

OpticalFlow2D_fuse.vl (147.3 KB)

It is a port from this contribution.

I am sure there are better ways to patch it or code it as a textureFX, but it might help someone.

Best,
Tim

12 Likes

I am not sure if this is the right category or if it was more fitting in the WIP category. Let me know :)

Amazing ! love it!

1 Like

I would like to add some randomness on the particle movement on the Z axis, I can´t figure out where to add a modifier, it stays in a 2d plane…
any help?

this works with a probability emitter, so this will emit particles within a defined range randomly. Those spawned particles are then affected by the optical flow vector field. Go inside the optical flow-node. down on the x+y+z+w node is where the z value is always set to “0”

this is a pixel shader. you want a different random seed for each pixel, so you take the texture coordinates as source. the random (math) node wants integers as seed, so we multiply the texture coordinates by texture resolution. multiply x with y and take the floor, you get a unique integer seed per pixel.

then add this to another random (which will be the same for all pixels) and this as random seed.
so each frame you will get different values for all pixels.

quick way would be to use a blend mode and just blend a texture with RGBA (0,0,your Z value, 0) to the optical flow texture RGBA(x,y,0,0).

Depending on what you want to achieve you could also add a noise to the z value of the position of the particle and plug it into the sprite renderer, like so:

You can switch the noise type to change the appearance, for true randomness there is also a random noise type.
I don’t know why it didn’t work for me, but I think it should also work with a Random [Random] fuse node.

And you have to detach the ConstrainToAxis node for that!

Just trying to get this to work in V5.3 but getting lots of red nodes. Have tried with the VL.Fuse -pre but getting similar results. Would be great to get this working again, such a good patch!

I’ve ported it with string replacements in the vl files. Forgot to upload it here. Will do when back on the PC.

This should work with vvvv >= 5.0 and fuse >= 1.0.0-alpha06

OpticalFlow2D.vl (79.7 KB)

Just wondering if anyone has got this working again in the latest version of Gamma and Fuse?

Seems to just work here with 5.3-0138

3 Likes

Got the Optical Flow working sweet, but the integration with fuse that TimRu had achieved in that first example… Where particles where being generated from the optical flow… I haven’t managed to replicate it, but have found lots of replacements for red nodes, but some just don’t seem to be like for like with new versions in fuse.

Did you use the my fixed patch that I posted above?