MAMEWorld >> EmuChat
Previous thread Previous  View all threads Index   Next thread Next   Threaded Mode Threaded  

Pages: 1

DJX
Reged: 12/04/17
Posts: 13
Send PM


Dithering
#384908 - 01/04/20 08:00 PM


Is there a way to configure MAME to dither the image for the Sega Genesis? I was researching this and it appears that the way these games were meant to be displayed is by dithering the crosshatch patterns to achieve more colors or transparency. The result is more or less the way I remember the images to look. See the following example image of what I'm trying to achieve with MAME:



Thanks!

Edited by DJX (01/08/20 04:33 PM)



MooglyGuy
Renegade MAME Dev
Reged: 09/01/05
Posts: 2261
Send PM


Re: Dithering new [Re: DJX]
#384911 - 01/04/20 09:37 PM


Regarding dithering:



The Megadrive (Genesis) made use of dithering specifically because being displayed through a composite connection would tend to blur colors together horizontally.

Making MAME "dither" the output is exactly what you don't want.

Instead, what you want is to use one of the post-processing shaders that MAME supports, with a few tweaks to handle the resolution difference between the Megadrive and the NES (which is what the NTSC simulation was designed for).

So yeah, first things first.

Create a file in the following path, with the following name, relative to the MAME executable: ini/presets/source/megadriv.ini

Next, copy/paste the following data into it:


Code:


#
# NTSC POST-PROCESSING OPTIONS
#
yiq_enable 1
yiq_jitter 0.0
yiq_cc 3.57954545
yiq_a 0.0
yiq_b 0.5
yiq_o 0.0
yiq_p 1.0
yiq_n 2.0
yiq_y 6.0
yiq_i 1.2
yiq_q 0.6
yiq_scan_time 45.1
yiq_phase_count 2



Finally, when you run MAME, be sure to:

A) Run the 'genesis' driver, not the 'megadriv' driver, and
B) Run with the "-hlsl" parameter, to enable HLSL post-processing.

This all assumes that you are running on a Windows-based machine with a halfway-decent graphics card. If one or both of these things aren't the case, all bets are off.

But the end result is that this choppy-looking, obviously-dithered picture:



Will be smoothed out into something more akin to what you'd get on a real CRT, including various adjustments to color balance:



Share and enjoy!



DJX
Reged: 12/04/17
Posts: 13
Send PM


Re: Dithering new [Re: MooglyGuy]
#384927 - 01/06/20 04:48 AM


Thanks for the help.
I tried to follow your directions but I can't get this to do anything.
I made that file you suggested in the location you said.
I tried running "mame64 -hlsl" and just "mame64" both look the same to me.
Once I launch mame64 I browse to "Genesis USA" and choose my ROM.

I tried following the tweaks here: https://docs.mamedev.org/advanced/hlsl.html

It suggested I change the following in mame.ini:
video d3d
filter 0
hlsl_enable 1

Sorry for the confusion, I'm new to this HLSL stuff.



ICEknight
MAME Fan
Reged: 07/06/15
Posts: 166
Send PM


Re: Dithering new [Re: MooglyGuy]
#384946 - 01/07/20 07:45 PM


This is how real hardware looks, for reference:






It looks like some further adjustments would have to be made, for improved accuracy.



By the way, I'm not sure why the default value of "phosphor_life" makes the screen blurry. I guess it might be useful for special cases like Pong, but I don't remember any CRTs blurring the screen in fast games like Sonic, should it even be enabled by default?

Edited by ICEknight (01/07/20 07:58 PM)



MooglyGuy
Renegade MAME Dev
Reged: 09/01/05
Posts: 2261
Send PM


Re: Dithering new [Re: ICEknight]
#384951 - 01/08/20 01:53 AM


> It looks like some further adjustments would have to be made, for improved accuracy.

Looks pretty close, other than a difference in gamma curve and a few other parameters which can already be tweaked via sliders.

In this instance, all I did was enable the bone-stock HLSL settings plus the NTSC filter, and called it a day once I had the pixels smearing enough and a relative lack of luma banding. I'm sure someone with about 15-30 minutes could come up with settings that would almost identically mimic those photos.



Envisaged0ne
MAME Fan
Reged: 08/29/06
Posts: 543
Send PM


Re: Dithering new [Re: MooglyGuy]
#384952 - 01/08/20 02:40 AM


Honestly I thought what you demonstrated looked pretty spot on. Maybe they expected you to do the work and make it look EXACTLY like there pic, but that's just laziness on there part. If someone wants it to be that exact, they can learn how to do it themselves. Don't rely on other people to do the work for you. And if they didn't want you to do the work, then why post the pic for "your reference"

Edited by Envisaged0ne (01/08/20 02:42 AM)



Windows 11 64 bit OS
Intel Core i7-10700
Nvidia GeForce RTX 2060 6GB
32GB DDR4 RAM



MooglyGuy
Renegade MAME Dev
Reged: 09/01/05
Posts: 2261
Send PM


Re: Dithering new [Re: Envisaged0ne]
#384953 - 01/08/20 02:59 AM


Honestly, I think that's a little unfair. I always appreciate reference photos from real CRTs.

