Strange result from the Distort node

   114   3   1
User Avatar
Member
68 posts
Joined: 3月 2025
Offline
There's something about the Distort node that I completely don't understand.
In theory, the process is very simple: for the current pixel, we read the pixel value shifted in the dir direction by a distance of scale*length(dir)*. Strictly speaking, we read in the opposite direction to create the illusion of a shift in the specified direction, but that's unimportant.

I take a white square and feed it as a mask to the distortion node. We take the direction from the = {1,0} parameter (the X axis) and increase the scale. The image in the square shifts to the right, as it should. No questions asked.

Now let's make the same square a vector2, adding 0 to the second component, and feed it as a direction to the dir port. In theory and logic, we should get exactly the same result, right? But we won't! We get three stripes inside the square. The original shift will be limited to some extent and will repeat. Moreover, the size of the permissible shift depends on the size of this square on the direction map. Frankly, I'm racking my brain trying to find some rational explanation or purpose for this behavior. It seems completely senseless and erroneous to me.
Can anyone explain what's going on here and why the shift is so limited?

Attachments:
Screenshot 2026-06-13 194453.jpg (206.4 KB)

User Avatar
Member
411 posts
Joined: 2月 2016
Offline
I'm going to go out on a limb here, so might very well be wrong.
I think the reason we see a repeating pattern is because `Pixels per Step` is on, this limits how far it can distort in one go. So after each step it's going to sample the previous step instead of the input image.
This results in it sampling the previous distortion, making it sample in place over and over.

If you disable pixels per step it does allow it to jump to the "target", though if you want this it might be better to use uv/image sample to get specific parts of the image.

Made a little video where I blurred the direction a bit so you see how it's distorting, it made it easier for me to understand at least.
Edited by AslakKS - 昨日 14:17:12

Attachments:
distort_steps.mp4 (120.4 KB)

User Avatar
Member
68 posts
Joined: 3月 2025
Offline
Absolutely right, that was it! Thanks, friend!
Now I understand what this option is for. Honestly, I don't even know how it got enabled.
User Avatar
Member
68 posts
Joined: 3月 2025
Offline
Now the distortion works exactly as I expected, otherwise I was struggling and doing refractions manually.
Image Not Found
Edited by Gaalvk - 昨日 16:22:44

Attachments:
bandicam 2026-06-13 23-16-59-583.mp4 (1019.0 KB)

  • Quick Links