gradual alpha gradient

Previous topic - Next topic

ampos

Is there a way to use gradual alpha channel?

Currently, as far as I see, alpha channel is just YES or NO (255,0). Can a gradual alpha channel be used?

I want to cast a gradient shadow.
check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE

Moru

It's stated here and there in the manual and tutorials that pink is transparent. If you use PNG images you can use 255 shades of alphachannel in your graphics but you need to set the alphablend in GLBasic to something else than 0. ALPHAMODE -0.1 is fine.

Scott_AW

@Moru - So that's how you get them to work, I didn't know that, thanks!

Alphamode can be set between -1 to 1, with 0 being normal.  And it allows for intervals between.  So -.5 or .5 would be half-transparent.

I believe you can use alphamode in polyvectors...so to create a gradual alpha gradient I think you can do something like this.
Code (glbasic) Select

startpoly 1,0
  alphamode 0 //solid
  // Top of image
  polyvector 0,0,0,0,rgb(255,255,255)
  polyvector 320,0,320,0,rgb(255,255,255)
 
  alphamode 0.5 //half transparent
  // Bottom of image
  polyvector 320,240,320,240,rgb(255,255,255)
  polyvector 0,240,0,240,rgb(255,255,255)

endpoly
Current Project, Orbital Contract Defense
http://gamejolt.com/games/adventure/code-name-ocd/9887/

BlackShadow now open source/resource(requires duke3d)
http://gamejolt.com/games/adventure/black-shadow-3d/9885/

monono

Indeed, you can use it in the polyvector block. If you go the alpha png way, you get th finest result with an alpha of -0.9999 in my opinion.
Cheers

ampos

Quote from: Ocean on 2010-Sep-12
Quote from: ampos on 2010-Sep-12
Currently, as far as I see, alpha channel is just YES or NO (255,0)....

I'm eager to learn where you looked or what did read to arrive at this assertion... Can you please give references?

cheers
Ocean

Because I did a PNG with alpha channel and GLB ignored it.

And if you want to GLB not ignoring it, you have to set alphamode -.x, as monono and moru indicated, and GLB does not say.
check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE

ketil

Same happened with me when i first tried it, but it was due to an error in my GFX application.
The PNG's was not correct.
Maybe your PNG file is not valid.
"Sugar makes the world go 'round. Caffeine makes it spin faster."

ampos

No, it was fine, but if alphamode is not set, they do not work.

You can see a screenshoot of my current work.

http://www.glbasic.com/forum/index.php?topic=5031.0

The shadow of the ball is alphamode -.5

Inner shadows are created using a 32x32 pixels sprite, png, full black with alpha gradient. Then set using polyvector and alphamode -1
check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE