Texturing a cube for a wall in 3D

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By mydoghasworms
:warning: Old Version Published before Godot 3 was released.

I have modeled a cube* in Blender which I want to use as a section of a wall in a 3D GridMap. The problem is that in Godot, when I apply the texture, I cannot get four consecutive faces on any axis to have the texture in the right orientation. That is, on one of the faces, the brick texture always has the wrong orientation.

I have tried different things with UV unwrapping in Blender. In there, I can get the brick texture to align horizontally along all four vertical faces, but when I import it to Godot and apply the texture, it is at most horizontal along 3 faces.

enter image description here

*OK, admittedly it’s the cube from the default scene; I didn’t actually “model” it :smiley:

These were my settings when I exported the .obj from Blender (they are the defaults):

enter image description here

Did you check that you exported the model with an Y-up setting?

Zylann | 2016-12-14 13:25

I checked that. It seems to be the default when exporting .obj in Blender: http://i.imgur.com/ao2hUE5.png

mydoghasworms | 2016-12-14 15:53

Please see my answer. I found that when playing the game, the faces on the sides were all aligned the same way (but wrong orientation), not like displayed in the editor! So I just rotated the texture, but not sure if that is the optimal solution.

mydoghasworms | 2016-12-15 04:57

:bust_in_silhouette: Reply From: mydoghasworms

So this is probably not the perfect solution, and something I tried avoid doing, but anyway:

When I run the game, I noticed that, unlike in the 3D view of the editor, the brick pattern is going down (wrong orientation) on each side of the cube.

I actually had the same thing in Blender, but to fix that, there is an option under the texture properties, in the “Image Sampling” section, called “Flip X/Y axis”, which did the trick.

I did not see anything similar in Godot under the material settings, so I resorted to the only other thing I can think of doing, which is to rotate the texture by 90 degrees.

enter image description here

Now, when the game is running, at least the texture is aligned the right way on all sides.

enter image description here

I am not sure this is the best solution, so if you have any better ideas, please add them.