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 > Palette effects
2009-04-01 22:44
Carlos
Account closed

Registered: Mar 2009
Posts: 15
Palette effects

Hi!

This is my first post in CSDB, after a long time as owner of a C64 and use it only for playing games and watching demos i decided to do the step and learn graphics programming.

The way i chose to do it is making a game, now after a couple of months i understand more or less the basic stuff (sprites, bitmap and char modes, ...).

I would like to know if is possible to do palette effects with the C64. Some years ago i used to program some graphic effects with my 486 PC and the palette is very different in it (RGB components for each color) but the C64 have a total different conception.

How is possible to do effects like fade an image to black (i have seen it in demos) o transform a bitmap picture in, for instance, grayscale??


2009-04-01 23:13
SIDWAVE
Account closed

Registered: Apr 2002
Posts: 2238
you only have the 16 colors.
to do a fade, you must poke a bright color, then a not so bright, and even less bright, and then a dark - to get the fade out effect.

example: 1-f-b-0 (white->grey->black)

to make a bitmap greyscale, you must repoke all the colors in it, to grey shades..
2009-04-01 23:37
chatGPZ

Registered: Dec 2001
Posts: 11386
palette effects like you can do in vga are not possible on the c64 (the palette is fixed). you have to alter the color attributes to achive similar effects.
2009-04-02 03:25
Stryyker

Registered: Dec 2001
Posts: 468
The closest you get to palette effects are changing sprite colours, multicolour character mode or EBCM mode. After that you're left with using bitmap mode and changing memory banks then down to the long and heavy way that has been discussed earlier.
2009-04-02 17:52
Graham
Account closed

Registered: Dec 2002
Posts: 990
Quoting Groepaz
you have to alter the color attributes to achive similar effects.

You don't have to. You can also precalculate several images and simply play a "palette effect" animation.
2009-04-02 18:41
Oswald

Registered: Apr 2002
Posts: 5094
Quote: Quoting Groepaz
you have to alter the color attributes to achive similar effects.

You don't have to. You can also precalculate several images and simply play a "palette effect" animation.


which is memory wise horribly ineffective compared to the first method. in fact useless.

to the original question:

to fade bitmaps you would generate a so called "speedcode" which has a code sniplet for each attribute byte.


lda fadetable,x
sta $0400
lda fadetable,x
sta $d800

you have the above code 1000x times, for each attribute address you use a different "fadetable" which table holds the color values to colorfade the corresponding original color. then by changing the value of the X reg and calling the above code you achieve the actual fade effect.

transforming to grey works similarly, you set up a table which tells for each color what its grey value will be, then you apply this to the attributes.
2009-04-03 18:46
Cruzer

Registered: Dec 2001
Posts: 1048
Don't think I've ever done a bitmap fader, but I guess the tricky part is to determine how each color should be faded down. For instance, a gray color can be part of a gray area, in which case grayish colors should be used for the fade table, or it might be part of some other shading, like blue, in which case a blueish palette would be a better choice.

Wonder if anyone has actually done a fader that cares about these things, or if it's just always 16 standard fade tables, regardless of the context.
2009-04-03 19:16
Hein

Registered: Apr 2004
Posts: 954
This also requires a annoyingly slow rol-scroll explaining the context-dependant-bitmap-fade, else no one sees it.
2009-04-03 19:59
Oswald

Registered: Apr 2002
Posts: 5094
Quote: Don't think I've ever done a bitmap fader, but I guess the tricky part is to determine how each color should be faded down. For instance, a gray color can be part of a gray area, in which case grayish colors should be used for the fade table, or it might be part of some other shading, like blue, in which case a blueish palette would be a better choice.

Wonder if anyone has actually done a fader that cares about these things, or if it's just always 16 standard fade tables, regardless of the context.


16 colors is not enough to do that imho. what I've heard that some coders set up a blue&red&gray(?) fadetable and use those two.

smth like:

0,9,2,8,a,f,7,1
0,6,4,5,?,3,d,1
...


another idea is to make sure all colors reach black at the same time. usually that doesnt happens.
2009-04-03 21:28
Stainless Steel

Registered: Mar 2003
Posts: 966
Crossbow has explained a great bitmap fader here. Its in German though but there's a binary example in the thread somewhere that worked pretty good for me.
2009-04-04 14:34
Hermit

Registered: May 2008
Posts: 208
Have you seen my picture watcher already which I wrote in 1998? I made it for manipulating Art studio MC images after loading.
It can convert colours and fadings & RGB to Black&White with the colour-fading palette.

