Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / alpha transparency and alpha masking

Author
Message
joachim
12
Years of Service
User Offline
Joined: 21st Feb 2012
Location: Vancouver Canada
Posted: 24th Mar 2013 18:34
Hi AppGameKit community,

is there anybody out there who can give more technical
advice or a technical explanation on how
alpha transparency and alpha masking works ?

Would be greatly appreciated,
regards,
Joachim
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 25th Mar 2013 00:34
Quote: "alpha masking works "

is simply a solid contour that mask the parts that are going to be visible.
Quote: "alpha transparency "

Uses a gradient alpha color value to set the transparency value.

I used masking alot before but likes alpha transparency more now

Android 2.3 , ZTE Skate , 480x800 , 800 mhz , Samsung Galaxy Y , 240x320 , 832 mhz , Sony ericson arc 480x854 , 1 ghz
Android 4.0 , Dmtech 3g 9738B , 1024x768 , 9.7 inches , 1.2 ghz
joachim
12
Years of Service
User Offline
Joined: 21st Feb 2012
Location: Vancouver Canada
Posted: 25th Mar 2013 04:17
Do you know where I can find examples
or documentation on how to use them ?
joachim
12
Years of Service
User Offline
Joined: 21st Feb 2012
Location: Vancouver Canada
Posted: 30th Mar 2013 15:57
Hi AppGameKit community,

does anybody know what I have to do to get

information on alpha transparency and alpha masking ?

There must be somebody who has used Sprites before !?!


regards,

Joachim
Marl
12
Years of Service
User Offline
Joined: 19th Nov 2011
Location: Bradford, UK
Posted: 31st Mar 2013 23:39 Edited at: 31st Mar 2013 23:46
There's not much more to say;
- Alpha masking uses a mask (a single bit image) to set transparency
- Alpha transparency uses the alpha calue of the sprite colour to set transparency.

How about if you can see the difference;

This code takes the attached image and splits it in half. It copies the left half to two images. Each image is used on a sprite.

It copies the right side and uses the red colour channel (1) to form the alpha channel (4) of one of the images.

It then displays two sprites which use these images (alpha masked top left, alpha transparency bottom right). The sprite using the alpha mask image is left as is. the other is set to 50% transparency (127 in its colouralpha)

In the main loop it simply rotates a blank sprite behind both of these.

This is the test image

Attachments

Login to view attachments
Marl
12
Years of Service
User Offline
Joined: 19th Nov 2011
Location: Bradford, UK
Posted: 31st Mar 2013 23:48 Edited at: 31st Mar 2013 23:51
..and the result


The alpha masked sprite is transparent in the black area of the mask and opaque in the red. If there were several shades of red, these would produce several degrees of transparency

The alpha transparent sprite is universally see through, its transparency (and also colour based on what is behind) is set based on the alpha value of the sprite colour.

Attachments

Login to view attachments
joachim
12
Years of Service
User Offline
Joined: 21st Feb 2012
Location: Vancouver Canada
Posted: 5th Apr 2013 18:03
Thank You so much Marl,

now I have something to work with.

I'm looking to use a texture atlas
and the subimages.txt file, would you know
if there is documentation about it,
where to find it or do you know how to use them ?

Thanks again,
regards,
Joachim
Marl
12
Years of Service
User Offline
Joined: 19th Nov 2011
Location: Bradford, UK
Posted: 5th Apr 2013 19:37
There are quite a few threads on this,

Here's one to get you going; http://forum.thegamecreators.com/?m=forum_view&t=192926&b=41

Login to post a reply

Server time is: 2024-05-06 22:16:13
Your offset time is: 2024-05-06 22:16:13