The NEW Build Your Own Arcade Controls
Main => Software Forum => Topic started by: protokatie on August 01, 2008, 12:06:23 am
-
Well, I know it isnt in Youki's code, but I found a way to get 15 levels of alpha channel (16 if you count transparent) into one image (but you need to use 4 images at 4 different alpha overlaping, and use the "clear color" to selectivly chose which "plane" gets to add in it opacity for each pixel). Needless to say, doing this by hand is difficult, so when I get time I will write a simple program that will take a source image and an alpha mask and spit out the 4 pics needed to get the 16 level alpha. Anyways, as proof of concept I decided to take a simple blue bar and alpha blend it from transparent to near opaque. But any image can be used.
Here are some pics: (Note the alpha blended blue bar is over the snapshot part of the screen)
full size links:
http://s102.photobucket.com/albums/m105/protoplatapus/?action=view¤t=alpha2.jpg
http://s102.photobucket.com/albums/m105/protoplatapus/?action=view¤t=alpha1.jpg
(http://i102.photobucket.com/albums/m105/protoplatapus/alpha2.jpg)
(http://i102.photobucket.com/albums/m105/protoplatapus/alpha1.jpg)
Ok, now how did I do it, that is the important part. To test this out yourself, DL the 4 following pngs
http://s102.photobucket.com/albums/m105/protoplatapus/?action=view¤t=10a.png
http://s102.photobucket.com/albums/m105/protoplatapus/?action=view¤t=20a.png
http://s102.photobucket.com/albums/m105/protoplatapus/?action=view¤t=40a.png
http://s102.photobucket.com/albums/m105/protoplatapus/?action=view¤t=80a.png
Then go into Atomic layout editor and VERY important, make sure your "clear color" or "transparent color" is set to 255 red 0 green and 255 blue (the purple color in the PNGs)
Next, over lap the images PERFECTLY! EXACT SAME COORDS!
next stage, set the alpha for:
10a.png to 26
20a.png to 52
40a.png to 104
80a.png to 160
If you did this correctly you will see a range of translucency going from near transparent to almost opaque in 15 steps.
Remember, the blue bar was just for a test, any image can be used, you just need to know what areas of the 4 copies of the same image to "transparent out"
How does it work?
Well, if you look at the pngs from left to right, you will notice that the left most edge only shows blue on the 10a(26 alpha) pic, and the next line over only shows blue on the 20a(52 alpha) pic, but notice that the third line shows blue on both 10a and 20a? Well, 10a is about 10% opaque and 20a is about 20% opaque, so the next line is 20%+10% = approx 30%.
For those of you familiar with binary numbers, you will see the same basic pattern as counting in binary. Anyways, I hope you guys enjoyed this proof of concept. It would be really hard to make a complex alpha mask by hand this was (as you would have to deal with each pixel seperately on 4 identical pics, but a simple program could be written to do this (And I plan on making one as soon as I have some free time, and as soon as that happens, AtomicFE will have decent alpha handling! ;D)
BTW, for having to use 4 translucent pics to do this, it still runs at almost the same speed as it did before!
-
Hi Protokatie,
I think i have mistunderstood you , because what i see is already doable in standard in Atomic 0.19.
It is what i call Gradual Alpha blending. (on the "Mask" tab , there is a Gradual Alpha using mask option)
you can do this kind of thing :
[youtube]http://fr.youtube.com/watch?v=vA49MpCDKI8[/youtube]
It is used also here ,look it for as example :
(http://www.atomicfe.com/Screenshots/totoleouf17.jpg)
Do i miss something?
-
WAY TO RUIN MY HIGH, YOUKI! Ok, so I didnt see (prior to now) that you had alpha channel capabilities... But, at the same time, what I discovered could be used for other FE's that have only translucency with transparency... Oh well....
Still, hope my effort is somewhat admirable...
:sulks in silence: :'(
-
I'm really sorry. :-[
-
I was also used in that variant of the layout here :
(http://www.atomicfe.com/Screenshots/totoleouf16.jpg)
-
Hahah, funny.
-
Hahah, funny.
Huh? What's funny?
-
Ok, I know my method is obsolete, but I decided to put it in my layout anyways, even if out of shear spite :P
Some pics:
http://s102.photobucket.com/albums/m105/protoplatapus/?action=view¤t=alpha3.jpg
http://s102.photobucket.com/albums/m105/protoplatapus/?action=view¤t=alpha4.jpg
I know it would have looked a bit better if I used the built-in 8 bit alpha channel, but it doesnt that bad for being only a 4 bit alpha channel...
-
Very nice :D
don't forget to send it to me , when completed.
-
Very nice :D
don't forget to send it to me , when completed.
It pretty much is, but I do not know HOW to send it. Besides, the layout uses so many odd tricks, it would be awkward for someone to mod it for their own use. (Like I have said before, I have been trying to find every odd trick in your software to get this thing to this point). And YES, as per your PM, I WILL find a way to trick 3D out of it! (It may be slow tho :P and be only a trick...)
It may not look like I used odd tricks (outside the faux alpha channel) but I did do a lot of odd things to get it to this stage. I am sure there are many other layouts for AFE that are much better, but if you want, I will send it.
-
You can send it on my mail : y o u k i (at) a t o m i c f e . c o m
I'm curious to see your tricks. :)
Seeing the picture, at the first look, i don't see where you tricked. :-[ (except your alpha chanelling).
-
Is .20 going to have full alpha blending?
-
Is .20 going to have full alpha blending?
Full alpha channel support would bring DirectDraw to it's knee's and not really a fair expectation I would think.
-
Is .20 going to have full alpha blending?
Full alpha channel support would bring DirectDraw to it's knee's and not really a fair expectation I would think.
I thought that it would only be one small step from "Gradual Alpha" to full alpha blending.
-
I thought that it would only be one small step from "Gradual Alpha" to full alpha blending.
If it's used sparingly then yeah, like with the video showing a reflection that would be quite CPU intensive so you couldn't have the effect on every graphic object on a complex themes with several layers. The problem is since DD only support color keying you literally need to process each pixel per frame to do the blending. I think Youki has done a great job pushing the limits though since he does test on a lower spec machine AFAIK.
-
What you mean by Full Alpha blending ?
From my point of view it already has full alphablending using my gradual mask. The gradual mask can be considered as a 8bit alpha channel.
The gradual mask allows other interresting effects that you can do with simple alpha channel integrated to the image. i think.
Atomic works only in 16bit/pixel , i won't change that , at least in that engine .
-
What you mean by Full Alpha blending ?
From my point of view it already has full alphablending using my gradual mask. The gradual mask can be considered as a 8bit alpha channel.
The gradual mask allows other interresting effects that you can do with simple alpha channel integrated to the image. i think.
Atomic works only in 16bit/pixel , i won't change that , at least in that engine .
I mean using the alpha channel that is coded within a 32-bit RGB image, a la Dragon King.
Your external mask blending is also a great feature which allows blending with 16-bit images. It's actually non-trivial to implement the external mask blending in OpenGL because you have to set up multitexturing and that is a hassle.
I guess, with a little effort in Photoshop or GIMP, you can create gradual masks for any image you want to alpha blend.
I didn't realize that Atomic worked in 16 bits per pixel only. I was wondering how it could be so fast using only DirectDraw.
-
Your external mask blending is also a great feature which allows blending with 16-bit images. It's actually non-trivial to implement the external mask blending in OpenGL because you have to set up multitexturing and that is a hassle.
Just an idea, i didn't use Open GL for years, i think the only time i used it was in 1993 at school! , so may be i say something studid.
Could it be possible, instead of using multiple textures , to use only one , but you create the texture dynamically mixing the image data and the mask data and then use the result as one texture and blend it normaly as a normal alpha channeled texture.
In fact, you take a 24bit/pixel image , you take a 16bit par pixel image for the mask, and you build a 32bit pixel image from both....
I didn't realize that Atomic worked in 16 bits per pixel only. I was wondering how it could be so fast using only DirectDraw.
For 3 years my development machine for AtomicFe was my old Celeron 533Mhz with 256mega of ram....so it makes think how to optimize... ;)
And few year ago, i read a interview of George Luckas about special effect in Star war. He said that before Star war , teams spent 70% of their time to finalise details that you won't really see on screen in the action. So to reduce the cost , it decided to spent only 10% of the time for details , and use the 90% to create effects. If it is not perfect it is not problem as almost nobody won't see the default at least they pause the film.
If you look closely at Star war special effect (first film) they are very bad... but who did notice that?
I use the same "approach". Atomic is not pixel perfect!. And why to use 24bit or 32bit/pixel image, anyway your eye on a arcade screen won't really the difference. But your processor and memory Yes!! ;)
Atomic is just a Front End , it is not Photoshop or a modelling tool. So , don't need to have perfect timing, rendering etc..etc.. Just have to be nice and fast and usefull! :D
-
if you can cheat without users notice, you can do that. Programmers of course cheat to a easier way, since it not allways need to been perfect, because users doscent notice that.
I did some "cheat" tricks too in Java Space Taxi (http://www.spacetaxi.net) (before I found arcadecontrols.com) in some years ago to compress so much of possible with a fine quality, so they was fast to download. On the title screen, the logo is really a jpg with a offscreen 2 color gif transparency file, so the stars could been checking if its should appear or not. That jpg compressed much better than gif with a better quality. The stars was needed to move in the front layer due some mystery FPS problem on some machines, and in the fact jpg doesn't support transparency. I guess that only can been spotted on taxi light, if you look close, but that was ok.
Even the help screen was a mix of gif and jpg to take much advance of the compression type as possible and save space on that way.
So with Fe like AtomicFE, if it really not need to been pixel perfect, that is simple doesn't need to that....
-
Space Taxi!!! One of my favorite game on C64!! "Hey Taxi!"...
I wanted to try yours but link seems broken. :'(
So with Fe like AtomicFE, if it really not need to been pixel perfect, that is simple doesn't need to that....
Sorry, surely due to my English, but i don't understand this sentence? ???
-
Just say I was agree with you about pixel perfection.....
Space Taxi should work again. But in some browers the speed might go insane (should run about 30fps). I look what it happens when I went home.
I really loved the Amiga version of the game, but also C64 too. It a nice concept. I need to create a arcadecab friendly of this game a day (like Cheeky Mouse Deluxe)...
-
Thanks, i tried the game, it is excellent!! Great Job! :applaud: