Is there a way to convert from any sort of 3D coordinates into any given object's UV coordinates?

I currently have a setup like this:

Node Group using Object Coordinates Texture Node using UV coordinates

The node group gives me a 3D grid so it needs some sort of 3D coordinates as input to work correctly. (Here Object coordinates but really any 3D coordinates would work)

The image texture, however, is mapped onto the sphere using inherently Object-Bound, 2D UV coordinates.

What I want to accomplish here is to "pixelate" the texture as it appears on the sphere, based on the 3D grid. Conceptually, the easiest way to accomplish this would be to convert the grid from Object-coordinates into UV-coordinates and plug that into the texture.

I think for the special case of the sphere I could work some manual Mercator projection magic to replicate UV coordinates but that would be a bit tedious and, importantly, not universal. There's no way it'd work for a mesh with complex shapes.

Any ideas how I might accomplish this sort of thing?

  • $\begingroup$ Sorry, what do you mean by "pixellate"? Do you want the original image intact, but have "cell like" borders, or do you want the image to be cut up into little pieces and distributed based on the map? (this second method can be done for sure, but the location of the "pieces" is randomized somewhat) $\endgroup$ Dec 11, 2020 at 22:30
  • $\begingroup$ @ChristopherBennett the way I'd imagine it to work is that I take whatever the cell-pattern's center is (which is also encoded in the color), I pick the color of the texture at that point and spread it across the entire cell. So each cell gets a single color, effectively "pixelating" the texture with the pattern. - This is a straight forward effect if you plug in, say, a noise texture. But to work on an image texture, I need to convert between UV and object (or other 3D) coordinates. $\endgroup$
    – kram1032
    Dec 11, 2020 at 22:34
  • $\begingroup$ Yeah, I'm not sure how to do that offhand, and I unfortunately don't currently have the time to play around with it. I'll upvote the question, though, because I'm curious as well. $\endgroup$ Dec 11, 2020 at 22:50


You must log in to answer this question.