1
$\begingroup$

The position of the shading point in the generated texture space of the object being shaded can be supplied by the Texture Coordinate node

The "Generated" socket of the "Texture Coordinate" node

Can I get the position of the camera in this space?

For example, if the camera were at the front bottom left corner of the object's bounding box, the coordinate would be (0,0,0).

$\endgroup$
5
  • $\begingroup$ Choose the Object output and select the camera where the Object: field is at the bottom. $\endgroup$ Feb 3, 2023 at 7:23
  • $\begingroup$ That would give coordinates in camera space, not the generated texture space right? Also I don't have a camera object, I mean the point I'm viewing from. $\endgroup$
    – scurest
    Feb 3, 2023 at 7:37
  • $\begingroup$ Well, maybe you should write this in the question then... the Generated output always gives texture coordinates starting at 0,0,0 on the front bottom left of an object's bouinding box to 1,1,1 at its rear top right - no matter its size and shape. A camera or point of view is a dimensionless point in space - so although you could take this as origin 0,0,0 - where do you expect 1,1,1 to be when a camera has no dimension? And if you don't even have a camera, I don't know where Blender stores the virtual coordinates of the viewing point to get them entered somewhere... $\endgroup$ Feb 3, 2023 at 7:45
  • $\begingroup$ I want it in the generated texture space of the object being shaded, the same space emitted by the "Generated" socket shown. Both the shading point and the camera point have some coordinate in that space. You can get the position of the camera in world or object space for example with a Vector Transform node. $\endgroup$
    – scurest
    Feb 3, 2023 at 7:55
  • $\begingroup$ I guess I just don't understand what you "want it in the generated texture space" means. I sounds as if you wanted to place the camera's coordinates inside the generated coordinates, so I'm the wrong man for this question. Sorry. $\endgroup$ Feb 3, 2023 at 8:16

1 Answer 1

2
$\begingroup$

This cluster should do it, assuming no Object-Level scaling of the shaded object. (If you wanted that. I think you would need drivers) :

enter image description here

It retrieves the camera (viewing) position in object-space, offsets, scales, and offsets back, to convert the object-space coordinate to the generated-space coordinate.

The .blend includes a little test framework. Seems to be OK.

$\endgroup$
4
  • $\begingroup$ Thanks. The reason I want the Generated space is for a scale-independent coordinate though. $\endgroup$
    – scurest
    Feb 3, 2023 at 7:59
  • $\begingroup$ Hi. @scurest .. would drivers be acceptable? .. you could multiply through, by object-level scales.. $\endgroup$
    – Robin Betts
    Feb 3, 2023 at 8:05
  • $\begingroup$ Well, I'd rather not, haha. $\endgroup$
    – scurest
    Feb 3, 2023 at 8:13
  • $\begingroup$ @scurest .. I get that.. it would be nice.. but think I've been stumped by that one, before. I don't know how to get hold of [transformed-object-space] :( Perhaps you could scale in GN, or something like that. $\endgroup$
    – Robin Betts
    Feb 3, 2023 at 8:19

You must log in to answer this question.

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