- Home /
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?
Answer by tanoshimi · Oct 17, 2015 at 05:53 AM
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 http://docs.unity3d.com/Manual/SL-SurfaceShaders.html. For 3, look for the MeshCombine script in standard assets.
$$anonymous$$y hexagons need to work independently of each other and thus I think option one would work the best, thanks for the input, I'll play around with worldPos.
By updating my shaders to use worldPos I solved my problem, thanks for the help. For anyone else trying to do this and having some problems, here is a simple tutorial I found that helped me out. https://www.youtube.com/watch?v=s79Zu0F8fuY
Answer by davitsedrakian · Apr 27, 2020 at 06:24 PM
Hello man, I just came to that problem that I need shader like that, can you share it with me? @element271
Your answer
Follow this Question
Related Questions
Uniformly spreading a texture across multiple objects using the Unity standard shader 0 Answers
Changing HDRP Material's Texture At Runtime Not Working? 2 Answers
Having texture problem in Safari iMac 0 Answers
shaders question (3DS Max involved) 0 Answers
Can anybody give me clues on masking a texture in a shader with an animated mask? 0 Answers