Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - Rainbow Fade-In/Fade-Out Effect

Reply to topic
Author Message
  • Joined: 25 Feb 2023
  • Posts: 99
Reply with quote
Rainbow Fade-In/Fade-Out Effect
Post Posted: Tue Apr 11, 2023 10:46 am
Maybe this is a silly question but is there a way to have sprites and background elements fade in and out by rapidly changing colors before turning black? I'm not aware of any officially licensed games on the SMS off the top of my head that did this, but I'm hoping it may be possible as I need to recreate this effect for a homebrew port of Final Fantasy I I'm working on. Attached is a gif of what I'm seeking to remake
FinalFantasyBridgeSceneNES.gif (24.69 KB)
Trippy rainbow effect, but can it be done on Master System?
FinalFantasyBridgeSceneNES.gif

  View user's profile Send private message
  • Joined: 05 Sep 2013
  • Posts: 3758
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Tue Apr 11, 2023 2:35 pm
On the SMS you can change the palette(s) every time you want, so you probably just want to prepare a sequence of alternative palettes for each frame of your transition, and apply them in sequence with some good timing in between...
  View user's profile Send private message Visit poster's website
  • Joined: 25 Mar 2023
  • Posts: 6
Reply with quote
Post Posted: Tue Apr 11, 2023 5:11 pm
You could also store the palette in ram and subtract x from each entry in the palette every y frames.
With how the palette is, you'll go through every colour and eventually end up at 0 which is black.


; this only modifies the palette in ram, you still have to write it to the vdp
; and use counters so it only runs every x frames
;
; hl: address of palette in ram
; b: number of palette entries to modify
fade_palette_rainbow:

   ; loop through each palette entry
   -:
      ; get palette value
      ld a, (hl)

      ; don't do anything if this entry is already 0
      or a, a
      jr z, fade_rainbow_check_done

      ; decrement palette entry
      sub a, 3

      ; if carry is set, we went below 0 so set a = 0
      jr nc, +
         ld a, 0
      +:

      ; update palette record in memory
      ld (hl), a

      fade_rainbow_check_done:
      inc hl
      djnz -

   ret


The attached videos are of 3 being subtracted from each palette entry every 4 frames, and 1 being subtracted from each palette entry every 2 frames. You could obviously mess about with this to see what different rates and amounts look like!

You can just have another counter to say you need to run it so many times, if you subtract 1 per fade_palette_rainbow you'll need to run it 64 times to make sure white (63) has become black (0) and if you subtract 2 you'll need to run it 32 times etc
rainbow_fade.mp4 (512.37 KB)

rainbow_fade_2.mp4 (805.61 KB)


  View user's profile Send private message
  • Joined: 25 Feb 2023
  • Posts: 99
Reply with quote
Post Posted: Tue Apr 11, 2023 5:52 pm
joe wrote
You could also store the palette in ram and subtract x from each entry in the palette every y frames.
With how the palette is, you'll go through every colour and eventually end up at 0 which is black.


; this only modifies the palette in ram, you still have to write it to the vdp
; and use counters so it only runs every x frames
;
; hl: address of palette in ram
; b: number of palette entries to modify
fade_palette_rainbow:

   ; loop through each palette entry
   -:
      ; get palette value
      ld a, (hl)

      ; don't do anything if this entry is already 0
      or a, a
      jr z, fade_rainbow_check_done

      ; decrement palette entry
      sub a, 3

      ; if carry is set, we went below 0 so set a = 0
      jr nc, +
         ld a, 0
      +:

      ; update palette record in memory
      ld (hl), a

      fade_rainbow_check_done:
      inc hl
      djnz -

   ret


The attached videos are of 3 being subtracted from each palette entry every 4 frames, and 1 being subtracted from each palette entry every 2 frames. You could obviously mess about with this to see what different rates and amounts look like!

You can just have another counter to say you need to run it so many times, if you subtract 1 per fade_palette_rainbow you'll need to run it 64 times to make sure white (63) has become black (0) and if you subtract 2 you'll need to run it 32 times etc


Holy smokes! Thank you for having such a clear example! This will be really helpful and I really appreciate it
  View user's profile Send private message
  • Joined: 14 Apr 2013
  • Posts: 623
Reply with quote
Post Posted: Tue Apr 11, 2023 7:22 pm
This thread might be of interest to you as well: https://www.smspower.org/forums/16500-HelpWithAColorFadeOutTrick
  View user's profile Send private message Visit poster's website
Reply to topic



Back to the top of this page

Back to SMS Power!