7
$\begingroup$

I am trying to find a way to have random values assigned to each tile so that I can add a variation to the material later.

enter image description here

Using the Geometry Node's Random per Island output works when using Cycles but it is a Cycles only feature as stated by the official documentation.

Is there a way to have an equivalent result in EEVEE?

$\endgroup$
2
  • 2
    $\begingroup$ Ideally each tile would be a separate object instance and you would use random per object instead $\endgroup$ Mar 24 at 12:57
  • 2
    $\begingroup$ Besides Gorgious's answer, this would also be a good workaround. Surprisingly, I didn't even think about that. Thank you. $\endgroup$ Mar 24 at 13:15

1 Answer 1

10
$\begingroup$

You can create a new random attribute per island using Geometry Nodes. Add a Geometry Nodes modifier to your object.

Use a Mesh Island node (specifically, the Island Index output) and a White Noise node. Plug the result output to the tree output.

enter image description here

You can alternatively use a Random value node and use the mesh island index to stabilize the ID. Then you can play with the seed to get a new random batch of values per island.

enter image description here

In the modifier tab, expand the Output Attributes and type in the name of the attribute. You can choose whatever you want but take care not to overshadow builtins like UVMap.

enter image description here

In the shader editor, use an Attribute node and type in the exact same attribute name (case sensitive).

enter image description here

enter image description here

Note that the mesh island indices are dependent on the mesh island with the lowest Z axis vertex. So it may not be consistent if you add mesh islands lowest than the lower part of your mesh.

Troubleshooting

There are shading artifacts when using the White Noise Texture in perspective mode. It's caused by the White Noise node in the shader editor but the Geometry Nodes solution still applies.

enter image description here

This setup should get rid of the artifacts and give random colors :

enter image description here

Or use a Math node set to Snap. I guess it comes from a floating point precision error.

enter image description here

$\endgroup$
4
  • 3
    $\begingroup$ This answer is gorgeous, no pun intended :D. Thank you very much. $\endgroup$ Mar 24 at 13:13
  • 1
    $\begingroup$ Great answer. Makes me wonder why native random per island is not supported in EEVEE. Probably same old busy with other stuff. $\endgroup$ Mar 24 at 13:28
  • 2
    $\begingroup$ @DuarteFarrajotaRamos Thank you ! I think I remember from a post it's because the information comes with very little cost in Cycles due to how the whole thing is streamlined when rendering, whereas it would have a computational hit with Eevee. I don't know for sure though and the technicals are beyond me, so don't quote me on that :) $\endgroup$
    – Gorgious
    Mar 24 at 13:34
  • 2
    $\begingroup$ just great answer +1 $\endgroup$
    – Chris
    Mar 24 at 13:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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