Page 1 of 1

MD VDP color levels

Posted: Tue Oct 20, 2015 5:45 am
by TmEE co.(TM)
Image

I took the time and measured out the actual output of the MD/Genny VDP.

Emulators used to completely misemulate the output, using RGB step of 16 to get their values and special case the white so it is white not grey or leave it grey, and also shadow and highlight behaviour was incorrect also. It was assumed that highlight makes white whiter so that was assumed to be only way to get the actual white. That also meant the ramp has 16 values total.

Couple years ago I helped to verify the behaviour of the shadow and highlight mode and it came out there's only 15 levels. Some Emulators then updated their schit to show the highlight part correctly. White is white, it doesn't get whiter, so the step would be 18 or so. Nice and round and definitely more correct. The non linear ramp was also seen at that time but I don't think anyone really took the time to measure it out.

Now today I looked at the output in detail as I can and you can see the output is a bit tangential. Compressed in the middle, expanded on the sides. I also verified that Shadow or Highlight doesn't introduce any new levels, not even subtly different ones.

So here are my results :

Old incorrect linear levels :
Normal : 0 36 72 108 144 180 216 252/255
Shadow : 0 18 36 54 72 90 108 126
HiLite : 126 144 162 180 198 216 234 252/255

Nonlinear levels derived from hardware measurements :
Normal : 0 52 87 116 144 172 206 255
Shadow : 0 29 52 70 87 101 116 130
HiLite : 130 144 158 172 187 206 228 255

Red means value got higher, blue means it got lower compared to the linear ramp.

All MD models I tested (MD1, variety of MD2 ASICs, the one that is shared by MD2 and Genny3) seemed to have identical output, and all color channels have same levels too.
I did multiple measurements and these are the values I ended up on each time.

In the end you lose some precision in the extremes, which hurts the dark stuff most badly as far as art goes.

Next up would be to measure the output in SMS mode, and also from real SMS and see if there's a difference.

Re: MD VDP color levels

Posted: Tue Oct 20, 2015 9:57 pm
by Eke
These steps seem to match voltages that were measured here:
viewtopic.php?f=22&t=519&start=82

There was also some discussion here :
viewtopic.php?f=22&t=1389

Code: Select all

 Shadow   Highli    Normal 
-------- -------- ---------   
(0) 0.0             0.0 (0)
(1) 0.5            
(2) 0.9             0.9 (1)
(3) 1.3 
(4) 1.6             1.6 (2)
(5) 1.9 
(6) 2.2             2.2 (3)
(7) 2.4   (0) 2.4
          (1) 2.7   2.7 (4)
          (2) 2.9
          (3) 3.2   3.2 (5)
          (4) 3.5
          (5) 3.8   3.8 (6)
          (6) 4.2
          (7) 4.7   4.7 (7)
However, those 8-bit RGB values are assuming 4,7 V max output from VDP is equivalent to max voltage output by a system which supports 24-bit RGB. It might be more accurate to test directly from video out RGB pins (or even better from RGB scart lead pins) and compare with RGB level reference voltages and output levels from a 24-bit RGB compatible system.

From my own testing (comparing on same TV, with same settings, RGB SCART output from my PAL Mega Drive 2 with the one from a Gamecube running my emulator), the "white" output from my Mega Drive (0xEEE) seemed slightly more "greyish" than emulator using 0xFFFFFFFF color.

As for the non-linear values, I actually implemented it in emulator once to try if it was more accurate but honestly, I took screenshots from games to compare between the two but it didn't made much differences (if any).

I currently use a linear step of 34 (17 for shadow/highlight) with a max value set to 238 in my emulator and the RGB output from my Gamecube is quite identical to my Mega Drive when running on same TV (using a SCART switcher).

It would be interesting to see voltage values in SMS compatibility mode and on a real Master System various models. From what I can remember (it's long dead by now), the RGB output from my PAL Master System 2 was quite darker than what I get from my PAL Mega Drive (using SMS ROM In MD Everdrive).

Re: MD VDP color levels

Posted: Wed Oct 21, 2015 3:48 am
by HardWareMan
This man just boasted own oscilloscope. You must understand this. :)
Also, if you wish I can remeassure with my new Rigol. :)

