- Home /
How Can I Make Materials Keep The Same Global Offset On Different Objects?
Hello, I would like to make the offset of all uses of a material stay the same relative to the world.
This means that if I placed 4 cubes with the same material next to each other, the material would continue seamlessly across all 4 cubes.
I am surprised that I can't find a method for doing this somewhere, but believe me I have tried.
Please help me with this.
Here is a picture of some stairs made of 4 different cubes. As you can see, the material's offset is the same on all 4 cubes. I need a way to make the whole set of stairs act like 1 cube so the material will be seamless.
I found a very useful script for a similar problem here, coded by DevLurkin: https://answers.unity.com/questions/548846/repeat-texture-instead-of-stretching-it-all-over.html The script solves a similar problem of being able to scale an object without the texture stretching. A script like this except for keeping the global offset would be perfect. Does anyone know of a solution?
Answer by SunnyChow · Apr 13, 2018 at 02:16 AM
You need some triplanes shader (eq: https://assetstore.unity.com/packages/vfx/shaders/uv-free-triplanar-shader-pack-23425), the shader does the mapping based on the vertex position. Otherwise, you need a script to modify each mesh or material, both is bad for performance if your scene has lots of objects like this
Your answer
![](https://koobas.hobune.stream/wayback/20220612160624im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Shader with two textures separated by an alpha channel? 1 Answer
Using Rpg maker XP Tiles (2D Tile System) 2 Answers
Texture offset not behaving like it should (?) 1 Answer
Offset detail texture in c# 1 Answer
Scroll Ball Texture Smoothly 0 Answers