2
$\begingroup$

Goal

I'm trying to map a texture on a cube;

Since my texture is not exactly fitting the correct orientation, I need to rotate it. The results are not as expected.

Setup description

I'm using the setup shown in the following pictures. I've set the projection mode to Box have the texture visible on all faces. Texture mode is set on Repeat to avoid undesired clamping (default value). What I'm trying to achieve is to have the planks horizontal instead of vertical on the front face (rotate around X axis). The rotation is applied in a Mapping Node.

Results

The face I need is properly rotated, but the others get this blurry effect, which reminds me of the "Clamp" mode in OpenGL. Is this expected behavior ? How to solve this ?

**Additional note (edits) **

Both the cube and the material are simplified versions of the original problem. The meshes I have are more complex, a few thousands faces, and with complex shapes (such as switches or sockets outlets). Very few faces are not aligned with the world axes, and thus they can be ignored. The material needs to be applied on various shapes, so UV map can't be made manually. The purpose of this is to automatically create a diffuse map of each textured item, where every face with a similar direction/normal would have a similar rotation applied.

For simplificity sake, the cube seems to be a good sample

Original nodeRotated version

$\endgroup$
1
3
$\begingroup$

"I'm trying to map a texture to a cube"

Perhaps a simpler way of mapping a texture to a cube and have control of the orientation of the texture on each of the 6 faces is to use UV mapping?

Starting with the node setup you have already :

  1. In the Texture Coordinate node change to UV, and the Mapping node change to Point (and reset the rotation and scale to Zero).
  2. Drag open a new viewport and change Editor Type to UV Editor.
  3. 3D viewport > Edit Mode > select the cube, then U to open the UV Mapping menu and choose the Reset option. This will reset the UV's so that each face of the cube is mapped to the complete UV space. (Each face stacked one above the other).
  4. 3D Viewport > select the face that you would like to change the orientation of the texture.
  5. In the UV Viewport > select the face (if it is not already highlighted in orange then use the A key to select it) and rotate it 90° with R90.

enter image description here

Or you can probably find the answer here http://www.blenderinsight.com/beginners-guide-to-cycles-nodes-the-procedural-way/ Under the chapter titled Object (with no reference object) :)

$\endgroup$
6
  • $\begingroup$ Hello, thanks ! I should have mentionned that the cube example is just for the exercise; The real objects are actually more complex than that, and the material should be applied on many different shapes. I expect artefacts on faces which are non-orthogonal to the axes, but those are very rare in my samples; Hence the simplification of the question to the cube sample. I'm editing the question to clarify this, sorry. $\endgroup$
    – Antoine
    Jan 28 '20 at 7:55
  • 2
    $\begingroup$ Even better, UV's are the way to go @Antoine $\endgroup$
    – brockmann
    Jan 28 '20 at 9:23
  • $\begingroup$ @brockmann I'm not sure : I would need to edit thousands of faces, which doesn't seem to be practical. As a matter of fact, I don't want to rotate 1 single face, but every faces that are aligned with the corresponding axis. The choice of the box mapping reflects this. In "simple" situations though, I agree the UV would be the way to go $\endgroup$
    – Antoine
    Jan 28 '20 at 9:52
  • 2
    $\begingroup$ I'm sure about this. The only other option you have is tri-planar mapping: blender.stackexchange.com/a/164187/31447 @Antoine $\endgroup$
    – brockmann
    Jan 28 '20 at 10:37
  • 1
    $\begingroup$ The link you shared is just an extended version of my answer in my comment before @Antoine There is no heavy math to do, it's just the image texture node set to box, done. And again, depends on the case but for a cube you probably want UV's (and you already have it) so I'd accept this answer. However, if you have something different in mind and asking a question about something else it's not that fair for the other users trying to solve your issue. If tri-planar mapping is what you want, I going to search for a duplicate. Cool? $\endgroup$
    – brockmann
    Jan 29 '20 at 10:04

Not the answer you're looking for? Browse other questions tagged or ask your own question.