You can find it on the disk of my 3SID tracker between some other usefool:) tools?

Hermit 3SID-Tracker 2008

Update: I've just released it as independent tool on D64:

http://noname.c64.org/csdb//release/?id=77445

Hermit Software Hungary
2009-04-06 10:48
Carlos
Account closed

Registered: Mar 2009
Posts: 15
thnks for all suggestions! i will try for sure some of them.
2009-04-06 11:22
Mace

Registered: May 2002
Posts: 1799
Quote: which is memory wise horribly ineffective compared to the first method. in fact useless.

to the original question:

to fade bitmaps you would generate a so called "speedcode" which has a code sniplet for each attribute byte.


lda fadetable,x
sta $0400
lda fadetable,x
sta $d800

you have the above code 1000x times, for each attribute address you use a different "fadetable" which table holds the color values to colorfade the corresponding original color. then by changing the value of the X reg and calling the above code you achieve the actual fade effect.

transforming to grey works similarly, you set up a table which tells for each color what its grey value will be, then you apply this to the attributes.


Oswald, your routine to fade $0400-colours takes 6 bytes per char.
That is (almost) as memory inefficient as doing 6 different charscreens for colours.
You still need $d800 of course and you loose some bytes between $xxe8-xxff, but then again, you might only need 4 or 5 colours to do a fade!

So speedcode takes as much memory as a $d018 toggle.
On top it leaves you less rastertime.

I'm with Graham if you'd want to fade an entire screen.
It's a different ballgame if you want to do only parts of the screen...
2009-04-06 11:30
enthusi

Registered: May 2004
Posts: 677
I wrote a blender for HiRes once that was rather small.
It toggled d018 only between 2 colorams. (that should suffice, instead of 1 screen per fade)
Setting up the next one while showing one.
It was rather slow (no 256 Table, just 2x 16 for high,low-nibble) but certainly fast enough to prepare a full screen within a few frames that pass between each fade.
N2C4Oxy07
Does that in realtime without buffer (which shows unfortunately ;-) btw...
2009-04-06 12:09
Oswald

Registered: Apr 2002
Posts: 5094
Quote: Oswald, your routine to fade $0400-colours takes 6 bytes per char.
That is (almost) as memory inefficient as doing 6 different charscreens for colours.
You still need $d800 of course and you loose some bytes between $xxe8-xxff, but then again, you might only need 4 or 5 colours to do a fade!

So speedcode takes as much memory as a $d018 toggle.
On top it leaves you less rastertime.

I'm with Graham if you'd want to fade an entire screen.
It's a different ballgame if you want to do only parts of the screen...


Graham was talking about precalculating images and not attributes. I was replying to that.

you can optimize "my" routine, fex, you dont need to reload "fadetable,x" for the same colors. and you dont need to add code where the bitmap is empty.

anyway, one can always come up with a better approach than the general solution, if adding new restrictions (nr of fadeframes, at 8 you'll already need 2 vicbank with twice the bitmap.. oops).
2009-04-12 15:53
chancer

Registered: Apr 2003
Posts: 347
Carlos... things like

Shattered

might be of interest to you also..

but if you know the structure of the colour maps. Then the theory you can apply to any machine.. things like colour cycling etc. things like where you have a logo.. it's one set of 3 colours (+ the background).. then fades out , then comes back as another 3 colours etc..

most things have a dark / medium / light value colour.. e.g. the 3 shades of grey.. so you check to see how the colour state is..e.g. if it's a dark blue... you'd replace it with the darkest grey etc.

well that's my simplistic approach to it.. others who posted previously are FAR more qualified about such things.

I guess you can do it using math functions like ROL / AND etc.. or pre-calc'd methods.
2010-10-12 21:57
Digger

Registered: Mar 2005
Posts: 437
I've actually written an editor for creating color fade maps 15 years ago. Check it out here: Color Fade Editor
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
Peacemaker/CENSOR/Hi..
The Human Co../Maste..
ΛΛdZ
daimansion
megasoftargentina
fugu/Excess
chronos/Therapy
JSL
kbs/Pht/Lxt
REBEL 1/HF
krissz
Mibri/ATL^MSL^PRX
DeMOSic/MS^LSD^ONS
Guests online: 111
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (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 Dawnfall V1.1  (9.5)
7 Rainbow Connection  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (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 Webmasters
1 Slaygon  (9.6)
2 Perff  (9.6)
3 Sabbi  (9.5)
4 Morpheus  (9.4)
5 CreaMD  (9.1)

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