Jump to content
IGNORED

Color fading, is it possible?


Lodmot

Recommended Posts

Hi,

I want to try and do this "fading" effect with colors in two of my Atari games, one which I haven't even started coding yet.

Does anyone know if this is possible?

 

The effect that I'm trying to achieve is in my original version of Game Catcher right at the titlescreen in the background, which you can see here:

http://megatoxic.com/Games/Game%20Catcher.exe

 

If anyone knows if this is possible at all, I'd like to know. ^^

Thanks!

Link to comment
Share on other sites

Well, I tried it, and it sorta works, but the effect is pretty choppy. I think if the TIA had more color options I could create a smoother-looking fade. I'm not really too crazy for the way it looks.

I kinda wanted it to look like an acid trip sorta. xDD

Link to comment
Share on other sites

Well, granted, I did get it to look nicer than I was thinking I could... but I'd still like it to be better xDDD

I ish picky that way. > :D

 

EDIT: This is pretty sweet. I actually managed to get a pretty nice color-fading effect that I like.

Only issue is, it uses a bit more variables than I'd like.. Perhaps I can condense the amount of variables down somehow..

 

But anyway, take a look. Oh, and if anyone wants to use the code, by all means go for it. ^^

default.bas.bin

Edited by Lodmot
Link to comment
Share on other sites

maybe if you rapidly switched between 2 colors as it progressed it might look less jumpy.

Say to go from A-B instead of A,A,A,A,A,A,A,A,B,B,B,B,B,B,B,B

You did A,A,A,A,A,A,A,A,B,A,A,A,A,B,A,A,A,A,B,A,A,B,A,A,B,A,B,A,BB,A,BB,A,BBB,A,BBBB,A,BBBB,A,BBBBBBBB

(Please no Abba jokes...)

Or if you dithered it, but that would be more like real work to me!

Link to comment
Share on other sites

You can flicker between hues as Pioneer4x4 suggested, and you can also interleave colors together (with or without flickering).

 

Here's a little "palette" program I did a few years ago that displays 480 colors by mixing the hues and luminances via flickering.

 

The odd rows are solid hues, and the even rows combine the adjacent hues by flickering between them. Thus-- row 1 = hue 0 by itself, row 2 = hue 0 mixed with hue 1, row 3 = hue 1 by itself, row 4 = hue 1 mixed with hue 2, and so on. The last row mixes hue 15 with hue 2.

 

The odd columns are solid luminances, and the even columns combine the adjacent luminances by flickering between them. Thus-- column 1 = luminance 0 by itself, column 2 = luminance 0 mixed with luminance 2, column 3 = luminance 2 by itself, and so on, up to row 15 = luminance 14 by itself.

 

I've included the source code in case you want to look at it.

 

post-7456-0-94229400-1333599795_thumb.png

480_Colors.zip

Link to comment
Share on other sites

I'll have to try that out on real hardware, looks cool. I did it on stella, and looks perfect after <ALT>P.

Probably looks funky on a LCD TV.

I manually cycled frames, and that was a great idea to shift the pallette with partial overlap. (Far more efficient than what I was thinking!)

Link to comment
Share on other sites

Interesting..

I wonder if there's a way to have the background fade between all those shades of colors.

I don't think I'd have enough code to do it in Game Catcher at this point, because I had just about 200 bytes left to work with in the bank where the titlescreen is. But for my other game that I want to do the color fade effect for, I'll definitely have to try this out.

 

Also, any way to translate that into bB?

Edited by Lodmot
Link to comment
Share on other sites

Probably looks funky on a LCD TV.

I assume it will depend on the TV. My HD LCD TV displays it exactly like the following screenshot from the z26 emulator with the "interlaced" option turned on.

 

post-7456-0-05935100-1333680488_thumb.png

Wow, I didn't try messing with interlace setting. I need to fire it up on hardware. Looks even better, if you squint some blur in, there is a ton of shades.

Link to comment
Share on other sites

I wonder if there's a way to have the background fade between all those shades of colors.

