Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: Reflection + Gradual Alphablending on a Layout  (Read 6487 times)

0 Members and 1 Guest are viewing this topic.

youki

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1612
  • Last login:November 19, 2016, 01:07:33 pm
  • Atomic Front End Creator
    • Atomic Front End
Reflection + Gradual Alphablending on a Layout
« on: February 15, 2007, 01:11:56 pm »

As i said in a post AtomicFE 0.19 (not yet released) is able to do some Reflection Effects and Gradual alpha blending.

this is a preview of what we can do.  It is just an exemple based on a _Shock's layout  .

I'm not an Artist , it is just a technical demonstration., we can do lot better!

It uses only DirectDraw and all is software.

A video here :




Aurich

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 291
  • Last login:September 12, 2021, 01:34:32 am
Re: Reflection + Gradual Alphablending on a Layout
« Reply #1 on: February 15, 2007, 06:06:11 pm »
Nice. I find it frustrating that Mala doesn't support true alpha channels personally.

johnperkins21

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 288
  • Last login:December 07, 2019, 07:02:34 pm
Re: Reflection + Gradual Alphablending on a Layout
« Reply #2 on: February 15, 2007, 06:08:51 pm »
That looks pretty hot. What sort of options are available for the reflection?  Does it have to have the wave, and can you move it and limit it to just the cap/vid?
Bob Dole likes cheese.

shock_

  • Wiki Contributor
  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 354
  • Last login:January 30, 2020, 06:23:29 pm
  • In Brisbane, it's GMT+10 all the time.
Re: Reflection + Gradual Alphablending on a Layout
« Reply #3 on: February 15, 2007, 11:16:05 pm »
wow - nice work, youki!

youki

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1612
  • Last login:November 19, 2016, 01:07:33 pm
  • Atomic Front End Creator
    • Atomic Front End
Re: Reflection + Gradual Alphablending on a Layout
« Reply #4 on: February 16, 2007, 03:07:19 am »
That looks pretty hot. What sort of options are available for the reflection?  Does it have to have the wave, and can you move it and limit it to just the cap/vid?

you do what you want with reflection , Reflection Zone are Atomic Layout Object as the others. so you place them where you want , you define the reflection source where you want , you can place it on the layer you want and it will reflects only layer that are below. And You can make move them or not. The moving is totally free as all Atomic object.   In addition on Reflection zone you can apply mask, gradual alpha blending etc..etc..

Here a exemple of a first try i did with reflection , the reflection is only under the cap/vid and use Gradual alpha :



youki

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1612
  • Last login:November 19, 2016, 01:07:33 pm
  • Atomic Front End Creator
    • Atomic Front End
Re: Reflection + Gradual Alphablending on a Layout
« Reply #5 on: February 16, 2007, 03:31:37 am »
2 preview of layouts that are "Work in progress" inspired from shock_ one too , featuring reflection, gradual alpha etc.....

These are done by a real Artist (not me!!!!) ,  totoleouf..





shock_

  • Wiki Contributor
  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 354
  • Last login:January 30, 2020, 06:23:29 pm
  • In Brisbane, it's GMT+10 all the time.
Re: Reflection + Gradual Alphablending on a Layout
« Reply #6 on: February 16, 2007, 03:41:14 am »
sing out if you need the original .psds!

Organic Jerk

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 550
  • Last login:May 09, 2013, 12:39:09 am
  • I'm per pixel lit.
    • OmeshPersaud.com
Re: Reflection + Gradual Alphablending on a Layout
« Reply #7 on: February 16, 2007, 04:43:41 am »
That's pretty sweet.... how does it look from a system performance level, though?  does it affect scrolling speed and such?  In fact on an  unrelated note does using Movies affect scroling speed in Atomic?

Nice. I find it frustrating that Mala doesn't support true alpha channels personally.

Yeah, me too actually... It's especially frustrating when I'm creating custom messages or console pictures to be used, because I have to coordinate the BG of the entire layout with the BG of the "snap", when I would much rather just being able to make it transparent..
« Last Edit: February 16, 2007, 05:19:18 am by OrganicJerk »

