- Home /
Repeating a texture over an object
Hello all. Say I have a material's tile x/y set to 1/1, on a non-scaled object, it'll appear fine. However, on a scaled object it appears stretched and blurry. Is it possible to have the material repeat its texture over an object ignoring the tile x/y? Or to create an instance of the material for the stretched object?
Answer by Owen-Reynolds · Oct 10, 2011 at 11:34 PM
Kind of a hack, but if it has a script can change the tile size based on the scale, something like this in Start:
Vector2 SS = renderer.material.mainTextureScale;
SS.x = transform.localScale.x;
SS.y = transform.localScale.y;
renderer.material.mainTextureScale = SS;
This changes the local copy of tileSize (so works fine for several objects sharing a material, but different scales.)
Answer by DaveA · Oct 10, 2011 at 09:53 PM
You can create more copies of the material with different tile values. And/or use UV mapping in the modeling program to get the exact fit you want.
I guess making some copies will work. I'm using the cube and sphere models, so I can't UV map then.
Your answer
Follow this Question
Related Questions
How do you properly let unity resize texture tiling? 0 Answers
Tiling a material using game units 1 Answer
Repeat texture common question 2 Answers
How to match texture Scaling/offset to UV coordinates 1 Answer
Material tiling unique to object 1 Answer