2
$\begingroup$

I don't know if this is possible, but I'd love to be able to set different materials on each instance of a geometry node without having to realize instances first. This is what I have now:

Existing node setup

This works in generating many copies of a mesh and giving each copy a specific material, but the problem I'm having is that "realizing" them means I'm ending up with 10s of millions of verts and running out of memory, rather than just having the one instance of data but with different materials.

I have seen similar examples where just the colour is changed, but I have multiple changes per material to cater for (colour, roughness, metalness, transmission, etc).

Basically I want more than 2000 bricks.

enter image description here

$\endgroup$
4
  • $\begingroup$ How many materials do you have? Why not have a single material that changes color and other properties based on a custom attribute? $\endgroup$ May 11, 2023 at 16:47
  • $\begingroup$ There are 61 materials each with their own colour, roughness, metalness, and transparency. I'm not sure how I'd go enough doing this succinctly with custom attributes... I know you can set different materials on instances through the interface so was just wondering if it was available to the nodes. $\endgroup$
    – WizPip
    May 11, 2023 at 17:14
  • $\begingroup$ Does this answer your question? blender.stackexchange.com/questions/253723/… $\endgroup$
    – quellenform
    May 11, 2023 at 21:24
  • $\begingroup$ This solves it for random colours, but to replicate this with 61 pre-defined materials each with their own roughness, metalness, and transparency it would presumably take me 244 attributes to do this, and additional work if I need to add more. $\endgroup$
    – WizPip
    May 12, 2023 at 15:35

2 Answers 2

2
$\begingroup$

As far as I know, you need a separate instance for each material, like so:

Or duplicating the object and setting a different material for each variance and combining it in a collection:

Or do something like this to more easily manage a lot of separate instances:

Custom Group i:

Or resign from multiple materials, just use one. The material properties could be stored as attributes in "instance" domain and read in a shader using the "Attribute" node from "instancer", and the arbitrary material data could be stored using one of these techniques:

How can I rotate individual curve points in geometry nodes?

Cycling /looping through a set of index values using geometry nodes to create animation

How to instantiate objects on individual/selected points in geometry nodes?

$\endgroup$
1
  • $\begingroup$ You know, for the task at hand and maintenance thereof I feel a collection of dupes, each with their own material is probably the way to go from this. Thanks for the ideas! $\endgroup$
    – WizPip
    May 12, 2023 at 15:42
2
$\begingroup$

Just set the same material for all of the instances (or set it to the object used as the instance input for instance on points node). enter image description here

Then open the shader editor and plug object info node's random output to the factor of a color ramp node and use the color output as the color of the instances. enter image description here

This is the result: enter image description here

$\endgroup$
3
  • $\begingroup$ This works for random colours, but I have 61 pre-defined colours, each with their own roughness, metalness, and transparency. $\endgroup$
    – WizPip
    May 12, 2023 at 15:32
  • $\begingroup$ You can again use the combination of the randomness and the color ramp and plug the output into the parameters you want to vary. Since the randomness value doesn't change, all objects with the same color will have the same roughness, metalness, and transparency. $\endgroup$
    – guest
    May 16, 2023 at 21:08
  • $\begingroup$ Also, you can add a map range after randomness and set it to step, and use the step value to determine how many variations there will be. $\endgroup$
    – guest
    May 16, 2023 at 21:17

You must log in to answer this question.

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