Comparing previous frame to current frame in Geometry Nodes

I’m not sure if this is the right place to ask, but here goes. In my various experiments with trying to perfect NPR rendering, one thing that I’ve found helped a lot was adding fairly large subtle noise displacement to my characters. This then gets randomized every keyframe to mimic the appearance of a 2D artist redrawing the character and remove the perfect on-model look of 3D.

What I’d like is a way to compare the geometry of the character on the current frame to the previous one, and if there are any changes then a number ticks up, as I only want the noise to change if the character is moving. I’d then plug this into the W slider of the noise texture. I have been doing it manually, but I’d rather find a way to automate it.

I assume if it’s possible, simulation nodes would be the answer, but I’ve never used them at all so I wouldn’t even know where to start. Does this sound possible at all?

1 Like

Hello !

Yeah simulation node is the only way to do that…
One way of doing it is to look into building a motion vector map, basically by subtracting the actual point position from the previous position.
Then you know how much a vertex has moved between frames.

On top of that you can use that to make some smears and probably other interesting effects.

But there might be an even simpler way of doing what you want with simulations…
I’m super interested in seeing the results you’ll get with that effect ! feel free to poke me if you manage something !

Do you know of any tutorials that cover that?

So this was from a test I did a few months ago. At first everything was looking way too perfect, but then when I added the noise displacement I got some decent results. Hopefully next time I can make it better and have it be automated.

1 Like

Why building by yourself, isn’t this what the speed vector pass is for (or did you mean this ) ?

VectorPAss

But it’s a bit tricky to read the data …see Docs-Blender Manual: Render → Layer → Passes

Vector
Motion vectors for the Vector Blur node. The four components consist of 2D vectors giving the motion towards the next and previous frame position in pixel space.

So i tried (already long ago) something like this…

…to visualize this… but actually :sweat_smile: i don’t really know if this works… i alwasy get weird results… It seems there has to be some range conversion to be done… ??

2 Likes

Hey ! these are amazing results already ! For the most part it’s hard to tell that it’s 3D IMO…

I didn’t find a tutorial about the motion vector generation, it’s not that difficult , the trickiest part for you is probably figuring out simulation nodes.

You can try that which should work or at least be close to the final graph…


Keep in mind tho, that this will only work if your geometry is deformed, if you parented it to the armature it won’t work as it will consider the geometry static.

I’m now super interested to see how that will work on your shot, and furthermore , is there any place where you share bits of information about your workflow ? I find your NPR shading pretty cool…

Well, yeah it’s a bit similar, but the motion vector pass could be helpful if the goal is to work in compositing. Here the idea is to animate a 3D displace when the character is moving.
But yeah there is probably a way to make exactly the same thing in post. That said I would go with the 3D method for that particular case.

Yeah that pass is basically the 2D motion of a pixel from one frame to the other, in pixel unit.
So even on subtle motion it’s common to get values that are higher that 1 ( one pixel) and/or negative values.
Since you save that info in .png a lot of that is lost.
Indeed running that through a map range node might help to get something a bit more visible…
anyway, you can watch a bit of what it’s supposed to look like here :
https://www.steakunderwater.com/VFXPedia/96.0.243.189/indexdd3a.html?title=FAQ/Using_Motion_Vector_Passes
If you really like green and red you should find that particularly amazing…

1 Like

I honestly hadn’t even considered the motion vector pass for anything, since I don’t think I’ve used it since the Blender Internal days. It might be useful for some smear frame effects.

Thanks so much! That seems to do exactly what I need. The only change I had to make was to add a math multiply node, and then plug it into the noise texture’s W input, and the noise is now random on every frame with animation.

1 Like

Great !!

I’m not sure it would make that of a difference but you can try putting a vector math length node before the multiply, this would probably avoid some corner case situations…

Any chances to share some animated renders with the setup ?

Yes indeed… for motion blur… i just yet discovered the fitting the Docs-Blender Manual: Composition → Filter → Vectorblur – node which directly uses this “double 2D-vector”:sweat_smile:

I will once I’ve integrated it into my characters and found the best settings for everything.

1 Like