Jump to content

Photo

Color fading, is it possible?


21 replies to this topic

#1 Lodmot OFFLINE  

Lodmot

    Chopper Commander

  • 230 posts

Posted Thu Mar 29, 2012 6:13 AM

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...ame Catcher.exe

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

#2 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

  • 24,758 posts
  • Controlled Randomness
    Replay Value
    Nonlinear
  • Location:North Carolina (USA)

Posted Thu Mar 29, 2012 8:19 AM

You can go from light colors to dark:

http://www.randomter...html#colorchart

#3 Lodmot OFFLINE  

Lodmot

    Chopper Commander

  • Topic Starter
  • 230 posts

Posted Thu Mar 29, 2012 8:29 AM

Yeah, I know about fading from light to dark. But can you gradually fade from one hue to another? (Eg fade from green to red)

#4 SpiceWare OFFLINE  

SpiceWare

    Quadrunner

  • 8,089 posts
  • Medieval Mayhem
  • Location:Planet Houston

Posted Thu Mar 29, 2012 10:54 AM

Sure - in NTSC if you inc/dec by $10 (decimal 16) you're adjusting the hue.

To shift from a green to a red ($Cx to $4x) just add $10 for each step (but skip $0x)

It doesn't work out that nicely in PAL though.

#5 Tjoppen OFFLINE  

Tjoppen

    Chopper Commander

  • 199 posts

Posted Thu Mar 29, 2012 11:32 AM

On PAL the palette "bounces" and swaps from even to odd high nybbles on the "eges". In other words: $20, $40, $60, $80, $A0, $C0, $D0, $B0, $90, $70, $50, $30..
Use a table if you want to retain portability.

#6 Lodmot OFFLINE  

Lodmot

    Chopper Commander

  • Topic Starter
  • 230 posts

Posted Thu Mar 29, 2012 2:03 PM

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

#7 eshu OFFLINE  

eshu

    Chopper Commander

  • 249 posts

Posted Thu Mar 29, 2012 3:56 PM

I think if the TIA had more color options...


Sheesh - the TIA has a LOT of colours for a system from this time! (More than the SMS or NES)

See: http://en.wikipedia....onsole_palettes

Edited by eshu, Thu Mar 29, 2012 3:59 PM.


#8 Lodmot OFFLINE  

Lodmot

    Chopper Commander

  • Topic Starter
  • 230 posts

Posted Thu Mar 29, 2012 7:18 PM

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. ^^

Attached Files


Edited by Lodmot, Thu Mar 29, 2012 7:44 PM.


#9 Pioneer4x4 OFFLINE  

Pioneer4x4

    River Patroller

  • 2,014 posts
  • Atari + R.O.B. = Completed
  • Location:PA

Posted Wed Apr 4, 2012 5:28 PM

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!

#10 SeaGtGruff OFFLINE  

SeaGtGruff

    Quadrunner

  • 5,444 posts
  • Location:Georgia, USA

Posted Wed Apr 4, 2012 10:23 PM

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.

480_Colors.png

Attached Files



#11 Pioneer4x4 OFFLINE  

Pioneer4x4

    River Patroller

  • 2,014 posts
  • Atari + R.O.B. = Completed
  • Location:PA

Posted Thu Apr 5, 2012 4:12 AM

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!)

#12 Lodmot OFFLINE  

Lodmot

    Chopper Commander

  • Topic Starter
  • 230 posts

Posted Thu Apr 5, 2012 6:57 AM

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, Thu Apr 5, 2012 6:59 AM.


#13 SeaGtGruff OFFLINE  

SeaGtGruff

    Quadrunner

  • 5,444 posts
  • Location:Georgia, USA

Posted Thu Apr 5, 2012 8:48 PM

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.

480_Colors_z26.png

#14 theloon OFFLINE  

theloon

    Quadrunner

  • 7,589 posts

Posted Fri Apr 6, 2012 12:09 AM

Slightly off-topic but seeing color bar demos like this makes me dream of "pixel" addressable bitmap kernels with different colors possible for each "pixel". I don't care if it uses every sprite, ball or chicken to do it.

Edited by theloon, Fri Apr 6, 2012 12:10 AM.


#15 Pioneer4x4 OFFLINE  

Pioneer4x4

    River Patroller

  • 2,014 posts
  • Atari + R.O.B. = Completed
  • Location:PA

Posted Fri Apr 6, 2012 5:41 AM


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.

480_Colors_z26.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.

#16 SeaGtGruff OFFLINE  

SeaGtGruff

    Quadrunner

  • 5,444 posts
  • Location:Georgia, USA

Posted Fri Apr 6, 2012 8:58 PM

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.

#17 theloon OFFLINE  

theloon

    Quadrunner

  • 7,589 posts

Posted Fri Apr 6, 2012 11:25 PM

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.

#18 SeaGtGruff OFFLINE  

SeaGtGruff

    Quadrunner

  • 5,444 posts
  • Location:Georgia, USA

Posted Sat Apr 7, 2012 9:19 AM

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.

#19 SeaGtGruff OFFLINE  

SeaGtGruff

    Quadrunner

  • 5,444 posts
  • Location:Georgia, USA

Posted Sat Apr 7, 2012 9:24 AM

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


#20 SeaGtGruff OFFLINE  

SeaGtGruff

    Quadrunner

  • 5,444 posts
  • Location:Georgia, USA

Posted Sat Apr 7, 2012 10:24 AM

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.

#21 RevEng ONLINE  

RevEng

    River Patroller

  • 3,275 posts
  • bit player
  • Location:Canada

Posted Sat Apr 7, 2012 12:22 PM

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.


The original version was also posted in the flicker picker thread.

#22 theloon OFFLINE  

theloon

    Quadrunner

  • 7,589 posts

Posted Tue Apr 10, 2012 7:56 AM

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, Tue Apr 10, 2012 9:28 AM.





0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users