Uniformly spreading a texture across multiple objects

Hello, what I am looking to accomplish is having one texture appear over the course of a number of objects uninterrupted. For example in the image below the hexagons are my tilled objects and for the sake of this question the orange shape is the texture I want to uniformly spread across the objects.

There are hundreds of these hexagons in my scene and they all need to remain separate yet appear as one. Having many material instances with different offsets leads to way to many materials in the scene so I was wondering if anyone had any other solutions?

3 options come to mind:

  • Use worldPos in your shader to apply the material in world position
  • Use screenPos in your shader to apply the material in screen space
  • Write a script to combine the UVs of your hex models and then apply material in (shared) model space

Which is best depends on how your game scene is setup. You can find details of 1 and 2 at Unity - Manual: Writing Surface Shaders. For 3, look for the MeshCombine script in standard assets.

For future googlers: use Triplanar in Shader Graph

Hello man, I just came to that problem that I need shader like that, can you share it with me?