Progress Rate:  Moderate      ||      Threads:  Cabinet  |  Art  |  MaLa Layout
XBL: OrganicJerk  |  PSN: OrganicJerk

youki

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1612
  • Last login:November 19, 2016, 01:07:33 pm
  • Atomic Front End Creator
    • Atomic Front End
Re: Reflection + Gradual Alphablending on a Layout
« Reply #8 on: February 16, 2007, 05:03:06 am »
Quote
That's pretty sweet.... how does it look from a system performance level, though?  does it affect scrolling speed and such?  In fact on an  unrelated note does using Movies affect scroling speed in Atomic?

Of course performance depends on how much reflection zone you use , the size , if you use alphablending or not..etc..  But it does not consume more processor power that other effect in Atomic.

The reflection itself does not use lot of processor ,  the thing that consume more power is alpha blending. (gradual or not) . 

In clear if you make a layout using 4 layer differential scrolling, 7 reflection zone, 15 videos , and if you use alpha blending on each object.  You will need a P4 4GigaHz...

If you do a reasonnable layout, with said one background scrolling, video snap , one or 2 reflection zone , and few objects moving   , a 700 mhz machine will be enough.

For instance, the layout with the reflection only the snap. (the first image i posted) , use a video as "selection" in the list.  Runs perfectly on my Celeron 533Mhz.

The first one (the video) is not really usable on the celeron , the video have been taken on my P4 3 Gighz. , but processor used is only at 50%  .  So i guess it still should be ok on a 1.5ghz computer.


Quote
In fact on an  unrelated note does using Movies affect scroling speed in Atomic?

If your machine is good enough  not.  If the layout is too complex for your machine yes.  it really depends of the layout.  Knowing that Layout are really scalable , and there are lot of "tips" we can apply to optimize layouts.


Havok

  • Keeper of the __Blue_Stars___
  • Trade Count: (+17)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4522
  • Last login:May 29, 2024, 01:02:38 am
  • Insufficient facts always invite danger.
Re: Reflection + Gradual Alphablending on a Layout
« Reply #9 on: February 16, 2007, 08:40:40 am »
That's pretty sweet.... how does it look from a system performance level, though?  does it affect scrolling speed and such?  In fact on an  unrelated note does using Movies affect scroling speed in Atomic?

I'm running Atomic on an AMD Sempron 3300+ and have video snaps - my scrolling speed is great. The movies also come up instantly when I select them on the list.

Youki - this is looking great!

youki

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1612
  • Last login:November 19, 2016, 01:07:33 pm
  • Atomic Front End Creator
    • Atomic Front End
Re: Reflection + Gradual Alphablending on a Layout
« Reply #10 on: February 16, 2007, 09:15:13 am »
That's pretty sweet.... how does it look from a system performance level, though?  does it affect scrolling speed and such?  In fact on an  unrelated note does using Movies affect scroling speed in Atomic?

I'm running Atomic on an AMD Sempron 3300+ and have video snaps - my scrolling speed is great. The movies also come up instantly when I select them on the list.

Youki - this is looking great!


oops..you was talking about the list scrolling not image scrolling on layout...

Video comes up instantly on my old celeron 533

Havok

  • Keeper of the __Blue_Stars___
  • Trade Count: (+17)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4522
  • Last login:May 29, 2024, 01:02:38 am
  • Insufficient facts always invite danger.
Re: Reflection + Gradual Alphablending on a Layout
« Reply #11 on: February 16, 2007, 09:20:55 am »
oops..you was talking about the list scrolling not image scrolling on layout...

Video comes up instantly on my old celeron 533

Haha - yeah, but image scrolling also works great too!

 :dizzy:

johnperkins21

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 288
  • Last login:December 07, 2019, 07:02:34 pm
Re: Reflection + Gradual Alphablending on a Layout
« Reply #12 on: February 17, 2007, 01:27:42 am »
This is awesome!  :notworthy:
Bob Dole likes cheese.

