-1
$\begingroup$

I am trying to create a system for aplying same gradient on different objects (hereinafter "objects") and control it with another object(hereinafter "controller"). And now the main problem is to "replicate" Texture coordinate "Object" output in geometry node. If i put obect info node inside geonodes of object everything works fine,enter image description here but when i trying to transfer attributes of obect info node from controller, blender starts calculating vector math not with objects, but with controller, although calculations take place inside geonodes of the object.enter image description here (small wire cube is controler)

How to avoid this? I tried to use capture attribute to object position, store attribute to object position, store attribute to gradient location, nothing helped.

UPD 1

The problem with the position of the gradient is solved by adding the position of the gradient and the controller in the GN of the object (translation into the coordinate system of the object), enter image description here but if you rotate the objects, everything breaks. enter image description here Again I understand why this is happening, but I don't have the brains to solve it yet. (or just digging in vector math for 5 hours on end doesn't affect me very well:)).

UPD 2

I solved the problem, here is my GN set up:

Object GN enter image description here Controller GN enter image description here

I'm not saying it's perfect or that it can't be simpler, but it works. enter image description here UPD 3 It works only for z rotation, working on x and y axis problem.

But another problem has arisen. I'm stuck on the number of allowed mix shader or what?

enter image description here

$\endgroup$
4
  • $\begingroup$ Vector math doesn't calculate knowing anything about space. If you send it position in one space, that's the space it's operating on. (If you send it position in two different spaces, its output is gibberish.) Because your GN are on your controller, you are doing things like measuring "position" in the space of your controller. Possibly, you can work around this-- but the simplest implementation is not going to involve any GN on your controller, just on the objects that are being recolored. $\endgroup$
    – Nathan
    Commented Dec 20, 2023 at 20:04
  • $\begingroup$ Yes, subconsciously I'm well aware that the problem is in different spaces. I just don't know how to pass gradient information to several objects at once without pulling this information from the controller that unites them. And I have already partially solved the problem (by adding the position of the controller and attribute inside the gn object). But now I have a problem with rotating objects and my head is about to explode from not understanding what is going on. $\endgroup$
    – Dmitriy
    Commented Dec 20, 2023 at 20:40
  • $\begingroup$ Please, do not answer your own question within an update of the question and then post a new problem as an update. This is not how this site is supposed to work. Place a question (one problem per question) and have the answer in the answer's section. If another problem occurs, post a new question. $\endgroup$ Commented Dec 21, 2023 at 15:05
  • $\begingroup$ Just didn't want to flood the site with questions on the same topic. Should I write an update if I find a solution to the problem, and put the question about the pink shader in a separate topic? $\endgroup$
    – Dmitriy
    Commented Dec 21, 2023 at 19:46

2 Answers 2

1
$\begingroup$

Maybe I don't understand your question fully, but it seems to me that you can solve this task only in shader nodes:

enter image description here

As you can see, GN is not needed, you can get Location, Rotation and scale from "controller" object in shader:

enter image description here

$\endgroup$
8
  • $\begingroup$ The problem is to make a GN that can create the same gradient for different materials. To do this, we need to duplicate the object output of texture coordinate in GN. And transfer information about the gradient object from the controller to the objects correctly. $\endgroup$
    – Dmitriy
    Commented Dec 21, 2023 at 8:19
  • $\begingroup$ But why you want to use GN, if this can be solved just in shader nodes? $\endgroup$
    – Crantisz
    Commented Dec 21, 2023 at 11:43
  • $\begingroup$ Well, now I don't understand you. How can u put same object as coordinate target to different textures, and apply this system for a set of groups of objects, without GN? GN allow u to use attribute from geometry, i.e. from each controller of this groups. Or u want to duplicate shader node group, each time u need to create a new group of connected objects? $\endgroup$
    – Dmitriy
    Commented Dec 21, 2023 at 13:56
  • $\begingroup$ You can use specific object in Texture Coordinate node, see my gif in answer $\endgroup$
    – Crantisz
    Commented Dec 21, 2023 at 15:38
  • $\begingroup$ No, that's not what I meant and not what I need. To achieve what you show in the gif, you need to manually select a target for the texture coordinates for each material. When I'm trying to create a system to avoid this. $\endgroup$
    – Dmitriy
    Commented Dec 21, 2023 at 19:43
0
$\begingroup$

I finally did it. It may not be the best solution, but at least it works.

Object GN setup enter image description here

Divide output will give same result as Texture coordinate object output

"Main Canter" setup

enter image description here

$\endgroup$

You must log in to answer this question.

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