Image Artifacts

47 views
Skip to first unread message

Jason

unread,
Mar 19, 2013, 4:49:24 PM3/19/13
to cocos-...@googlegroups.com
I'm making a game with PNGs ( .png for those searching). And I get weird artifacts when it's in game. What do I need to check/set to fix this? Is it a limitation on using PNGs in sprites? Should I be using some other format?


claudio canepa

unread,
Mar 19, 2013, 6:49:29 PM3/19/13
to cocos-...@googlegroups.com
On Tue, Mar 19, 2013 at 5:49 PM, Jason <theni...@gmail.com> wrote:
I'm making a game with PNGs ( .png for those searching). And I get weird artifacts when it's in game. What do I need to check/set to fix this? Is it a limitation on using PNGs in sprites? Should I be using some other format?




png should be fine.

Can you post a screenshot to see how it looks ? ( in cocos ctrl S takes a snapshoot and saves as a .png in the app current working directory)
 
If the artifact is something like a halo or border and the image has areas fully transparent it can be similar to the cases mentioned in
and also discussed in

Ivo Fokkema

unread,
May 22, 2020, 4:18:30 AM5/22/20
to cocos2d discuss
Hi guys,
I know this is a very old thread, but I ran into the same issue:

screenshot-1590133536_cropped.png


My example image shows the borders very clearly because I placed several sprites on top of each other. The darker lines in the overlap of the white sprites show what the edge looks like with one sprite. These are four different image types, all containing only white pixels.
Bottom: RGB PNG, with outer pixels having partial alpha, a "semi-hard" edge.
Right: RGB PNG, with lots of outer pixels having low alpha, a "very soft" edge. The softness is lost because I placed many sprites over each other, although the border does not show up.
Top: Indexed PNG, no semi-alpha, so a very "hard" edge.
Left: Indexed GIF, no semi-alpha, so a very "hard" edge.

Since very soft borders aren't an option for my sprites (I don't plan to use layers of sprites), I'm going to have to switch to GIF. That does remove the option for me to use RGB, so if there is a solution to this, I would be happy to hear about it!

Cheers,

Ivo

claudio canepa

unread,
May 23, 2020, 9:36:37 AM5/23/20
to cocos2d discuss
Ey, hi Ivo!

besides the things mentioned in those threads it may be somewhat recent changes in pyglet: while doing some testing I got, in the same machine, no borders in cocos 0.6.7 + pyglet 1.4.3 and border in pyglet 1.5.1 and cocos from master, see attached images.

I still need to do some bisecting to see how it come to be.

--



--
You received this message because you are subscribed to the Google Groups "cocos2d discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cocos-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cocos-discuss/3dcff4ba-fb93-40a8-a85f-2d84df32c6df%40googlegroups.com.
test_grid_effect_in_sprite_03.700_pyglet_1.4.3.png
test_grid_effect_in_sprite_03.700_pyglet_1.5.1.png

Ivo Fokkema

unread,
May 24, 2020, 6:03:58 AM5/24/20
to cocos2d discuss
Thanks for your reply, Claudio!

I couldn't access the links from your original message from 2013, so unfortunately I don't know if that information applies here. If I were more fluent in Python, it would've been easier for me to set up some virtual environments to try different versions of everything. Right now, even the basics of Python are hurting my head sometimes, but it's not stopping me from rebooting my long-planned game development ;)
Don't worry too much about it, I can work around it so far!

Cheers,

Ivo

claudio canepa

unread,
May 28, 2020, 10:58:37 AM5/28/20
to cocos2d discuss
On Sun, May 24, 2020 at 7:03 AM Ivo Fokkema <ivo.f...@gmail.com> wrote:
Thanks for your reply, Claudio!

I couldn't access the links from your original message from 2013, so unfortunately I don't know if that information applies here.

 
If I were more fluent in Python, it would've been easier for me to set up some virtual environments to try different versions of everything.

A starting point can be to experiment with the suggestions made in those thread.
I attached a script that can be a starting point for that; you need to edit the params to suit your case (read the comments there please)
 
--
claudio

alpha_borders.py
Reply all
Reply to author
Forward
0 new messages