Page 1 of 1

Tips on making masks faster

Posted: 18 Feb 2015, 8:08
by lighthouse64
You may not have known this, but you don't have to color a mask black. As long as the sprite has no white in it, you can simply just keep the sprite the way it is and just color the background white. For instance that image down there works as a mask for this image: Image.

Which means you can finish sprites quicker and you won't have to go through the tedious process of coloring it black. :) :good:

Posted: 18 Feb 2015, 12:45
by Wohlstand
It's a lazily-made mask which invalid. If youbwill use alpha-blending unmask algorithm, result will be wrong.
Here I wrote about it /viewtopic.php?f=40&t=159

The true fastest way of mask creation is usage of png2gifs tool which includes with PGE. Now it have user-friendly drag&drop GUI, so:
- save your sprite in PNG format with transparency
- run png2gifs
- drag & drop your PNGs into gray box. In opened console box yoi can see conversion log.

Posted: 18 Feb 2015, 22:11
by lighthouse64
Wohlstand wrote:It's a lazily-made mask which invalid. If youbwill use alpha-blending unmask algorithm, result will be wrong.
Here I wrote about it /viewtopic.php?f=40&t=159

The true fastest way of mask creation is usage of png2gifs tool which includes with PGE. Now it have user-friendly drag&drop GUI, so:
- save your sprite in PNG format with transparency
- run png2gifs
- drag & drop your PNGs into gray box. In opened console box yoi can see conversion log.
Oh. I guess things with gfx in PGE are different than in smbx. Because in smbx it works fine.

Posted: 18 Feb 2015, 22:17
by Wohlstand
lighthouse64 wrote:
Wohlstand wrote:It's a lazily-made mask which invalid. If youbwill use alpha-blending unmask algorithm, result will be wrong.
Here I wrote about it /viewtopic.php?f=40&t=159

The true fastest way of mask creation is usage of png2gifs tool which includes with PGE. Now it have user-friendly drag&drop GUI, so:
- save your sprite in PNG format with transparency
- run png2gifs
- drag & drop your PNGs into gray box. In opened console box yoi can see conversion log.
Oh. I guess things with gfx in PGE are different than in smbx. Because in smbx it works fine.
Works because it is a bit-blit algorithm (Alpha-blending algorithm converts mask into alpha-channel and this way giving ability to use true semi-transparency). But even for it this way is not correct. If you don't know how it works, please don't make lazily-made GFXes.

BitBlit algorithm is slow because to draw image we making double fetching:
1) firstly we fetching mask image and draw each pixel on screen with AND bitwise operation to R G and B. Where black, pixel will take black color, where white on mask - background color will be same with no changes.
2) secondary we fetching image sprite and draw each pixel on the same place on screen, but with AND bitwise operation to R G and B. Where was black - pixel will be drawn over black with more light color. Where on image black pixel - is a leaving of background color without replacement

Alpha-blending algorithm mixing colors with using of special coefficient - alpha-channel which a level of opacity for this pixel. Alpha-blending giving you able to draw clear glass, water, ice, etc. with clear and beutiful result.

Posted: 19 Feb 2015, 7:23
by lighthouse64
Wohlstand wrote:
lighthouse64 wrote:
Wohlstand wrote:It's a lazily-made mask which invalid. If youbwill use alpha-blending unmask algorithm, result will be wrong.
Here I wrote about it /viewtopic.php?f=40&t=159

The true fastest way of mask creation is usage of png2gifs tool which includes with PGE. Now it have user-friendly drag&drop GUI, so:
- save your sprite in PNG format with transparency
- run png2gifs
- drag & drop your PNGs into gray box. In opened console box yoi can see conversion log.
Oh. I guess things with gfx in PGE are different than in smbx. Because in smbx it works fine.
Works because it is a bit-blit algorithm (Alpha-blending algorithm converts mask into alpha-channel and this way giving ability to use true semi-transparency). But even for it this way is not correct. If you don't know how it works, please don't make lazily-made GFXes.

BitBlit algorithm is slow because to draw image we making double fetching:
1) firstly we fetching mask image and draw each pixel on screen with AND bitwise operation to R G and B. Where black, pixel will take black color, where white on mask - background color will be same with no changes.
2) secondary we fetching image sprite and draw each pixel on the same place on screen, but with AND bitwise operation to R G and B. Where was black - pixel will be drawn over black with more light color. Where on image black pixel - is a leaving of background color without replacement

Alpha-blending algorithm mixing colors with using of special coefficient - alpha-channel which a level of opacity for this pixel. Alpha-blending giving you able to draw clear glass, water, ice, etc. with clear and beutiful result.
ok. I guess this was no good than... :/