1
$\begingroup$

I've successfully built a procedural wood texture, but I'm having problems with coordinate spaces.

By default, textures seem to follow the UV coordinates of the geometry. This is obviously useless; each object I apply the wood texture to gets its coordinates horribly mangled according to the UV map of that object (if it even has one). Most particularly, if you scale an object, the texture is also scaled.

Fortunately, using the "geometry" node, you can get actual, absolute coordinates in 3D space. This allows the wood texture to operate as a correct 3D texture, which different faces of the object showing different sides of the grain and so forth. It also means that every object in the scene has the same size grain.

There's a snag, however: The texture now correctly ignores scaling, but it also ignores translation and rotation. I understand why, but I don't know how to fix it. How can I make it so that rotating an object also rotates the wood grain? It would seem I need some way to read the object's rotation... but I don't see an input node for that. Can I get the local-to-world transformation matrix somehow?

The only other solution I can think of is to have a duplicate copy of the material for every single wooden object in the entire scene, each with the rotation factor manually set to match the object geometry. But that's a horrid, horrid idea! I do not want to have an entire separate material for every individual object! And having to manually update the material every time I rotate the geometry sounds awful. There's got to be a better way...

$\endgroup$
1
  • $\begingroup$ @RobinBetts That seems to fix it. If you make that an answer, I'll accept. $\endgroup$ Commented Jun 20, 2020 at 9:16

1 Answer 1

1
$\begingroup$

It sounds as if you should be using Texture Coordinate > Object space.

This is in Blender units, from the object's origin, and in the orientation of the object's axes.

Be aware, that space carries the object's scale transform as well; to make sense, the object's scale will have to be (1,1,1).. (i.e. applied).

There's an example of a procedural wood here

$\endgroup$
2
  • 1
    $\begingroup$ This way, whatever transformations I "apply" don't affect the texture, and whatever transformations I leave unapplied do affect the texture. Couldn't really be much more flexible than that... $\endgroup$ Commented Jun 20, 2020 at 12:00
  • $\begingroup$ Un-applied scale, especially non-uniform, is a notorious cause of unexpected results from modifiers, etc., so you just have to know it's there, in the object's transformation matrix. $\endgroup$
    – Robin Betts
    Commented Jun 20, 2020 at 17:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .