x


Texture offset issue.

Hey!

So, I've got a texture which shows up with black lines along the border, as such:

http://imgur.com/PFB5w

I've tried adjusting the image import settings so that it clamps, which resolves the issue of the line on top. But then, when I use the texture offset (to create a scrolling background), the picture obviously won't wrap correctly--instead it just repeats the last pixel, which doesn't allow me to scroll the background.

Is there a way to fix this, or do I have to clamp the image and then just write a script that instantiates and destroys new background planes every few seconds, as a workaround?

Many thanks,

Simon

more ▼

asked Apr 04 '12 at 12:35 AM

Catlard gravatar image

Catlard
527 48 60 66

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

1 answer: sort voted first

For real, graphics cards clamp on x and y independently, but Unity's texture widget only allows you to clamp both or none. Maybe you can clamp just y using a custom shader.

You could try not clamping, but scaling y by maybe 1.05 -- just enough to hopefully push the line off of the top edge.

more ▼

answered Apr 04 '12 at 03:03 AM

Owen Reynolds gravatar image

Owen Reynolds
12.2k 1 7 46

Thanks, Owen! You inspired me to do what i needed to, which was just to make the image large enough to throw it off-camera. I suppose it would be helpful to be able to clamp the axis-es (axes? axises?) individually, but I'm actually quite curious as to why that little black line happens in the first place. Seems like a disfunction. In any case, you the man.

Apr 04 '12 at 04:21 AM Catlard

Say the texture is 1/2 as big as the area it's on. Each pixel needs to double up. You want it to blend with adjacent pixel values, for a blurry effect (better than just repeating it, which gives the old pixelated look.)

Pixels on the sides blend with the "wrap around" pixels. You want that, since otherwise it would create a slight seam. The way graphics cards work, pixels can't tell that they are on the edge of the model -- if tiling is set, they always assume there's a next pixel they should be blending with (unless you turn off tiling.)

It's sort of the same problem with texture altases getting weird edge pixels if they're packed too tight, and drawn too small.

Apr 04 '12 at 06:51 AM Owen Reynolds
(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:

x110
x82
x21
x19

asked: Apr 04 '12 at 12:35 AM

Seen: 792 times

Last Updated: Apr 04 '12 at 06:51 AM