1
$\begingroup$

enter image description here

I'm trying to get this wood texture mapped correctly according to the rotation of the objects. In an ideal situation, the textures all align so they point to the middle of the cirle. I have loads of products to render, where unwrapping/rotating the texture on each beam is not an option. I'm importing these from solidworks using .WRL format. This makes it more difficult, because the rotation in blender is 0 degrees on every axis..

So the question is, how would i make a mapping nodegroup that maps the (pbr)textures on each instance according to the rotation of the object (imported from SW). Is this possible entirely in shader nodes, or do i need a geometrynode component aswell?

Thanks in advance!

edit: I think i have not explained my situation well enough. The beams are 3d objects with bevels on it and have rough topology. enter image description here

enter image description here

$\endgroup$
2
  • $\begingroup$ I think you will need geometry nodes. Shaders don't analize the whole, they just take "single points". For that you'd need to find the length, align an axis to that length, and store this axis information in a named attribute to be consumed by the shader nodes. $\endgroup$ Commented Nov 8 at 13:09
  • $\begingroup$ Is the origin of the objects at the center of the circle? $\endgroup$ Commented Nov 8 at 16:44

1 Answer 1

0
$\begingroup$

Solution for individual objects - volumetric - bad topology

This solution requires that you set the origins of the objects to the center of the circle. (You do that by placing the 3d cursor at the center - shift + right click, then select all objects, right click, set origin, origin to 3d cursor)

Use this to copy material to all objects: Copy material to another object? (where the "special" in newer blenders is a "down arrow")

(the same principle for copying apply to geometry nodes, in blender 4.2, you click the down arrow on the material or the modifier)

Geometry nodes

  • Calculates the mean position of the faces
  • Calculates a provisory vector from the origin (center) to the mean position, discarding Z (provisory local X)
  • Uses maths to create local X and local Y for each face based on this provisory X

enter image description here

Shader nodes

Gets the local X and Y and calculate the position of the geometry in this local coordinate system

enter image description here

Result for volumetric objects with bad topology

enter image description here

For flat (2d) objects with good topology

Geometry nodes

These store a X axis for the texture.

  • It needs tiles with 4 edges
  • It takes the two smallest edges and calculate X based on the center of these edges
  • It stores the normalized X axis in a named attribute (important: store as vector)

enter image description here

Shader nodes

  • Take the Texture X axis
  • Calculates the Texture Y axis by cross product Normal x X
  • Calculates the position of the geometry in the new texture coordinate system (dot products)

(The wave texture represents your wood texture)

PS: you might need to rescale the texture, in this case, add a multiply or a vector map right before the texture.

enter image description here

Result

enter image description here

Solution for mesh islands

Here, you have a single object instead of many individual objects.

  • This requires that all islands have 4 vertices!!

enter image description here

Solution for volumetric objects with good topology (faces = quads)

Here, we extrapolate the previous island solution.

  • Split the edges to make every individual face its own UV island
  • Store the X axis for each face
  • Join the geometry together again (merge by distance)

enter image description here

enter image description here

$\endgroup$
4
  • $\begingroup$ Thanks for the help. See my edit for more clarification on the matter. I cant get the wave texture to fit on all beams with the proper orientation or the same sizes.. $\endgroup$ Commented Nov 8 at 15:31
  • $\begingroup$ @GijsDekker , updated solution for 3d Objects. But it must have good topology (faces = quads) $\endgroup$ Commented Nov 8 at 16:36
  • $\begingroup$ Thanks a lot for your help. this is exactly what i need! <3 $\endgroup$ Commented Nov 12 at 9:02
  • $\begingroup$ So, @GijsDekker, if this answers your question, please mark is as answered $\endgroup$ Commented Nov 12 at 16:49

You must log in to answer this question.

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