TLDW logo

Control the Material of Instances in Blender Geometry Nodes

By Kimmo Hellström

Summary

## Key takeaways - **Instances Share Face Domain Materials**: The issue is that material is stored in the face domain of the geometry, and every instance by definition always has the same geometry, so changing material affects all instances. [01:13], [01:21] - **Create Unique Instances Per Material**: The most straightforward way is to create an instance for each material: collect three materials, instance them, and use pick instance to choose between those randomly or by index. [02:20], [02:37] - **Store Attributes on Instance Domain**: Store attribute to instance domain like curve factor, then use it in shader nodes to control the color of each instance. [02:53], [03:10] - **Drive Mix Shader with Attributes**: Use attribute to drive mix shader and change the whole material or shader of the instance, though it's limited to easily two materials. [04:30], [04:46] - **Capture Attribute for Curve Factor**: Use capture attribute node on spiral to take the factor for use in geometry nodes, as it might not be straightforward. [06:22], [06:40] - **Viewer Node Keyboard Shortcuts**: Assign control 1,2,3,4 keys to viewer nodes to quickly jump between them. [06:40], [06:50]

Topics Covered

  • Instances Share Face Geometry Materials
  • Precreate Instance Prototypes Per Material
  • Store Instance Attributes for Shader Control
  • Mix Shaders Limited for Multiple Materials

Full Transcript

Hello, in this video I will show you few ways how to control materials of instances. So you have can have for

instances. So you have can have for example random material for each instance or control them by some

criteria for example here it's curve factor.

So this is a quite often asked question in discord etc.

And the issue here is that we can change the color of inst material of instance like this. We can do it after instance

like this. We can do it after instance on points.

But the issue here is that it it affects all the instances. If we try to change only one or two or something else

random, it doesn't work. So here I have selection. I have one instance selected.

selection. I have one instance selected.

I can delete it. But if I use same selection for material, it doesn't work.

This is because the material is saved or stored in the face domain which is

geometry and every instance by definition always have same geometry. I

changed this selection so it will select every second element. So with instance it's quite clear what's happening.

And if I change material it will be quite clear too. So we can see it changed the

material in material in every second phase. What can we do to tackle this

phase. What can we do to tackle this issue? The most straightforward way is

issue? The most straightforward way is to create an instance

for each material. So here we have the instant source. We can also change it to

instant source. We can also change it to icosphere for example and then we set three materials collect them here where

we make them instance and then we use pick instance to choose between those. So if I set this to

between those. So if I set this to integer inte select the materials manually

and random was this it's just random or by hat for example remember to enable the pick instance

other way to control this is by attribute we can store attribute to instance domain and then we can use them

in shader nodes.

So here we for example store the curve factor. These instances are

curve factor. These instances are instanced along the curve. I will show you at the end how the curve is made.

Quite simple.

And here we have this color ramp which reach the factor

and that controls the color of the instance.

So we can do like this for example and I also stored color attribute straight away and we can select here. So it's

random color now but we can have for example single color value but it doesn't show right color because I have

used saturation there and now it should work and you could use selection for example select only one instance

and of course you can use these same attributes to drive any other value like roughness maybe for example I don't know

if it shows up here but you get the point anyways I hope the last way to do this is quite similar

to the one this uh this one but the difference here is that instead of uh driving

colors or single values of shader. I use mix shader to change the

whole whole material or shader of the material.

Maybe it's that way. I don't know. This

is kind of this might be useful in some case, but I don't know where.

And uh problem with this is it uh only drives like easily two material. It

should be possible to shine this mix shader nodes and drive it like uh with some mats. So you could have like

some mats. So you could have like multiple multiple materials or shaders mixed together. But

I don't know. I don't see that so useful when you can use this uh first method

where you just set the materials for the for the instances separately.

So I think that's all and I hope someone finds this useful because at least I have seen many people asking this and

see you next time. Bye. Hello, I'm back because I forgot to show you how I make the spiral. So, it's simple. Just spiral

the spiral. So, it's simple. Just spiral

node and curve the points.

But the thing I wanted to show you is this capture attribute which takes the factor

and it's used here because that might be not straightforward.

And one thing I want to show also is this uh I don't know if people know but you can with control one two three four assign uh keys to we nodes and then you

can like fastly uh jump between them.

So while I'm here I will quickly show what happens inside these other groups because it might be confusing if you

don't know. So this is a select by

don't know. So this is a select by index. I use use it to select by index

index. I use use it to select by index with different criteria. You can pause the video and examine it yourself.

So this is how I made the uh this instance prototype. It's just a

instance prototype. It's just a rectangle sweeped along the circle with the curve to mess.

Uh what else we have here? separate

positon. This is uh probably my most used uh custom group I have made. I just

uh take a position and take this values.

So I don't have to I can add one node instead of those three nodes every time.

And is there anything else? I don't

think so.

Next time.

Loading...

Loading video analysis...