How do I re-position a texture in texture sampler?

I have a texture, and I have made it smaller:

But how do I control the location of that smaller texture? What if I say want it to be on the right middle edge instead of the top left corner? I know the panner can do it, but it’s always in motion which I don’t want, I just want to specify the spot manually.

or, ideally, is it possible for me to take the alpha from a mask and place this texture according to that mask’s position?

1 Like

By addition

1 Like

Thanks, that’s indeed what I was looking for, but do you know a way I can get it to a specific location?

Like if I have a sphere mask in an alpha channel of another texture and I want to use the center of that as the coordinates?

Very tricky to give a useful answer to that. Usually, the interesting part of the texture would not be in the corner, so no problem :slight_smile:

If you’re going to have a flip book on there texture, then I’d recommend some of the flipbook specific nodes, because then you don’t need to worry about alignment.

Otherwise, you’re stuck with calculating the difference between the image corner location and the center.

how about just 2D XY coordinates instead?

What I’m trying to do is make the texture small and center it on the cursor location by feeding it either aforementioned alpha mask or the relative space coordinates.

This is how I’m generating the alpha mask I’m talking about, i feed it the relative coordinates of the cursor click trace on the model, and generate a sphere mask from it and the uv unwrap.

And this is the location data being sent to it.

It works, as in accurately displays the sphere mask on the mesh where I’m clicking, however i’m trying to make it a texture instead of just a sphere mask.

First param is coordinate space, so if you want to make it 2D, you’ll need

image

i don’t really get how that’s gonna help, I tried it and it just didn’t work (not that I expected it to since I’m using the UV Unwrap and 3D coordinates for to position the mask so naturally this breaks that)

Your code isn’t making that texture smaller and it isn’t centering it on the coordinates either,it’s just focusing which part of the texture to display with the opacity not actually scaling and moving the texture like I’m trying to do.

Then again I am a complete novice when it comes to material bp so maybe whatever you’re trying to tell me is just going over my head.

Edit: here is a function that’s getting the exact position I need but in a 3d vector not a 2d one.

Ideally I’d just need a way to convert that position into 2d texture coordinates to position the scaled texture.

Yes, you still need to position the texture. My code was just trying to show how to use the sphere mask in 2d.

still trying to work out the formula to convert the 3d position to a 2d one.

I read somewhere that U = X / Z and V = Y / Z although it was not specifically for unreal and no 2 programs can ever seem to agree on what’s x, what’s y and what’s z.

It isn’t working though unfortunately. I mean it’s closer than before, the texture is small, and it’s drawn on the mesh, just not in the correct position and it tends to be kinda skewed.

1 Like

There’s still some parts I don’t understand. Why have the picture in the texture in the corner? Why not put it in the center?

I’m gonna make another thread that will explain it properly in a second.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.