Monday, November 19, 2018

unity - Mip Maps on 2D Sprite causing black line above. Why is this?


I am new to Unity. I'm trying it out and using Futile for a code-first approach, but still importing textures using the Unity system.


The problem I'm having is that when I use mip maps to scale large sprites down to smaller sizes without jagged edges, I'm getting a black line artefact above said sprites.


Hard to see


A little hard to see, but they're there. If I turn down the resolution, you can clearly see them:


Easier to see


These are my texture settings:



Settings


My question is, why are these black lines here? Is it a mistake I've made? Is it just a common side effect? How can I reduce these? Also, if this is the wrong approach, how can I use smooth sprites in a game with the ability for them to scale up smoothly?


Thanks!



Answer



There are many reasons why you may be getting those lines. I wrote a more detailed answer in here, but the bottom line is:



Do not do atlasing and mipmapping at the same time.



For 2D, in general, you don't want/need to do mipmapping. That's useful mostly in 3D where you don't know the size at which your textures will be rendered, but that's usually uncommon in 2D.


If you definitely have a texture that you will aggressively downscale, then don't include it in an atlas.



And I'd also recommend you turn anisotropy off. That's meant to give you better results when you're looking at big textures from extremely sharp angles, which simply doesn't happen if your game is 2D.


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...