I don't see why not.

 

I don't think I'd have enough code to do it in Game Catcher at this point, because I had just about 200 bytes left to work with in the bank where the titlescreen is. But for my other game that I want to do the color fade effect for, I'll definitely have to try this out.

Keep in mind, I just used flickering, not interleaving, so it should be easy to fade between different background hues-- although you'd have to add a loop and some data bytes to read the hues from. You might be able to fit it in.

 

Also, any way to translate that into bB?

I once posted a 128-color palette program using batari Basic commands to do the custom kernel instead of assembly commands, so it might be possible to do a similar program using all bB commands.

Link to comment
Share on other sites

Can anyone get the following code to compile? I don't see anything wrong with it, but whenever I try to compile it I get a 2600basic.exe runtime error ("2600basic.exe has encountered a problem and needs to close.").

 

  rem * Background Color Fade

  dim color1 = a
  dim color2 = b
  dim color3 = c
  dim color4 = d
  dim jiffies = e
  dim seconds = f

  jiffies = 0 : seconds = 0
  color1 = $16 : color2 = $16 : color3 = $16 : color4 = $16

loop
  gosub drawloop
  color1 = color1 + $10 : if color1 = $06 then color1 = $16
  gosub drawloop
  color3 = color3 + $10 : if color3 = $06 then color3 = $16
  gosub drawloop
  color2 = color2 + $10 : if color2 = $06 then color2 = $16
  gosub drawloop
  color4 = color4 + $10 : if color4 = $06 then color4 = $16
  goto loop

drawloop
  COLUBK = color1
  drawscreen
  COLUBK = color2
  drawscreen
  COLUBK = color3
  drawscreen
  COLUBK = color4
  drawscreen
  jiffies = jiffies + 4
  if jiffies = 60 then jiffies = 0 : seconds = seconds + 1
  if seconds < 4 then goto drawloop
  seconds = 0
  return

 

The program is supposed to cycle through all 15 hues (excluding hue 0), using flicker to change hues gradually as follows:

1,1,1,1 (100% hue 1)

2,1,1,1 (25% hue 2, 75% hue 1)

2,1,2,1 (50% hue 2, 50% hue 1)

2,2,2,1 (75% hue 2, 25% hue 1)

2,2,2,2 (100% hue 2)

3,2,2,2 (25% hue 3, 75% hue 2)

3,2,3,2 (50% hue 3, 50% hue 2)

3,3,3,2 (75% hue 3, 25% hue 2)

3,3,3,3 (100% hue 3)

4,3,3,3 (25% hue 4, 75% hue 3)

4,3,4,3 (50% hue 4, 50% hue 3)

4,4,4,3 (75% hue 4, 25% hue 3)

4,4,4,4 (100% hue 4)

etc.

Link to comment
Share on other sites

I did a few searches using keywords like "128" and "palette" without finding your bB example SeaGtGruff. If you find your old posts I'd really like to see your work.

Here you go...

 

  rem * palette.bas
kernel_loop
  VBLANK = 2 : WSYNC = 2 : WSYNC = 2 : WSYNC = 2 : WSYNC = 2
  VSYNC = 2 : WSYNC = 2 : WSYNC = 2 : WSYNC = 0 : VSYNC = 0
  for x = 1 to 15 : WSYNC = 0 : next : VBLANK = 0
  for x = 1 to 23 : WSYNC = 0 : next : x = 0
hue_0_loop
  WSYNC = 0 : x = x + 1 : if x = 12 then hue_1
  COLUBK = $08 : COLUBK = $08 : COLUBK = $08
  COLUBK = $00 : COLUBK = $02 : COLUBK = $04 : COLUBK = $06
  COLUBK = $08 : COLUBK = $0A : COLUBK = $0C : COLUBK = $0E
  COLUBK = $08 : goto hue_0_loop
hue_1
  x = 0