swindus

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 391
  • Last login:July 28, 2021, 05:52:50 am
    • MaLa - M.A.M.E. Launcher
Re: Reflection + Gradual Alphablending on a Layout
« Reply #13 on: February 17, 2007, 02:34:31 am »
Yes, looks really nice! I also like the small font in the game name. Good work!

youki

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1612
  • Last login:November 19, 2016, 01:07:33 pm
  • Atomic Front End Creator
    • Atomic Front End
Re: Reflection + Gradual Alphablending on a Layout
« Reply #14 on: February 17, 2007, 03:10:39 am »
Thanks

I also like the small font in the game name.

I guess we will see that soon in Mala too.  ;)

swindus

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 391
  • Last login:July 28, 2021, 05:52:50 am
    • MaLa - M.A.M.E. Launcher
Re: Reflection + Gradual Alphablending on a Layout
« Reply #15 on: February 17, 2007, 03:20:03 am »
Wrong guess, no need for this.

squirrellydw

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1584
  • Last login:April 12, 2021, 11:30:22 am
Re: Reflection + Gradual Alphablending on a Layout
« Reply #16 on: February 17, 2007, 10:51:47 am »
Hey SWINDUS, any chance in getting the refection thing in MaLa? please please please
I b**ch. People listen!!

FrizzleFried

  • no one listens to me anyway.
  • Trade Count: (+4)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5144
  • Last login:May 30, 2023, 01:14:24 pm
    • Idaho Garagecade
Re: Reflection + Gradual Alphablending on a Layout
« Reply #17 on: February 17, 2007, 10:52:16 am »
No need Swindus,  but it sure would be nice!
Visit my arcade blog at: www.idahogaragecade.com (Updated 10-28-21)

swindus

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 391
  • Last login:July 28, 2021, 05:52:50 am
    • MaLa - M.A.M.E. Launcher
Re: Reflection + Gradual Alphablending on a Layout
« Reply #18 on: February 17, 2007, 12:24:10 pm »
Hey SWINDUS, any chance in getting the refection thing in MaLa? please please please

MaLa is a pure GDI application and not a DirectX application. I don't think that it is possible to do this with GDI stuff.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19400
  • Last login:May 27, 2024, 04:25:50 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Reflection + Gradual Alphablending on a Layout
« Reply #19 on: February 17, 2007, 06:04:33 pm »
Hey SWINDUS, any chance in getting the refection thing in MaLa? please please please

MaLa is a pure GDI application and not a DirectX application. I don't think that it is possible to do this with GDI stuff.

It's possible, it'd just be slow.  The trick is you render the object twice, once upside-down.  The blending is just regular blending effects.  Or at least it would be if I had coded it. 

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: Reflection + Gradual Alphablending on a Layout
« Reply #20 on: February 18, 2007, 05:11:31 am »
You could use AlphaBlend API function.
« Last Edit: February 18, 2007, 02:24:00 pm by headkaze »

audiomidiman

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 99
  • Last login:February 07, 2015, 11:40:00 pm
Re: Reflection + Gradual Alphablending on a Layout
« Reply #21 on: February 18, 2007, 04:35:10 pm »
Nice......

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19400
  • Last login:May 27, 2024, 04:25:50 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Reflection + Gradual Alphablending on a Layout
« Reply #22 on: February 18, 2007, 07:07:31 pm »
You could use AlphaBlend API function.

Yeah I mean even if you don't have the gui setup to rotate objects sending stretchblt with a top lower than the bottom automatically mirrors any image.

youki

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1612
  • Last login:November 19, 2016, 01:07:33 pm
  • Atomic Front End Creator
    • Atomic Front End
Re: Reflection + Gradual Alphablending on a Layout
« Reply #23 on: February 19, 2007, 03:49:41 am »
Quote
MaLa is a pure GDI application and not a DirectX application. I don't think that it is possible to do this with GDI stuff.

It is easiest with GDI, as said HeadKaze use AlphaBlend function.  Not sure about performance, but it supports hardware acceleration , so if you have a modern video card it should be good. 
The function does not support mirroring, so i guess you will have to mirror before alphablend.

