Optical Flow Port


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.



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!