hue_1_loop
  WSYNC = 0 : x = x + 1 : if x = 12 then hue_2
  COLUBK = $08 : COLUBK = $08 : COLUBK = $08
  COLUBK = $10 : COLUBK = $12 : COLUBK = $14 : COLUBK = $16
  COLUBK = $18 : COLUBK = $1A : COLUBK = $1C : COLUBK = $1E
  COLUBK = $08 : goto hue_1_loop
hue_2
  x = 0
hue_2_loop
  WSYNC = 0 : x = x + 1 : if x = 12 then hue_3
  COLUBK = $08 : COLUBK = $08 : COLUBK = $08
  COLUBK = $20 : COLUBK = $22 : COLUBK = $24 : COLUBK = $26
  COLUBK = $28 : COLUBK = $2A : COLUBK = $2C : COLUBK = $2E
  COLUBK = $08 : goto hue_2_loop
hue_3
  x = 0
hue_3_loop
  WSYNC = 0 : x = x + 1 : if x = 12 then hue_4
  COLUBK = $08 : COLUBK = $08 : COLUBK = $08
  COLUBK = $30 : COLUBK = $32 : COLUBK = $34 : COLUBK = $36
  COLUBK = $38 : COLUBK = $3A : COLUBK = $3C : COLUBK = $3E
  COLUBK = $08 : goto hue_3_loop
hue_4
  x = 0
hue_4_loop
  WSYNC = 0 : x = x + 1 : if x = 12 then hue_5
  COLUBK = $08 : COLUBK = $08 : COLUBK = $08
  COLUBK = $40 : COLUBK = $42 : COLUBK = $44 : COLUBK = $46
  COLUBK = $48 : COLUBK = $4A : COLUBK = $4C : COLUBK = $4E
  COLUBK = $08 : goto hue_4_loop
hue_5
  x = 0
hue_5_loop
  WSYNC = 0 : x = x + 1 : if x = 12 then hue_6
  COLUBK = $08 : COLUBK = $08 : COLUBK = $08
  COLUBK = $50 : COLUBK = $52 : COLUBK = $54 : COLUBK = $56
  COLUBK = $58 : COLUBK = $5A : COLUBK = $5C : COLUBK = $5E
  COLUBK = $08 : goto hue_5_loop
hue_6
  x = 0
hue_6_loop
  WSYNC = 0 : x = x + 1 : if x = 12 then hue_7
  COLUBK = $08 : COLUBK = $08 : COLUBK = $08
  COLUBK = $60 : COLUBK = $62 : COLUBK = $64 : COLUBK = $66
  COLUBK = $68 : COLUBK = $6A : COLUBK = $6C : COLUBK = $6E
  COLUBK = $08 : goto hue_6_loop
hue_7
  x = 0
hue_7_loop
  WSYNC = 0 : x = x + 1 : if x = 12 then hue_8
  COLUBK = $08 : COLUBK = $08 : COLUBK = $08
  COLUBK = $70 : COLUBK = $72 : COLUBK = $74 : COLUBK = $76
  COLUBK = $78 : COLUBK = $7A : COLUBK = $7C : COLUBK = $7E
  COLUBK = $08 : goto hue_7_loop
hue_8
  x = 0
hue_8_loop
  WSYNC = 0 : x = x + 1 : if x = 12 then hue_9
  COLUBK = $08 : COLUBK = $08 : COLUBK = $08
  COLUBK = $80 : COLUBK = $82 : COLUBK = $84 : COLUBK = $86
  COLUBK = $88 : COLUBK = $8A : COLUBK = $8C : COLUBK = $8E
  COLUBK = $08 : goto hue_8_loop
hue_9
  x = 0
hue_9_loop
  WSYNC = 0 : x = x + 1 : if x = 12 then hue_10
  COLUBK = $08 : COLUBK = $08 : COLUBK = $08
  COLUBK = $90 : COLUBK = $92 : COLUBK = $94 : COLUBK = $96
  COLUBK = $98 : COLUBK = $9A : COLUBK = $9C : COLUBK = $9E
  COLUBK = $08 : goto hue_9_loop
hue_10
  x = 0
