4
$\begingroup$

I'm trying to set a different existing material on 5 Instances made with Instance on Points. Trying both 3.0.1 and 3.1 to no avail.

Is there any value or attribute that signifies which instance you are on?

I want to build a setup for texture painting with 5 copies of a character and therefore I am linking a rigify rig with the meshes that gets instanced. That seems to make it trickier if not impossible to do custom attributes. Either want to change material for each copied instance or have some way to swap textures in a shader graph. As long as you can paint a different texture on each copy.

I've tried these three answers to similar issue without results: Set material for instances problem (Blender 3.0),
Control Instance Color with Geometry Nodes,
How to assign a different material color to each geometry nodes instance

$\endgroup$

2 Answers 2

3
$\begingroup$

After a bit of faffing around, I've so far established that the Set Material Index node will work only if the incoming geometry, with materials assigned to slots, is on the same branch. The materials do not have to be assigned to faces of the incoming geometry... it just has to have its slots filled.

In this example, the incoming geometry is just a plane, with 4 material slots.

enter image description here

Cubes instanced on a line have their instance indices stashed, before Realize Instance wipes them.

A function of the stashed indices is used to Set Material Index, while the (material-slot-bearing) incoming geometry is on the same branch.

The incoming geometry has been tagged, so can be selectively deleted before output.

enter image description here

The GN-generated cubes are now assigned the separate materials, per-instance, as expected.

$\endgroup$
2
  • $\begingroup$ Thank you for this! Trying to replicate my own answer suddenly didn't work today, but your solution did! $\endgroup$
    – bastian
    May 16 at 16:57
  • $\begingroup$ This has been the hardest thing for me to figure out so far using Geometry Nodes. The modulo trick made sense but it never worked, until I realized I wasn't using "Instance" in the Capture Attribute panel. Thank you for this! $\endgroup$ Jun 20 at 19:29
1
$\begingroup$

Managed to figure it out with inspiration from this answer:How to access geonode generated "instance ID" from Cycles material?

My node setup looks like below and assigns materials all in geometry nodes: Node Graph Character

$\endgroup$

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.