Moving an eye using UV warp: texture repeats

i’ve been trying to figure out how to animate a flat, cartoon eye. i came across this: https://www.reddit.com/r/blenderhelp/comments/56l2xy/moving_pupil_texture_along_flat_eye/

everything worked for me; i can move the empty, and the texture of the eye moves, but the mesh stays in place. the only problem is that my texture repeats across the whole eye instead of just showing the part of the texture the UVs are mapped to. this is what i’m talking about:

like i said, the texture moves, so i’m good on that, but i just want it mapped correctly. how do i do this? i’m using 2.79.

my node setup:

i’ve tried changing “repeat” on the image texture node to “extend” and “clip,” and absolutely nothing changes. i also cannot find “extrapolation mode.” the eye only has one material. there are two eyes in the texture because this is a character base, and some characters have miss matching eyes. but that shouldn’t matter. you can see in this video: https://www.youtube.com/watch?v=kB9cJ3wOoPk&t=1406s

around 14:35, you can see he makes two eyes on his texture. he’s using a bone as the eye tracker, but i’m using an empty. the texture moves like it’s supposed to, but nothing i do keeps it from repeating. all scale and rotation are applied to the mesh.

Is that 2.79? Might have some peeps reluctant to help because of it-- not a lot of people still have an install of that.

Also-- you’re not using alpha in your material. So why have any in your texture? It makes it so that we can’t see what’s going on, it makes it so you can’t see what’s going on. (Or, maybe, it indicates a misunderstanding of how alpha works, so we can get to the bottom of that…)

You have two eyes on the same image. So when your UV warp means your shown UV map moves to the left or down, it should not repeat for one eye. However, when your UV warp moves your UV to the right and up, it will probably repeat for the same eye. Probably, opposite for the opposite eye. (What will actually happen? It is a mystery, depending on what color you have under your alpha.) Use only a single UV map, and a texture for a single eye.

Extrapolation mode probably refers to “extend”, “clip”, etc. I call that border mode personally. This refers to how the texture is read when you give it coordinates outside of the typical 0,1 coordinates. On extend, it finds the nearest texel within 0,1 to your coordinate and returns that. (In this case, it will return alpha 0, but what color it will return is still a mystery.)

Your ideal texture for this is a big white field with a pupil in the middle :slight_smile: If you’re still having trouble, consider uploading a file (here, or somewhere else.)

1 Like

i already explained why i have two eyes. i also have the alpha there just because that’s how i baked the texture. i know how alpha works, but it doesn’t matter because the UVs are not on the alpha, as you can see. i’m using 2.79, like i said. there’s no reason the alpha should prohibit anyone from seeing what’s going on, because i’ve said and shown what is going on; the eye is tiling. it’s not supposed to be tiling. i also gave a video showing someone else doing this exact same thing with two eyes on the same texture. and when i have the second eye, it will obviously have its own empty.

so, in 2.79, how do i keep it from not repeating?

here is my file: basemale.blend (4.0 MB)

You have to apply Scale (ctrl + A) to the “eyetrack” object.
(I downloaded your file and did that. This fixed the “size” of the texture).

If you have mismatched eyes, use two different textures, rather than putting them on the same image.

The UVs change. That’s what the UV warp modifier does.

In the file you provided, the texture is on repeat-- of course you don’t want that, that’s why it’s tiling in that file. You want it on extend. When you change it to extend, your eye turns black. Why? Apply the UV modifier and see what it did:

What did it do? It compared the transform of eyes with the transform of eyetrackR. EyetrackR has the same transform except 1) it’s scaled down, so it scaled your UV up; 2) it’s moved in the Y axis, so it moved your UV in the Y axis (the V axis.) For each sample, it found the closest border and sampled that. (Because it’s on extend.)

Now, what should you do to get something reasonable? Create a new empty (“warpFrom.R”) at the location of your eye, then rotate it 90 degrees in its x axis so that its z axis is pointing at eyetrackR. Rotate eyetrackR 90 degrees in its x axis so that its z axis is pointing away from warpFrom.R. Then, set warpFrom.R as the “from” object in your UV warp modifier.

Okay, you’re halfway there. You still need to change the texture. Because look what happens when you move your UV warp-to:

Moved and scaled. You can see, it’s not tiling. But it is showing you the entire image (which you don’t want.) And you can also see that where your borders brush up against the white, it streaks-- that’s what extend is doing, it’s finding the closest border texel. (You can use clip here instead, but it’s not going to be right either-- the issue is the image.)

So, you need to change the texture image.

Demo’d on 2.91.0, but 2.89 should work the same. (I learned UV warp back in 2.89 days.)

oh my god… DUH. thank you, this was exactly what i needed!

1 Like