Object Position, Rotation, and Scale shader input node
Knowing a specific objects Position, Rotation, and Scale can be really handy in controlling interesting procedural shader effects, especially if that object is something like a light or a camera.
It would be cool if there was a node, similar to how you can select an object in the "Texture Coordinates," node, that would just output a constant vector (same for all pixels) representing either the position, rotation, or scale of the selected object.
Currently there is no direct way to do this. You can get the position of an object by subtracting the The Object UVs from the current object's geometry position, but unfortunately rotation and scale are still impossible.
EDIT: After thinking about it further, it would still probably be beneficial to have a separate "view position," node, that gives the position of the current camera/view. This would allow for interesting parallax shaders being viewed from outside of the camera, as well as dynamic camera bindings
5 Comments
Drivers can do the trick. Or sometimes Object Info > Location, but I agree, we need a dedicated node.
Can't you obtain that from the Texture Coordinates(object) node?
* @ Lsscpp * I don't think so. The existing nodes seem to give the screen UVs, depth information, and the angle at which the incoming rays are coming from (which you might be able to extract some rotation info from, but it's different per-pixel so not as helpful).
My proposal would output a single value that is constant for all pixels on the screen representing the global XYZ position, and another one for XYZ rotation
* @Zach Hixson * Got lost... I thought you mean the camera position and rotation, just as any other object. That is what the TextureCoordinates(object) return, provided you actually select one object in the field at the bottom
* @ Lsscpp * Yeah, a little different but I see the confusion. Actually I was confused myself which is why I struggled trying to get those nodes to work for my purposes for so long.
The selector box would be pretty cool though. Instead of just being able to be used for the camera, it could be used for all objects. Re-wrote the original post to include that