hue_10_loop
  WSYNC = 0 : x = x + 1 : if x = 12 then hue_11
  COLUBK = $08 : COLUBK = $08 : COLUBK = $08
  COLUBK = $A0 : COLUBK = $A2 : COLUBK = $A4 : COLUBK = $A6
  COLUBK = $A8 : COLUBK = $AA : COLUBK = $AC : COLUBK = $AE
  COLUBK = $08 : goto hue_10_loop
hue_11
  x = 0
hue_11_loop
  WSYNC = 0 : x = x + 1 : if x = 12 then hue_12
  COLUBK = $08 : COLUBK = $08 : COLUBK = $08
  COLUBK = $B0 : COLUBK = $B2 : COLUBK = $B4 : COLUBK = $B6
  COLUBK = $B8 : COLUBK = $BA : COLUBK = $BC : COLUBK = $BE
  COLUBK = $08 : goto hue_11_loop
hue_12
  x = 0
hue_12_loop
  WSYNC = 0 : x = x + 1 : if x = 12 then hue_13
  COLUBK = $08 : COLUBK = $08 : COLUBK = $08
  COLUBK = $C0 : COLUBK = $C2 : COLUBK = $C4 : COLUBK = $C6
  COLUBK = $C8 : COLUBK = $CA : COLUBK = $CC : COLUBK = $CE
  COLUBK = $08 : goto hue_12_loop
hue_13
  x = 0
hue_13_loop
  WSYNC = 0 : x = x + 1 : if x = 12 then hue_14
  COLUBK = $08 : COLUBK = $08 : COLUBK = $08
  COLUBK = $D0 : COLUBK = $D2 : COLUBK = $D4 : COLUBK = $D6
  COLUBK = $D8 : COLUBK = $DA : COLUBK = $DC : COLUBK = $DE
  COLUBK = $08 : goto hue_13_loop
hue_14
  x = 0
hue_14_loop
  WSYNC = 0 : x = x + 1 : if x = 12 then hue_15
  COLUBK = $08 : COLUBK = $08 : COLUBK = $08
  COLUBK = $E0 : COLUBK = $E2 : COLUBK = $E4 : COLUBK = $E6
  COLUBK = $E8 : COLUBK = $EA : COLUBK = $EC : COLUBK = $EE
  COLUBK = $08 : goto hue_14_loop
hue_15
  x = 0
hue_15_loop
  WSYNC = 0 : x = x + 1 : if x = 12 then hue_15_end
  COLUBK = $08 : COLUBK = $08 : COLUBK = $08
  COLUBK = $F0 : COLUBK = $F2 : COLUBK = $F4 : COLUBK = $F6
  COLUBK = $F8 : COLUBK = $FA : COLUBK = $FC : COLUBK = $FE
  COLUBK = $08 : goto hue_15_loop
hue_15_end
  for x = 1 to 25 : WSYNC = 0 : next : goto kernel_loop

Link to comment
Share on other sites

Can anyone get the following code to compile? I don't see anything wrong with it, but whenever I try to compile it I get a 2600basic.exe runtime error ("2600basic.exe has encountered a problem and needs to close.").

Well, I finally got it to compile, but I had to put all the IF statements on separate lines. :ponder:

 

The flickering is bad on some hues, almost imperceptible on others.

Link to comment
Share on other sites

So, with SuperChip RAM this could be a "screen mode" with 128 addressable pixels and 128 colors.. right? just replace the COLUBK = BLAH with reads from SuperChip RAM, ya think?

 

UPDATE: I fooled around with the code and you CAN use normal and SC variables in place of the static COLUBK = values. It no longer makes solid colors. Rather, the last COLUBK = in a hue_ loop turns into the background color for that row of pixels. A pixel is interleaved between the pixel color and the background color. It looks like you can fit in 8 pixels per row. The standard kernel cannot cooexist thus no standard playfield pixels or sprites. Also, timing is really tight. For instance, if you want to use rand the screen will move.

Edited by theloon
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...