MD VDP color levels

For anything related to VDP (plane, color, sprite, tiles)

Moderators: BigEvilCorporation, Mask of Destiny

Post Reply
TmEE co.(TM)
Very interested
Posts: 2440
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

MD VDP color levels

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

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.
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

Eke
Very interested
Posts: 884
Joined: Wed Feb 28, 2007 2:57 pm
Contact:

Re: MD VDP color levels

Post by Eke » Tue Oct 20, 2015 9:57 pm

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

HardWareMan
Very interested
Posts: 745
Joined: Sat Dec 15, 2007 7:49 am
Location: Kazakhstan, Pavlodar

Re: MD VDP color levels

Post by HardWareMan » Wed Oct 21, 2015 3:48 am

This man just boasted own oscilloscope. You must understand this. :)
Also, if you wish I can remeassure with my new Rigol. :)

Mask of Destiny
Very interested
Posts: 615
Joined: Thu Nov 30, 2006 6:30 am

Re: MD VDP color levels

Post by Mask of Destiny » Wed Oct 21, 2015 4:02 am

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.

TmEE co.(TM)
Very interested
Posts: 2440
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Re: MD VDP color levels

Post by TmEE co.(TM) » Wed Oct 21, 2015 5:17 am

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.
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

Sik
Very interested
Posts: 939
Joined: Thu Apr 10, 2008 3:03 pm
Contact:

Re: MD VDP color levels

Post by Sik » Thu Oct 22, 2015 1:50 am

Now the question is how do those color levels compare against the 32X ones. This is something emulators still seem to have trouble with.
Sik is pronounced as "seek", not as "sick".

HardWareMan
Very interested
Posts: 745
Joined: Sat Dec 15, 2007 7:49 am
Location: Kazakhstan, Pavlodar

Re: MD VDP color levels

Post by HardWareMan » Thu Oct 22, 2015 11:38 am

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.

cannr
Newbie
Posts: 2
Joined: Sat Dec 17, 2016 1:26 pm

Re: MD VDP color levels

Post by cannr » Sat Dec 24, 2016 12:31 pm

Has this been tested against Genesis Plus GX colors?

Mask of Destiny
Very interested
Posts: 615
Joined: Thu Nov 30, 2006 6:30 am

Re: MD VDP color levels

Post by Mask of Destiny » Sat Dec 24, 2016 3:02 pm

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

cannr
Newbie
Posts: 2
Joined: Sat Dec 17, 2016 1:26 pm

Re: MD VDP color levels

Post by cannr » Sat Dec 24, 2016 5:15 pm

Did Eke posted some screenshoot comparison?

r57shell
Very interested
Posts: 478
Joined: Sun Dec 23, 2012 1:30 pm
Location: Russia
Contact:

Re: MD VDP color levels

Post by r57shell » Sun Dec 25, 2016 1:53 pm

You can calculate deviation. It's really small.
Checkout this thread: viewtopic.php?f=22&t=1389
Image

Post Reply