Continuous material across objects

How would I create a material that allows the material to tile continuously across multiple objects? That is, if object 1 is directly beneath object 2, the material will appear to continue seamlessly from one onto the next. This also would mean that as an object moves in space, it would essentially be moving “through” the material. See the image below for a visual example.

So, as far as I can tell, this would use the Absolute World Position node connected to the Texture Sample UVs input. But I’m having trouble figuring out how to put it together so that I can translate my objects in any 3 dimensions and have the texture offset correctly (because the UVs are 2D and the world is 3D, how can this be possible?)

Thanks!

Thanks for the quick response!

As I noted in the original post, I assumed that the absolute world position node would go into the Texture Sample UV. But since the UV is a Vector2 and the world position node is Vector3, it has to be masked to only use 2 of those values. So how can I get this to work accurately across all 3 dimensions?

Thanks!

(EDIT: Actually, this only works in some situations. See comment below.)

I knew I should have just persisted. A little break helped clear my brain. For my purpose, using the Vertex Normal works. There’s probably a cleaner way to do this, but the image of my material is below for anyone in the future who might be wondering how to do this.

Well, actually this only MOSTLY works. It works if the faces of the object are directly facing a world space axis. So that the normals of the face are all either 1 or 0 for each axis. If it’s rotated anywhere between those values, it no longer works as desired. So I’ll continue working on a solution for this. But if anyone has already done something like this and can provide the premade maths solution, that would be amazing!

After giving this some more thought, the problem is that I’m using world space normals from the VertexNormalWS node. Is there a way to transform these into local space normals?

Sorry this turned into a thread of me talking to myself. Would have been better just writing up my thoughts and saving them for 24 hours.

The solution is much like the above, except in order to account for rotation, the VectorNormalWS and ObjectPosition nodes need to be run through a Transform to convert world space coordinates to local space coordinates. Then I guess multiplied because for some reason the conversion lowers the value. 5.5 seems to be the right factor.

Posted below is one more picture of the final solution that works for me. Hopefully might be useful to someone else in the future.

1 Like

Didn’t work for me. I have found a better answer here:

1 Like