Archived

This topic is now archived and is closed to further replies.

ncsu121978

fade in/out

Recommended Posts

In order to fade in/out you have to use 256/8-bit colors which would be using a palette... That''s the easiest/fastest way to get what you want.. you can do a fade in/out wiht 16-bit/24-bit/32-bit colors as well but you would have to use some kind of map... It''s like making a fire demo in 16-bit.. In order to make that I created my own palette colors and used a separate buffer to save the indices of the color form the palette... Anyways... Hope you get the idea.. if not ask some more specific questions and I''ll try to get back to you when possible.. (or maybe someone else would before me

..-=ViKtOr=-..

Share this post


Link to post
Share on other sites
quote:
Original post by Gladiator

you can do a fade in/out wiht 16-bit/24-bit/32-bit colors as well but you would have to use some kind of map...




You can perform fading by simply playing with alpha-channels and do some sort of translucency with a black.

Or you can use gamma values, too.

Search thru'' GameDev''s archive. You should be able to find out some useful references.


Karmalaa

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
You can perform fading by simply playing with alpha-channels and do some sort of translucency with a black.


i tried that a few weeks back - it was damn SLOW
looked cool though.

what do you mean gamma values? i dont see where you''re going with that...(please elaborate, if it helps me get a fast fade going i''ll be one happy camper )

Share this post


Link to post
Share on other sites
DirectX has a Gamma Interface that will do a great job of fading the screen but it only works in fullscreen mode and not all cards support it. If you want a 16bpp and greater fade in/out function that works on all cards then you can take a look at CDX (www.cdx.sk). It uses a specific case of alpha-blending to perform the fade. It can be found in the CDXScreen class and the function names are FadeToBlack and FadeToSource. It is written in C++ so it should be easy to understand. If you need to speed it up check out my AlphaBlending article here on GameDev.

Goodluck,
hebertjo

Share this post


Link to post
Share on other sites
Im thinking you can draw 3,000 or whatever random pixels to the screen (a.l.a Andre) for a fade in/out. Much simpler, much faster.

-----------------------------

A wise man once said "A person with half a clue is more dangerous than a person with or without one."

Share this post


Link to post
Share on other sites
Cant you just loop through the back buffer and alter the color by some kind of add/subtract to get the desired effect. Doing this in assembly should yeild a decent result. I don''t know enough about the color spaces that you use to provide any code. I have never tried it and it may prove to be too slow.

Share this post


Link to post
Share on other sites
The alpha trianglestrip is the easiest/fastest way of doing it. Trust me, I just did it last night for my contest entry. I also tried it in software mode.

------------------------
Captured Reality.

Share this post


Link to post
Share on other sites
Take your final image, and subtract some number from every byte. Then for the next frame subtract a smaller number, until you''re subtracting zero. If you use 24 or 32 bit colors then you can use PSUBUSB to stop wraparound. It is incredibly fast!

Share this post


Link to post
Share on other sites
Alright, blue lightning has a strange way of doing things, but I''ll tell you mine.

The alpha trianle strip (what I call it) is basically a set of 4 D3DTLVERTEX structures that is alphablended with any 3d/2d scene. If you don''t have the slightest clue about Direct3D then you might want to look at blue lightnings trick.

------------------------
Captured Reality.

Share this post


Link to post
Share on other sites
3000 random pixels in the same or close place? I suggest you do the probability math. Even if it is 640x480 display then 640*480*3000 is the probability of the pixel appearing in the same place.

-----------------------------

A wise man once said "A person with half a clue is more dangerous than a person with or without one."

Share this post


Link to post
Share on other sites
i had asked this question a while back, you should look for it, I don''t know if it was under this name, or my former alias, Squall012...hope you can find it, i was guided to a tutorial, ill go looking for it

Share this post


Link to post
Share on other sites
yes immagnuman......you are right about the probability.......but putting 3000 random pixels in 307,100 dirrerent locations.......i wouldnt think that would have a good effect like fading

"Now go away or I shall taunt you a second time"
- Monty Python and the Holy Grail
themGames Productions

Share this post


Link to post
Share on other sites
Yah there''s a tutorial on MMX enhanced Alpha Blitting in C or C++ in the GameDev.net resources. You could modify it slightly so it''s just alphablending with black at different levels. So start with it being 0% black and fade it more and more black.
Make sense?
Hope so.
See ya,
Ben

Share this post


Link to post
Share on other sites
Wouldnt the easiest thing be to lock the backbuffer, then scan through each pixel in a loop and decrease the colour values by a certain percentage (depending on how fast you want the fade to be). This seems to work for me..

Share this post


Link to post
Share on other sites
That works for fading out, but not in. Also fading by percentages doesn''t work so great; it''s easier just to subtract values.

For a good time hit Alt-F4! Go ahead try it, all the cool people are doing it.

Share this post


Link to post
Share on other sites