How do you select an entire instance (not just faces) to apply a material?

I’m trying to create a segmented ring, where the length and width of the segments vary, as does the material.

I’ve managed to get something that looks like this:

The part I’m stuck on is how to select an entire instance and control what material is applied. Right now I am only successful at selecting random faces of each segment instance- which is cool, but not what I’m hoping for :wink:

This is what I have:

The separate geometry node has an “instance” option, but when I select that everything is always set to the “inverted” selection material.

How do you select the entirety of an instance?

(I’ve also tried randomly setting the material on instances as they’re feed into the “instance on points” node, but with similar unwanted results.)

Full node tree:

I’m using the latest Blender 3.1 build.

I’m also not happy with the geometry. I’d like it to be more rounded. The original idea was to have a high number of points around the curve with lots of overlapping cube instances. That has a lot of aliasing and looks really bad.

I’m thinking of either trying to randomly control the length of a curve and “extruding” a random diameter circle along it. Or making a straight line of randomly sized rectangular prisms and then applying a curve modifier afterwards.

Any suggestions as to which of these approaches is more likely to work- or a better approach?

Thanks in advance!

Regarding the random material per instance, I can at least provide this workaround here, for the case that all instances have the same number of faces:

1 Like

What you can also do is work nit in the geometry editor but in the material editor.

If you add an Object info - Random node into your shader, it will also work on instances let that be geometry nodes or the old particles.

With that node, you can control variety for all instances at once, for colour, textures, etc… You can use a white noise, voronoi, or similar texture with a color ramp to plug it in. E.g. texture rotation you can create with a random node, voronoi, vector math to Add random and colour together, then use a vector math multiply to set a random number for the Z value.
Then go in a color ramp, plug it in the rotation of a mapping node. Then said texture will randomly rotate in patches for all instances.

Just an example, but long story short, material variety I would personally control in the shader like that :blush:

1 Like

Thanks @LordoftheFleas! I think I get the gist of that thread, but will have to re-read it a few more times ;-)!

I think we are both happy to provide you some examples, I’m just not at my rig now, so I could send you some screenshots :grin:

Thanks @AgentTuron!

Setting the shading in a shader, and the geometry in the geo nodes makes a lot of sense.

I just looked up the object info node, and it doesn’t give a range for either the id or the random output. Doing a bit more googling, this StackOverflow article (https://blender.stackexchange.com/questions/145641/what-is-the-range-of-random-values-given-by-object-info-node) says the range is [0,1]. Do you know if that is still correct?

(I still struggle figuring out what to expect the output of nodes to be, and how to visualize/debug them. Especially in the geo nodes as there’s no obvious way to see what a noise texture “looks” as you tweak the parameters.)

I have a few works that use this method, I am happy to share some stuff later :blush:
The Random node is always about random of what actually :grinning_face_with_smiling_eyes:
But randomness is only to drive the details of another node.
E.g. random goes into the 4D “W” of a white noise, or voronoi, etc…
I will try to share some examples a bit later, hopefully this evening :blush:

Hi, @KiwiKid, sorry for the late answer, I am a bit busy nowadays. I share two very quick examples, that should also work with geo node instancing (I just duplicated).

You can use the Random node for anything really, if plugged into W. Imagine creating rocks, same type but different shape. You can drive even the displacement like this.

In the second example, the white noise is basically the randomness base, and a math node cuts it down to a few tiles only, similarly to your original post. The amount of the blue tiles is the same, but always elsewhere.

Also, you can use a Vector math Add node as well on the vector line, to add Random to anything really, including size as well, I used to do it before. E.g. to randomly scale your textures. You can take it much further, whatever is needed to be random, but adding it everywhere can severely affect render time though :smiley:

Thanks again @AgentTuron! That makes it really clear. Looking forward to making some more time to play with blender soon :slight_smile:

1 Like