UE4's <Flip Book Motion Vector> Material Function works well?(Image Fixed)

Im not quite sure about the specific texture format in unreal but i get that exact same diagonal motion in my vectors if i save it with the wrong compression type. (using cryengine) Our textures need to be 16bit uncompressed for it to work. (R16G16) Standard compressed 8bit will give me that broken result.

Hello ! thanks for the reply !

I tried every compression settings, it doesnt work. Strangely if I unplug the texture from the material function. It behave exactly the same. Tried to import from exr, tiff…

When I look at the forward motion vectors output, I got the exact same stuttering motion. :cry:

In the pic with your shader graph, the motion vector texture looks too bright. Is your empty space between frames set at 128,128,0? Anything other than 128,128,0 corresponds with a direction, depending on if it is brighter or darker than the neutral 128,128,0. (brighter goes one way, darker goes the other) It looks correct in the slate preview window. Is there some sort of gamma correction happening on the texture? It should be linear with no gamma correction.

Finally I got it working here. Short tutorial:

  1. Nothing special to do in Slate!
  2. Double-Click Flipboard-Node and fix the Bias Scale like described in the first post!
  3. Instead of using the “Shader Estimate” from Slate as “Motion Vector Intensity” in Unreal, use the “Current Minimum”. I didn’t do this and then my Vectors where moving into the wrong direction.

Here you see how it looks when I use the correct (negative) motion vector value:

And this is how it looks with a positive value instead:

5 Likes

I create a little Tutorial about the whole process.

6 Likes

from playing with this it seems like this works really well when the time is being scaled by factors of .1 or less. But if you go above this, it starts to break. Have you been able to find a solution for that?

Yes, this makes sense. What that math is attempting to do is change the output range of the texture from it’s default of 0 to 1, to a directional range of -1 to 1.

If you run through the math on the outer bounds, this is what it was doing before:
min = 0 + .5
= .5 * 2
= 1

max = 1 + .5
=1.5 * 2
=3

So the output range from this would be 1 to 3… not correct.

with your correction:
min = 0 - .5
= -.5 * 2
= -1

max = 1 - .5
= .5 * 2
=1

Output range of -1 to 1. Bingo.

3 Likes

Sorry bit late to the party. Found another bug with this Material Function: it doesn’t seem to handle that number of rows is not the same as number of columns. You get some strange jittering between frames.

Didn’t have time yet to fix it. But just wanted to drop that here in case others tear their hair out after following all of these super helpful tips, and still having problems. (Like I did)

Also thanks for this thread. It really helped me out!

2 Likes

Just a caution to anyone doing this. I swear, every time I go to cobble together a vector flow shader I somehow forget to linearize the color for the vectors in the texture itself. You can easily talk yourself into thinking “it looks better than it did.” when it’s “kinda blending”

It should work flawlessly. If you set your distortion strength to something sorta high and the entire image goes swimming away diagonally…that’s a sign that you forgot to linearize your color and therefore half-white is not centered. (or its a sign you forgot to center something somewhere in the vector)

This message brought to you by the words “kinda” and “sorta”

1 Like

Do you mean before you import your texture into Unreal, or unchecking sRGB in the texture settings in the engine?

1 Like

In unreal, unchecking the sRGB flag.
Not all of us are working in unreal. I forget what you do in Unity.

1 Like

Gotcha, thank you! I usually set my compressing setting (in Unreal) to VectorDisplacementmap and then adjust my Maximum Texture Size as needed when I’m doing flowmap stuff. Gives great results for me. I can’t remember if that setting auto uncheckes sRGB or not

Just a reminder that one of those constant bias in the function is wrong and needs to match the other ones to get the proper motion, Don’t know why unreal hasnt fixed it yet.

That intensity is a big problem if you dont get it right too.

Edit: Simon covered it.

It’s a great find and a simple fix. Have you tried making a pull request on GitHub?

1 Like

Hi, I wanted to revive this thread and ask if anyone has used the most recent version of Slate? The video that @simonschreibt made is on an older version and the UI has changed significantly. I’ve gotten OFLOW maps out of slate but the results have been very poor on 4x4 textures.

Where’s that simple fix? i’m not finding it, my motion vectors are stepping too much

The Constant Bias Scale node should be -0,5 and 2.

As far as I know, that’s been fixed in UE 4.25.

1 Like

There’s 3 of them, should it be -0.5 and 2 on all 3?

Edit: Scratch that, sorry, i just saw that there’s only one node with 0.5 and the others are fine :slight_smile: thanks

Just a little update

I’m using Unreal 4.25 and found out, that a flipbook with e.g. 4x4 works fine BUT a flipbook with 4x2 does NOT work with the “Flipbook Motion Vector” node.
It counts 1…2…7…8 instead of 1…2…3…4…

3EhHYV14jC

But the old flipbook node does work:

7jWjYtKvD8

My test texture:

image

p.s. @cabalthecatI made a new version for the slate video a while ago:
https://www.youtube.com/watch?v=gkljBc7bdew

2 Likes

The quick fix for the col/row different numbers is here, the wrong input is used in the divisor in the following 2 spots in the material function:

Change the input from the columns to the rows scalar. I did submit this fix to Epic, so hopefully comes fixed in the next release.

cheers!

3 Likes