- Home /
Texture offset issue.
Hey!
So, I've got a texture which shows up with black lines along the border, as such:
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
Answer by Owen-Reynolds · Apr 04, 2012 at 03:03 AM
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.
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.
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.