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 - [Coding competition 2024] Dithering Demo by Guy

Reply to topic

Rate this entry!

1 (Terrible) 0% 0%
2 0% 0%
3 11% 11%
4 0% 0%
5 5% 5%
6 27% 27%
7 16% 16%
8 33% 33%
9 0% 0%
10 (Excellent) 5% 5%
This poll has expired.
Author Message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14745
  • Location: London
Reply with quote
[Coding competition 2024] Dithering Demo by Guy
Post Posted: Mon Mar 25, 2024 10:46 am
Last edited by Maxim on Tue Apr 02, 2024 9:19 am; edited 2 times in total
https://www.smspower.org/Homebrew/DitheringDemo-SMS



Quote
I don't have as much time to code as I would like. but I didn't want to stay this year without presenting anything. Here is a little demo of unpretentious experimentation on dithering. Everything is not stabilized yet, but it looks pretty good at 60 Hz, even if it still shakes a little on real hardware (even more at 50 Hz). The demo is coded in C thanks to the sverx kit so there is ample opportunity to refine this technique in ASM. We see in the title that it is possible to generate the illusion of additional colors and transparency in the dragon's fire and a little in the lettering (same method as for the water cascades in Sonic on Megadrive). The music is a cover of heroquest that I wanted to include in the homebrew Grail of the Gods but which was cut during editing because it did not satisfy me. For posterity I included it in this demo. Press 2 to turn the effect off and 1 to resume it. Have fun.


  View user's profile Send private message Visit poster's website
  • Joined: 07 Mar 2021
  • Posts: 62
Reply with quote
Post Posted: Wed Mar 27, 2024 5:11 pm
Hi ! the demo was designed and optimized to run on a CRT screen and real Hardware, the rendering on the emulator is not optimal, so here is a preview video (SCART output, 60Hz) for those who cannot test on their master system.

  View user's profile Send private message
  • Joined: 05 Sep 2013
  • Posts: 3828
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Wed Mar 27, 2024 5:23 pm
Unfortunately I can't test this on hardware at the moment, but it seems very nice!
I remember a few years ago I tried something similar updating the colors each frame, to generate new color in-betweens by mixing two colors from the SMS palette.
Unfortunately, unless you mix only colors with *very* close luminance value, the result is pretty flickery.
This seems to work better, but it indeed has some visible shaking.
  View user's profile Send private message Visit poster's website
  • Joined: 06 Mar 2022
  • Posts: 671
  • Location: London, UK
Reply with quote
Post Posted: Fri Mar 29, 2024 3:26 pm
Really interesting.

I've tried this on my hardware and it doesn't suffer from the same left/right flickering as with Emulicious, although curiously the "blocks" inside the flames are much more obvious.

I took a quick video on my phone, but due to the frame rate of the camera you can't really see what I'm seeing - it's much smoother in real life. I'll get my proper camera out and see if I can record it at a higher frame rate.

Link to video on Google Drive

I guess ideally with some persistence of luminosity simulated in my hardware implementation it would look as you intended on a CRT.
  View user's profile Send private message Visit poster's website
  • Joined: 27 Feb 2023
  • Posts: 136
  • Location: France
Reply with quote
Post Posted: Fri Mar 29, 2024 6:47 pm
Tried it on my MegaDrive (Scart RGB) and it is indeed very convincing and something you never see on the console for sure. The flame looks like proper transparency.
  View user's profile Send private message
  • Joined: 07 Mar 2021
  • Posts: 62
Reply with quote
Post Posted: Sat Mar 30, 2024 8:58 am
Thank you for your feedback!

Not having an LCD connected to my SMS, the test is very interesting willbritton, the checkerboard effect is more visible on the transparency but yes the image remains very stable given the technique used: a raster on X scrolling ( but perhaps things vary from one LCD to another depending on the image rendering method used)

Indeed, as Cireza noted on this demo, it is on CRT that we achieve something more convincing (and I imagine even more so with a composite output than SCART like me)

I think like sverx said that some colors mix better than others.
Using perfect timing with a good choice of color it should be possible to generate pretty things on fixed screens and possibly even on LCD.
  View user's profile Send private message
  • Joined: 04 Oct 2019
  • Posts: 84
  • Location: Brazil
Reply with quote
Post Posted: Sat Mar 30, 2024 10:13 pm
Tested it on a 60Hz CRT, using composite video and it looks great! If this technique can be used in actual games, it will surely be amazing!
  View user's profile Send private message
  • Joined: 30 Jan 2023
  • Posts: 55
  • Location: Manchester, England
Reply with quote
Post Posted: Mon Apr 01, 2024 7:16 pm
Looks amazing! Deffo need to try this on my sms when I get chance :)
Are you planning on adding this to the actual game?
  View user's profile Send private message Visit poster's website
  • Joined: 25 Jul 2007
  • Posts: 732
  • Location: Melbourne, Australia
Reply with quote
Post Posted: Wed Apr 03, 2024 11:04 am
I really like this effect, even if it isn't effective on LCD I still like it a lot.
  View user's profile Send private message
  • Joined: 07 Mar 2021
  • Posts: 62
Reply with quote
Post Posted: Sun Apr 07, 2024 1:56 pm
Thank you for your messages. No, I don't think I'll use it in my homebrew. It was a technical demo for experimentation. And now I think most people play on LCD :(

That said, for those who are interested I quickly compiled a test ROM which can combine all the colors using this effect and test their stability. Button 1 changes the offset of the horizontal palette, button 2 idem in the vertical palette. Up and Down decrement or increment the line counter of the raster effect.
capture.jpg (22.86 KB)
TV Screen
capture.jpg
palette_dither_experiment_b.zip (5.5 KB)
ROM rev B (no CRAM dots)

  View user's profile Send private message
Reply to topic



Back to the top of this page

Back to SMS Power!