# How to make a texture appear the same way in a cube?

My problem seems so simple, that before asking the question here I did a search on google and this site:

But nothing seemed to be related to my problem.

I imported this image.png:

I created a material and added the image to it:

But I did not get the expected result in the game (I wish this yellow line were under that pink arrow that I drew):

Innocently I thought the solution was obvious, so I added another image.png and added it to the material:

To my surprise, the result was worse, the yellow line did not even appear:

I realized this happens because the floor of my game is a "stretched" cube, so the image I added is appearing correctly on one of its faces, not just the one I want.

I'd like to know how to make it look the same on all faces, or some value that I can change so that it appears correctly on the face I want.

EDIT 1 (attempt using rotator)

I put the input time to see if any value would be compatible with what I want, but none is.

I tried with both texture images, but both presented the same behavior:

See that spinning looks like the shaft rotates around the top left of the floor.

For some moments the yellow line will disappear.

• Did you consider just rotating your cube? – DMGregory Jul 9 '19 at 0:44
• @DMGregory Yes, but I happen to have 2 Render Targets attached to the floor, it got bugged (the sprites). – Boneco Sinforoso Jul 9 '19 at 13:15

## 2 Answers

You might want to play around with texture coordinate (UVs) scaling and flipping.

Right now, the face pointing upwards is just showing a part of the unfolded cube texture. If you adjust the scale you should be able to show the image on every face of the cube.

TextureCoordinate Expressions shows that UTiling and VTiling can be used for scaling the texture. Use Un Mirror U and/or Un Mirror V for flipping the texture.

Maybe you will need some texture offset as well, which can be achieved with the Panner Expression. Note, the order when combining both expressions makes a difference.

• Using the rotator I could for a moment visualize the texture of the correct mode, but I can not catch it at the point (set the rotation). – Boneco Sinforoso Jul 9 '19 at 13:27
• I connected a Scalar Parameter to the time and I was able to set a value, but the same thing happened as when I added an inverted image. – Boneco Sinforoso Jul 9 '19 at 13:37

your coordinates are incorrect, the texture might be to big or too small, to verify that make a checker pattern texture apply it as an overlay to the original texture.

In game re import the image and apply it to the mesh again, after that create a texture coordinates in the material and two number input parameter (x, y), multiply the two, than connect the result into the texture sample input parameter.

This way once compiled the material you can create an instance and modify only the x and y parameters till the tiling is good

UPDATE

Checker textures are any type of texture that allows you to verify your tiling/uv scales, the most standards comes in two flavors, gradient pattern with indexes or black and white.

When applied to your mesh you can use them to see how big or small the boxes are or how many cells appears. After that you can use your UV tiling property in the Material to adjust till the image is displayed properly or within the wanted range.

If now the values are matching your preferences, you can keep the UV tiling values but replace back the texture with the original one you wanted to display and if all is ok the image should display properly.

You can still fix the parameters afterwards, now you just have a baseline to start from

P.S.

Uneal Engine also has the Z axes usually rotated by 90 degrees when importing meshes from Maya(not sure other packages like blender), if still not the right direction, rotate the mesh by -90 in the z axes and should help

• I'm not good with textures. So I didn't understand exactly what you suggested to do. I tried to use the CheckerPattern, but the texture is gone. – Boneco Sinforoso Sep 18 '19 at 22:57