Inconsistent material application to meshes

I am trying to change materials applied to meshes. I created a 4x4x4 Rubik’s cube. The outer faces on each block will be one of 6 colors, just like a physical cube. Each of my textures includes a hexadecimal number. My project assigns materials to block faces at random when the execution starts.

I show the corner of a rendered cube below. In the picture, the orange is in front, red is the right side, & yellow is the top. As you can see, depending on the face, the hex number might be properly centered (front) or skewed horizontally or vertically. The back face, 2nd photo, actually shrinks & tiles the texture.

I converted each texture into a material before applying to the meshes. Each mesh, one of the six block faces, is structurally the same. The blueprint diagram below shows how I solved the off-center material for the Blue 5 front face. Each other face needs different adjustments for the Hshift & Vshiift variables. Also, the back face needs different UTiling & VTiling values. So, applying a Blue 5 to a right, top, bottom, left, or back face needs different numbers in those parameters.

I noticed that the left & right faces only shift horizontally, the top & bottom faces shift on both dimensions, while the back face shrinks & tiles the material. The edges of each block are beveled to smooth them out just like the blocks in a physical Rubik’s cube.

The simple solution would be if the material would apply the same way to each face. I’ve never found a solution for that. The next simplest solution would be a function that applies meshes using passed variables, but executable blueprints make material & mesh manipulation incredibly difficult. This is my first Unreal Engine project, so I thought I was going with a simple task. Any ideas?

1 Like

It looks like you have the UVs laid out differently for each block face. You shouldn’t need t odo all this shifting around.

There’s a UV test pattern somewhere in the start or engine content

Try making a material from that. It should just sit the same on all faces.

Another thing you can try, is remaking the UVs on the block mesh using editor modelling mode.

1 Like

Aloha, & thank you for the quick response. I didn’t see the test pattern you had below in any UE content. I copied you image into the texture folder & converted it directly to a material. I made no changes in its material blueprint. This is what a corner block looked like.

There is still an obvious shift in the hexagon positions. Also, the image is rotated 90° counterclockwise. This is the same case with my numbered face materials as well. When I modify the material blueprint, I can set UTiling & VTiling so that the image fits better onto the mesh. It is still off-center though, & the difference varies according to the block face being painted by the material. This is the new “zoomed out” tile.

I keep experimenting with different solutions. The results are the same whether I bake the blocks into the scene or create them on start-up. I can experiment with different scales on the meshes, but that won’t solve the shifted image. What is so frustrating is how inconsistent these material applications are.

1 Like

It’s the UVs, I’m pretty sure.

I wonder if you can upload an FBX or one of the cube here?