Tips on making masks faster

Description: Outdated stuff came from viewforum.php?f=41

lighthouse64 M
Topic author, Duke
Duke
Avatar
lighthouse64 M
Topic author, Duke
Duke
Age: 21
Reputation: 19
Posts: 132
Joined: 15 Feb 2015
Location: IDK!

Post #1by lighthouse64 » 18 Feb 2015, 8:08

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:
Attachments
npc1-m.gif
It works :p
npc1-m.gif (1.02 KiB) Viewed 4509 times
Player of hedgewars!!! :)
And hi... it's me from smbx
Currently bug testing for Mac :apple: And Windows :windows:

Wohlstand M
Lead Developer
Lead Developer
Avatar
Wohlstand M
Lead Developer
Lead Developer
Age: 31
Reputation: 507
Posts: 1823
Joined: 15 Feb 2014
English Pronouns: he/him
Location: Moscow, Russia
Website Youtube channel URL Skype Tencent QQ

Post #2by Wohlstand » 18 Feb 2015, 12:45

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.
Image

lighthouse64 M
Topic author, Duke
Duke
Avatar
lighthouse64 M
Topic author, Duke
Duke
Age: 21
Reputation: 19
Posts: 132
Joined: 15 Feb 2015
Location: IDK!

Post #3by lighthouse64 » 18 Feb 2015, 22:11

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.
Player of hedgewars!!! :)
And hi... it's me from smbx
Currently bug testing for Mac :apple: And Windows :windows:

Wohlstand M
Lead Developer
Lead Developer
Avatar
Wohlstand M
Lead Developer
Lead Developer
Age: 31
Reputation: 507
Posts: 1823
Joined: 15 Feb 2014
English Pronouns: he/him
Location: Moscow, Russia
Website Youtube channel URL Skype Tencent QQ

Post #4by Wohlstand » 18 Feb 2015, 22:17

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.
Image

lighthouse64 M
Topic author, Duke
Duke
Avatar
lighthouse64 M
Topic author, Duke
Duke
Age: 21
Reputation: 19
Posts: 132
Joined: 15 Feb 2015
Location: IDK!

Post #5by lighthouse64 » 19 Feb 2015, 7:23

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... :/
Player of hedgewars!!! :)
And hi... it's me from smbx
Currently bug testing for Mac :apple: And Windows :windows:


Return to “Tutorials”

Who is online (over the past 5 minutes)

Users browsing this forum: 2 guests