The other solution is to manipulate directly image bits.  (it is what i do with DirectDraw , because DirectDraw doesn't support Alpha Blend without a specific hardware doing that... and i never saw a "commun" video card supporting that feature (via DirectDraw) )  but if you use only GDI i think the Alphablend function would be the best solution.




headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: Reflection + Gradual Alphablending on a Layout
« Reply #24 on: February 19, 2007, 04:52:01 am »
Yep, your both right, I just knocked up a demo using GDI+ to create a reflection...

You use StretchBlt to flip it vertically to a MemDC (using CreateCompatibleDC/CreateCompatibleBitmap), then use AlphaBlend to draw each part gradually fading to the bottom.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19400
  • Last login:May 27, 2024, 04:25:50 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Reflection + Gradual Alphablending on a Layout
« Reply #25 on: February 19, 2007, 04:22:41 pm »
It's a little frightening when we are all on the same page.  I keep expecting the earth to crack open and hell-spawn to pop out.   ;)

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: Reflection + Gradual Alphablending on a Layout
« Reply #26 on: February 20, 2007, 02:01:01 am »
lol Who will be the first to greet this hell-spawn? I vote you first >:D

youki

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1612
  • Last login:November 19, 2016, 01:07:33 pm
  • Atomic Front End Creator
    • Atomic Front End
Re: Reflection + Gradual Alphablending on a Layout
« Reply #27 on: February 20, 2007, 03:27:14 am »
It's a little frightening when we are all on the same page.  I keep expecting the earth to crack open and hell-spawn to pop out.   ;)

lol ... inded really terrifying!!   :-\

csa3d

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 872
  • Last login:March 07, 2011, 08:16:35 am
  • Will game for food
    • Galaxian Mame Conversion
Re: Reflection + Gradual Alphablending on a Layout
« Reply #28 on: February 20, 2007, 07:11:50 am »
so which one of you agreeing parties is going to write that Mala Plugin to support this 'not needed but much anticipated' functionality?  :)

-csa

youki

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1612
  • Last login:November 19, 2016, 01:07:33 pm
  • Atomic Front End Creator
    • Atomic Front End
Re: Reflection + Gradual Alphablending on a Layout
« Reply #29 on: February 20, 2007, 07:14:42 am »
so which one of you agreeing parties is going to write that Mala Plugin to support this 'not needed but much anticipated' functionality?  :)

-csa

This plugin already exists ... it is called AtomicFE !  ;D    Just run Atomic from Mala!  ;)

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: Reflection + Gradual Alphablending on a Layout
« Reply #30 on: February 20, 2007, 07:31:38 am »
hehe but seriously, you can't write a plugin to do this, swindus will need to think it's worth adding to the Mala FE. Personally I think using the method proposed by me would work great with Mala. In fact it would work for Atomic or GameEx as well. The thing is, what you failed to metion Youki is that you can get a handle to the dc of surfaces in Direct Draw. So you can actually BiBlt to them or whatever use AlphaBlend API. It would probably be faster than doing per bit alpha bending like you've done. You might want to include that as a feature for slower machines.
« Last Edit: February 20, 2007, 07:35:09 am by headkaze »

youki

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1612
  • Last login:November 19, 2016, 01:07:33 pm
  • Atomic Front End Creator
    • Atomic Front End
Re: Reflection + Gradual Alphablending on a Layout
« Reply #31 on: February 20, 2007, 08:03:00 am »
In fact not.  It is one of the first thing i tried 3 years ago before starting to write my own routines.

I mean it doesn't work in the context of Atomic with some guide line i wanted for Atomic.

I wanted to Atomic works on 16bit colors depth  not 24 or 32. Just to save "memory" . Remind that i wanted Atomic works on a very wide range of configuration (slow, average, fast...) . And i planned to do advanced animated layout that could require lot of images in memory...

Alphablend function with 16bit image does not manage "Transparent" color.  you can only set the same transparency on all points of the image.  But not say, the RGB(255,0,255) is not visible for the entire image.

