3
$\begingroup$

I designed a parametric wall with windows in geometry nodes. I can change the width, height, window count etc. Now, I am trying to assign differnet parts of a material node tree to certain parts of the geometry node tree. (For example I would like to define the borders, shown in the image below, sepeterately for the different parts of the wall so they all have the same distance from the edges.)

enter image description here

I could maybe somehow do it by recreating all the calculations from the geometry node tree in the shader nodes. But that seems rather laborious. I tried doing it by assigning attributes in geometry nodes and referencing them in the shader as suggested in this post:

How to assign a different material color to each geometry nodes instance

But by using the realize instance node, I loose the texture object coordinates per instance, which I rely upon for defining the borders. Is there any way of transferring attributes without the realize instance node? Or alternatively to keep the per instance texture object coordinates?

Thanks in advance, Ollie

$\endgroup$

2 Answers 2

2
$\begingroup$

You cannot assign different materials to the instances after the instantiation, because all instances are of one and the same object.

But you can set a switch before the instantiation, and achieve a different assignment of the materials with something like shown here.

enter image description here

Update:
If the above example does not help you, then you should use Blender 3.2. In this version your UVMaps will be preserved even after applying the node Realize Instances.

$\endgroup$
3
  • $\begingroup$ Thank you for your answer. I need to assign different parts (of the node tree) of just one material. $\endgroup$
    – Oliver
    Commented Mar 26, 2022 at 21:32
  • $\begingroup$ As far as I know, this is currently not possible. Once instantiated, objects can only be assigned to one material, and also the transfer of attributes to individual instances does not currently work in Blender as one would wish. $\endgroup$
    – quellenform
    Commented Mar 26, 2022 at 21:38
  • $\begingroup$ blender.stackexchange.com/questions/253723/… $\endgroup$
    – quellenform
    Commented Mar 26, 2022 at 21:39
2
$\begingroup$

I know this is an old question but I ran into this same issue and found an easy fix to keeping your object coordinates despite realizing instances. All you have to do is store the position of your instanced object as an attribute before instancing, then use that attribute in the shader. You can also store a named attribute for each instance so you can tell them apart later in the shader.

In geonodes: capturing your coordinates before instancing. This way all your instances use the original object's coordinates

In the shader: You can now use this attribute in the shader in place of your texture coordinates node

$\endgroup$
2
  • 1
    $\begingroup$ In 3.4+ it works even without realizing instances - Just change Attribute: Type to Instancer. $\endgroup$ Commented Jun 30, 2023 at 12:24
  • 1
    $\begingroup$ Yeah but I needed to realize them anyway in order to apply deformations/material variations to each instance. $\endgroup$
    – justry
    Commented Jun 30, 2023 at 13:33

You must log in to answer this question.

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