Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Fade-in/fade-out
2006-05-03 10:18
Axel
Account closed

Registered: Apr 2006
Posts: 42
Fade-in/fade-out

How to fade-in and fade-out Multicolor picture?
How to code it?
2006-05-03 12:16
TNT
Account closed

Registered: Oct 2004
Posts: 189
Build suitable color fade table(s), easiest one is constant speed for all colors so dark colors reach black before light ones. That needs only one table. Then do something like

   lda #>scr
   sta .1+2
   sta .2+2
   lda #$d8
   sta .3+2
   sta .4+4
   ldy #0
.1 ldx scr,y
   lda table,x
.2 sta scr,y
.3 ldx $d800,y
   lda table,x
.4 sta $d800,y
   iny
   bne .1
   inc .1+2
   inc .2+2
   inc .3+2
   inc .4+2
   lda .4+2
   cmp #$dc
   bcc .1


Don't forget to fade $d021 as well. The above should be fast enough for every second frame. Fading up is trickier, but can be done with N tables where N is number of steps you want.
2006-05-03 17:11
Oswald

Registered: Apr 2002
Posts: 5094
TNT, you should have explainedthe tables, applying them is a piece of cake, and that doesnt explains anything.
2006-05-03 19:23
raven
Account closed

Registered: Jan 2002
Posts: 137
There's a faster way which i like to use, but it takes
more memory.

you can set-up in advance the fading color-screens inside
your gfx bank(s) and then 'animete' them by changing $d018.
This way you only have to actually handle colram in realtime.

By set-up in advance i mean generating them on-the-fly, not
having them in memory (or loading them) ofcoz..
The same tables apply here, as usual.

As for the tables: you use the current color as index to
the table, the returned value is the new color which
should be lower (or higher) in brightness.
It takes some experimenting to find the best fade sequence
for each color.
2006-05-03 21:32
TNT
Account closed

Registered: Oct 2004
Posts: 189
Oswald: the people I know think it's self-explanatory already :) As Raven already told - upper and lower nybbles have wanted color sequence where index is old color, table value is the new one. Lets take first 16 entries for fading only red/blue:

00 0f 09 0e 02 0c 00 0c 09 00 02 00 0b 05 06 0c

High nybble stays zero as it was already black, white goes through 01-0f-0c-0b-00, red 02-09-00 etc. To expand the table to 256 entries you use the same 16-byte sequence for low nybbles, but change the high nybble every 16 bytes. Using single table forces the same end sequence to all colors having same color anywhere in the sequence, so multiple tables for different steps gives nicer result. That way you can also make colors reach black/white with correct relative speed.
2006-05-03 21:52
Oswald

Registered: Apr 2002
Posts: 5094
tnt, well done :)

anyone ever done a fader so that all colors reaches black/white at the same time ? I'd like to check some examples.
2006-05-04 06:11
Hein

Registered: Apr 2004
Posts: 954
You can create a table which has such values. There was a period in Amiga democreating people created fades with certain shades, like blue fades, red fades and such. Allthough c64 colourspectrum is too small to get a good result.

Final part in Cosmail has such fade, it fades to blue first before it fades to black.

2006-05-04 06:22
Zyron

Registered: Jan 2002
Posts: 2381
Hmm, didn't Spirit use fades like that in Spiritual Dreams?
2006-05-04 07:56
Spinball

Registered: Sep 2002
Posts: 88
to get your fades the easy way you can also use hires-fader v1/2 from grize shazam. (can be found here: Shazam Tool Collection )
2006-05-04 08:10
WVL

Registered: Mar 2002
Posts: 902
A while ago i made a small tool for Pinball dreams to optimize bitmaps for fading.

Maybe I should release it someday.. it allows to fade every char at a specific time, (even all at the same time if you like it). The routine easily runs at 50fps for 99% of the bitmaps.

If there are enough ppl asking for it, I will release it to the public, including the c64 sources..

maybe it's better if i explain how it works :)

The tool analyzes the picture, and checks how many colors are used in each char. If it is only one color (excluding d021), it will put this color in the $d800 bitcombo. If there are 2 colors, it will put them in the $0400 bitcombo.

This way you can very easily generate some speedcode which only needs to update the minimum number of bytes -> faster -> you manage in 1 frame.
2006-05-04 08:38
Ninja

Registered: Jan 2002
Posts: 411
Release it! You never know when it gets useful for someone. :D

That reminds me that I could release my C-Koala-Remapper, too, somewhen. It really helps when packing GFX. Sigh, so much to do...
 
... 3 posts hidden. Click here to view all posts....
 
Previous - 1 | 2 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
ΛΛdZ
kbs/Pht/Lxt
algorithm
radius75
Guests online: 95
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 The Demo Coder  (9.6)
6 Edge of Disgrace  (9.6)
7 What Is The Matrix 2  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 No Listen  (9.6)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 X-Mas Demo 2024  (9.5)
7 Dawnfall V1.1  (9.5)
8 Rainbow Connection  (9.5)
9 Onscreen 5k  (9.5)
10 Morph  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Censor Design  (9.3)
5 Triad  (9.3)
Top Musicians
1 Rob Hubbard  (9.7)
2 Mutetus  (9.7)
3 Jeroen Tel  (9.7)
4 Linus  (9.6)
5 Stinsen  (9.6)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.063 sec.