x


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?

more ▼

asked Oct 10 '11 at 07:59 PM

Emanrice gravatar image

Emanrice
29 13 16 18

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

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.)

more ▼

answered Oct 10 '11 at 11:34 PM

Owen Reynolds gravatar image

Owen Reynolds
11.2k 1 7 45

It works perfectly! Thanks!

Oct 11 '11 at 12:18 AM Emanrice
(comments are locked)
10|3000 characters needed characters left

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.

more ▼

answered Oct 10 '11 at 09:53 PM

DaveA gravatar image

DaveA
26.4k 151 171 256

I guess making some copies will work. I'm using the cube and sphere models, so I can't UV map then.

Oct 10 '11 at 09:58 PM Emanrice
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2188
x807
x47

asked: Oct 10 '11 at 07:59 PM

Seen: 1684 times

Last Updated: Oct 11 '11 at 12:18 AM