I spent about 15-20 minutes after seeing the pics, trying to tweak the settings to be "just right", but I wasn't able to make much headway.

The thing that I find interesting is that there's a bluish tint to the large ring segments in the photos, whereas there's a yellowish tint to the large ring segments in MAME.

Completely turning HLSL off, the colors are accurate to what the system is generating, but it's an interesting challenge to try to figure out why the segments appear more white with a bluish tint.

There are a few potential explanations, but I'm not sure which is the most plausible. In no particular order:

- The camera itself may have had a CCD that's more sensitive towards the blue end of the spectrum.
- The blue phosphors on the CRT itself may have been more vibrant or had a different wavelength than the model of CRT that the current phosphor values in MAME are tuned towards.
- The f-number of the camera may have been such that phosphors of a certain wavelength were overexposed (see the first point).
- There may be unaccounted-for Rayleigh scattering through the CRT glass itself.

The last one is particularly interesting to me, as it's a factor that I'm not sure has ever been accounted for in a CRT shader. Current models assume that the CRT glass is a perfect transmission medium, and while it would be ideally, nothing is ever ideal in real life. In particular, on the Wikipedia page for Rayleigh scattering, the effect of (what I'm assuming is) sunlight shining into opalescent glass is that the glass takes on a blue hue. Now, obviously, CRT glass isn't opalescent, because that would be at odds with providing accurate transmission of the phosphor wavelengths, but it's an interesting thought to chew on nonetheless.

So yeah, I think you're being overly harsh. Those photos provoke some fascinating questions and thoughts, not all of which have immediately clear answers.



ICEknight
MAME Fan
Reged: 07/06/15
Posts: 166
Send PM


Re: Dithering new [Re: Envisaged0ne]
#384958 - 01/08/20 05:31 PM


> Maybe they expected
> you to do the work and make it look EXACTLY like there pic, but that's just laziness
> on there part. If someone wants it to be that exact, they can learn how to do it
> themselves. Don't rely on other people to do the work for you. And if they didn't
> want you to do the work, then why post the pic for "your reference"

I didn't ask for anything, I already have the real thing in my bedroom.



ICEknight
MAME Fan
Reged: 07/06/15
Posts: 166
Send PM


Re: Dithering new [Re: MooglyGuy]
#384959 - 01/08/20 05:52 PM


> The thing that I find interesting is that there's a bluish tint to the large ring
> segments in the photos, whereas there's a yellowish tint to the large ring segments
> in MAME.
>
> Completely turning HLSL off, the colors are accurate to what the system is
> generating, but it's an interesting challenge to try to figure out why the segments
> appear more white with a bluish tint.
>
> There are a few potential explanations, but I'm not sure which is the most plausible.
> In no particular order:
>
> - The camera itself may have had a CCD that's more sensitive towards the blue end of
> the spectrum.
> - The blue phosphors on the CRT itself may have been more vibrant or had a different
> wavelength than the model of CRT that the current phosphor values in MAME are tuned
> towards.
> - The f-number of the camera may have been such that phosphors of a certain
> wavelength were overexposed (see the first point).
> - There may be unaccounted-for Rayleigh scattering through the CRT glass itself.

I think the blueish tint might be an effect of taking a picture off the CRT so, for the correct colors, it might be better to check some screen grabs taken from a capture card, such as those here: http://nerdlypleasures.blogspot.com/2015/03/the-case-for-composite.html

Also, SMS and other related stuff: http://nerdlypleasures.blogspot.com/2016/07/video-potpourri.html



ICEknight
MAME Fan
Reged: 07/06/15
Posts: 166
Send PM


Re: Dithering new [Re: ICEknight]
#384960 - 01/08/20 08:24 PM


For comparison, here's some pics of how my Trinitron CRT displays RGB and composite video:









Edited by ICEknight (01/08/20 08:39 PM)



DJX
Reged: 12/04/17
Posts: 13
Send PM


Re: Dithering new [Re: DJX]
#384968 - 01/10/20 03:27 AM


Ok, got this to finally do something.
I found a suggestion on Reddit that said you need to install the "DirectX End-User Runtime Web Installer". I wasn't getting any errors but I wasn't seeing any options for HLSL or anything. After installing that, HLSL magically started working. Unfortunately, it is unplayable on my laptop because of the lag spikes:

Intel i5-7300U 2.66GHz
Intel HD 620
Nvidia GeForce 930MX

Thanks for the help anyway.



R. Belmont
Cuckoo for IGAvania
Reged: 09/21/03
Posts: 9716
Loc: ECV-197 The Orville
Send PM


Re: Dithering new [Re: ICEknight]
#385012 - 01/14/20 05:19 PM


Also, it's important to note that different TVs will show things slightly differently. By the late 80s that really translated to "which manufacturer's video decoder IC was used" rather than a specific TV make and model.


Pages: 1

MAMEWorld >> EmuChat
Previous thread Previous  View all threads Index   Next thread Next   Threaded Mode Threaded  

Extra information Permissions
Moderator:  Robbbert, Tafoid 
0 registered and 292 anonymous users are browsing this forum.
You cannot start new topics
You cannot reply to topics
HTML is enabled
UBBCode is enabled
Thread views: 2213