• The Object Info node gives me access to the location of the shaded object('s origin) in World Space
  • The Texture Coordinate node gives me access to the coordinates of the shading point in the Object Space of any object.

How in a shader tree, could I retrieve the location of the shaded object in another object's space? For instance, the location of the shaded object in its parent's space?

Somehow apply the parent's inverse transform to the Object Info > Location?

  • 1
    $\begingroup$ Subtracting Combine XYZ (drived with parent world coordinates) from Object Info - is not what you are looking for? $\endgroup$ – Serge L Mar 11 '19 at 5:56
  • $\begingroup$ @Serge L That is a partial solution, yes, as long as you can be sure that only translations are involved? Maybe the best that can be reached conveniently. It just seems odd to me that location isn't available in other bases.. you could do it in OSL, I think, if Cycles had it fully hooked up.. you could get to the transformation matrices of named objects.. but I don't think it's there, in the Cycles implementation. $\endgroup$ – Robin Betts Mar 11 '19 at 6:23
  • $\begingroup$ @Serge L maybe rotations are all that screw it.. by taking the transformed 0,0,0 and 1,1,1 you could deal with translation and scale... $\endgroup$ – Robin Betts Mar 11 '19 at 6:40
  • 1
    $\begingroup$ Too bad, it is currently not implemented. You can track it here : developer.blender.org/T52154 . Related question : blender.stackexchange.com/questions/81793/… $\endgroup$ – cppBeginner Jul 17 at 1:21
  • $\begingroup$ @cppBeginner Thanks for bringing me back to this question! I'd forgotten it. Not in OSL.. it doesn't provide the space of a named object? But ordinary shader nodes can do it.. see answer. $\endgroup$ – Robin Betts Jul 17 at 7:54

I was being dim.. to return the location of object A in the space of object B, in all A's shading points:

enter image description here

Here, 'A' is the shaded object, 'B' is an Empty.

| improve this answer | |
  • 1
    $\begingroup$ Wow. Thank for sharing. Do you know any other nodes that receive Object as input besides "Texture Coordinate"? e.g. Is it possible to get the object name in string? $\endgroup$ – cppBeginner Jul 17 at 8:13
  • 1
    $\begingroup$ Don't think so, other than self ... there's Object Info > Location, (which I could have used here) and Camera space is available via Camera Data, ( So, for example, you could tell where the camera is, without using drivers, the way many people do.. I think I've done that myself..) $\endgroup$ – Robin Betts Jul 17 at 8:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.