And AlphaBlend function does not manage Gradual Transparency on 16 bit image.  If you want to that, you have to use 32bit/pixel images.

In addition the fact to use 32bit/pixel image with Alphachanel in a layout would require that the user who is making the layout knows this concept and knows how to work with Photoshop to do what he wants. That's require some graphics skill that not  everybody have.  I wanted something as simple as possible when you build the layout.  Atomic use simple image, and you can apply AlphaBlending (gradual or not) on every images, you don't need to play with AlphaChannel or so...

So mainly due to this 3 points , i decided to go to my own routines.

Now, in the context of another Front End , of course it should work.

Quote
you can't write a plugin to do this,

It depends only how your plugin system is done.  Technically it is perfectly doable from a plugin.
Swindus would have to enhance his current plugins system , i think.
 

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: Reflection + Gradual Alphablending on a Layout
« Reply #32 on: February 20, 2007, 08:33:16 am »
No but your wrong, I'm talking about using AlphaBlend function in a loop, so you use for example divide the height up into 10 peices then AlphaBlend them one by one using different levels.

It is still faster than using per pixel alpha blending.

The "gradual transperancy" you descripe is accomplished in the loop, in chunks, not per pixel like you do.

youki

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1612
  • Last login:November 19, 2016, 01:07:33 pm
  • Atomic Front End Creator
    • Atomic Front End
Re: Reflection + Gradual Alphablending on a Layout
« Reply #33 on: February 20, 2007, 08:59:27 am »
So you are saying is i want alpha blend 64000 pixels with no contigous alpha value  , i call 64000 times AlphaBlend??

Even if you try to optimise by finding "contigous" values and Alphablending little zones , that you could win using the alphablend  you will lost by finding the chunks where you will have anyway to go pixel by pixel.

Or may be i don't  get your point ?

Anyway i'm pretty sure that 64000 call to a Alphablend function is slower than changing 640000 WORD directly in memory on the back buffer.


headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: Reflection + Gradual Alphablending on a Layout
« Reply #34 on: February 20, 2007, 09:10:56 am »
No, I'm saying use AlphaBlend in chuncks, not pixel by pixel.

Code: [Select]
StretchBlt(hMemDC, 0, 0, width, height, hDCSrc, 0, height - 1, width, -height, SRCCOPY);

for(int i=0; i<levels; i++)
AlphaBlend(hDCDest, left, top + height + i * Size, width, size, hMemDC, 0, i * Size, width, size, fcn, 0);

youki

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1612
  • Last login:November 19, 2016, 01:07:33 pm
  • Atomic Front End Creator
    • Atomic Front End
Re: Reflection + Gradual Alphablending on a Layout
« Reply #35 on: February 20, 2007, 09:42:37 am »
ok, you are alphablending by strip here.

But i don't really see the interrest.

Except you could have a different alpha value for each strip.    But the effect you obtain is really limited.

And you don't manage ColorKey (Transparent Color) .

In this particular case, i agree i should be faster that the pixel method , but it would be only for a very particular case.



Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19400
  • Last login:May 27, 2024, 04:25:50 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Reflection + Gradual Alphablending on a Layout
« Reply #36 on: February 20, 2007, 03:44:42 pm »
Way back in the day when dinosaurs roamed the earth I used to "fake" a similar effect in lazarus.  It would slow down the rendering a tad, but it should give for a more realistic blend.  The details escape me, but basically you'd take a black to white (or white to black) gradient, xor it with the image and then render them with the transparent paint option in the gdi.  Now it wasn't prefect, but it got the job done.  Sometimes you had to change the color of the gradient depending upon the background image though or else it'd stick out that it's not really a gradual fade. 

youki

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1612
  • Last login:November 19, 2016, 01:07:33 pm
  • Atomic Front End Creator
    • Atomic Front End
Re: Reflection + Gradual Alphablending on a Layout
« Reply #37 on: February 21, 2007, 03:15:22 am »
I know this method it is something i used on my Atari St to do this kind of Effect. Indeed, you can simulate a kind of alphablend effect with the XOR.