Re: MD VDP color levels

Posted: Wed Oct 21, 2015 4:02 am
by Mask of Destiny
They're not quite the same, but they're close. The numbers I'm using in BlastEm are based on Eke's voltage measurements assuming 4.7V=255 and a linear relationship between voltage and RGB value. That resulted in:

Code: Select all

Normal: 0, 49, 87, 119, 146, 174, 206, 255
Shadow: 0, 27, 49, 71, 87, 103, 119, 130
Hlighlight: 130, 146, 157, 174, 190, 206, 228, 255
which matches in some places, but is a little different in others. Probably not different enough to be noticeable though and may just be due to small differences in individual DACs.

I think the voltage of "pure white" is not super important. Any display you would have hooked up a Genesis/Megadrive to would have brightness and contrast controls so I'm not sure there's really a "true" color/brightness for a given voltage value. Might be useful for getting perfect composite emulation though.

Re: MD VDP color levels

Posted: Wed Oct 21, 2015 5:17 am
by TmEE co.(TM)
I fit my values between lowest and highest values measured, and I actually measured at the output of the voltage dividers before the RGB encoder rather than VDP outputs directly. The output was noisy, and I took the center point of the noise so there's tiny bit of playroom.
My intial measurements were from VDP outputs directly, and the difference was +/-1 level compared to after divider values I got here, you can probably blame it on the noise and rounding when doing calculations.

The stuff you see on your TV is completely dependent on how the TV interprets the input and what it does with it. For all intents and purposes, the pure white is the max levels out the VDP, and they linger at the 4.7V.

Here's the sequence I measured at the end of voltage dividers (0V is the lowest level not GND) :

mV, ratio
0, 0.000
108, 0.113
192, 0.202
261, 0.274
324, 0.341
378, 0.397
432, 0.454
483, 0.508
537, 0.565
588, 0.618
642, 0.675
699, 0.735
768, 0.807
849, 0.893
951, 1.000

EDIT:
Here's all the ROMs that I used for testing :
Full ramp seen on the photo, ROM made by a friend as part of MD programming exercise
Just the normal 8 levels
Those 8 levels in shadow
Those 8 levels in highlight

SMS test is in the todo list, I am coding up a ROM and then seeing what my MD, SMS1 and 2 tell me.

Re: MD VDP color levels

Posted: Thu Oct 22, 2015 1:50 am
by Sik
Now the question is how do those color levels compare against the 32X ones. This is something emulators still seem to have trouble with.

Re: MD VDP color levels

Posted: Thu Oct 22, 2015 11:38 am
by HardWareMan
The question is not in absolute voltage but in relative percentage. Black is 0% and white is 100%. Then you can scale it to any system (0,7v VGA or 0-255 true color for example) with correct level. And at this point of view is better to measure directly from VDP. Or at least from output buffers of coder.

Re: MD VDP color levels

Posted: Sat Dec 24, 2016 12:31 pm
by cannr
Has this been tested against Genesis Plus GX colors?

Re: MD VDP color levels

Posted: Sat Dec 24, 2016 3:02 pm
by Mask of Destiny
Genesis Plus GX uses a linear mapping. Eke even commented to that effect here:
Eke wrote: As for the non-linear values, I actually implemented it in emulator once to try if it was more accurate but honestly, I took screenshots from games to compare between the two but it didn't made much differences (if any).

I currently use a linear step of 34 (17 for shadow/highlight) with a max value set to 238 in my emulator and the RGB output from my Gamecube is quite identical to my Mega Drive when running on same TV (using a SCART switcher).

Re: MD VDP color levels

Posted: Sat Dec 24, 2016 5:15 pm
by cannr
Did Eke posted some screenshoot comparison?

Re: MD VDP color levels

Posted: Sun Dec 25, 2016 1:53 pm
by r57shell
You can calculate deviation. It's really small.
Checkout this thread: viewtopic.php?f=22&t=1389