- Home /
Sprites have black Lines
Hey there, got (again) a little problem.
I am using the "Uni2D" plugin to draw my sprites (just you guys know, what i am working with)
So, i made these two clouds in illustrator, exported them as .png files, imported them - Set the Texture-Settings: Disabled MipMaps and set the Wrap Mode to "Clamp" (the creator of the Plugin suggests to do that)
But!
I get these black lines around my sprite:
Here is one of the original sprites:
![IMG]http://www.kingpic.net/uploads/sprite_bigcloud_01_kopie.png[/IMG][2]
The corners of the sprite are all lightly-bluewish, but Unity/Uni2D shows them with those little black lines, like in the Scene-picture above. Don't exactly know if it is an Unity or Uni2D thing?
I also tried to resize my TextureAtlas (didn't make any sense, though...) and my Padding-Value, like to...10...didn't change anything.
Any suggestions?
[2]: http://www.kingpic.net/uploads/sprite_bigcloud_01_kopie.png
Answer by Kryptos · Oct 16, 2012 at 09:03 AM
According to your original sprite, the background IS black. Therefore aliasing may cause this kind of artifact.
You need to have the background color of your original sprite to be the same (or almost the same) base color as the border of the shape but with an alpha set to zero (transparent).
Note that the same technique is used to prevent bleeding when using repeating texture. The idea is to prevent a gap in the RGB space. There are even some software that can help you make this kind of texture.
The color you used for the transparent background is RGBA(0,0,0,0). Therefore its RGB color is black.
Ins$$anonymous$$d of RGBA(0,0,0,0) for transparent background, use RGBA(212,233,255,0) which is the color of the border. This way the color gap (in RGB space) will be $$anonymous$$imal and the aliasing artifact will not appear.
yea i thought when he was talking about the corners were colored he meant he had colored put the background around the texture at least as the same color.
but yea the background is black because you have a texture that when you drew it you drew it on black. you then made that part transparent so you couldnt see them but when the graphics card does its smoothing of the lines around your texture during the drawcall it tries to basically make the edges of your texture blur kind of.
Its trying to make your straight lines look more curvy and natural. but part of that means calling on nearby pixels in your texture. those pixels are the black ones.
Answer by sparkzbarca · Oct 15, 2012 at 11:17 PM
yea thats common you need to have the background of the image to be a similar color.
Basically the image imported doesnt line up perfectly with whats drawn
so you have like a green object to be in photoshop over a lightish green background.
may want to look at this, apparently it might help to have the edges be transparent. basically the layering of one texture over another is causing a kerfluffle. it seems like it might be blending the colors of the edge of one texture with the colors of the texure its over or something i dont know
http://answers.unity3d.com/questions/204960/unlittransparent-texture-leaves-dark-lines-on-the.html
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Animation not playing until i move character. 0 Answers
Multiple SpriteSheets break batching 1 Answer
Problem with LineCast on new unity 2D 2 Answers