| |
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? |
|
| |
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. |
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
TNT, you should have explainedthe tables, applying them is a piece of cake, and that doesnt explains anything. |
| |
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. |
| |
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. |
| |
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. |
| |
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.
|
| |
Zyron
Registered: Jan 2002 Posts: 2381 |
Hmm, didn't Spirit use fades like that in Spiritual Dreams? |
| |
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 ) |
| |
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. |
| |
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 |