09 April 2017, 15:15 | #1 |
Computer Nerd
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,754
|
OS wide gamma correction Part 2.
After writing a simple program that patches LoadRGB4 and LoadRGB32 to apply gamma correction, which works fine, I tried to patch GetRGB32 so that it can return the original color values. Because LoadRGB32 takes 32bit values for each component, I assumed that these were just stored as is, so that I could store the original values in that (gamma corrected byte, original byte, two zero bytes). Turns out that only the top byte of each component is actually used, the rest is discarded (missed it in the docs).
Major pain Other than storing a color table for each viewport, does anyone have any ideas as how to get GetRGB32 to return the original, uncorrected color values? Note that gamma correction is lossy, so you can't just reverse it. Perhaps the LoadRGB functions shouldn't be patched, but something else? |
10 April 2017, 09:08 | #2 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
|
|
10 April 2017, 13:34 | #3 | |
Computer Nerd
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,754
|
Quote:
Seems worth looking at, thanks. Noooooo |
|
10 April 2017, 18:48 | #4 |
Computer Nerd
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,754
|
Turns out you don't have to mess with the copper lists (thank goodness).
Basic steps: 1. Patch makevport by copying the colortable over and applying the gamma correction to the copy. Have makevport use the copy, and restore the original pointer. 2. Patch loadrgb32 to set gamma corrected colors. Make a new color table with the original colors. 3. Done ...or so it seems |
10 April 2017, 19:08 | #5 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
|
Good news. The trick seems to be catching the color data right before the coplist is made, so u don't have to store original colors. At least it was what made me suggest getting to a lower level...
|
10 April 2017, 19:40 | #6 |
Computer Nerd
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,754
|
It mostly works. Grabbed screens use original colors, etc. There's still a problem. Some screens don't get corrected. Probably something small.
|
11 April 2017, 14:29 | #7 |
Computer Nerd
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,754
|
It seems that it's impossible to get it to work completely properly like this The OS probably just sticks the colors directly into the copperlist. If only it was possible to safely call this routine.
Guess it's time to look into changing a viewport's copperlist manually. Hopefully that will be a little easier than I thought. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Alien Breed 3D, stuck on level 8, Test Area Gamma | HardStep | support.Games | 18 | 25 September 2019 01:22 |
OS wide gamma correction. | Thorham | Coders. System | 62 | 26 June 2016 23:10 |
HUE correction [was colour correction] | Marcuz | request.UAE Wishlist | 6 | 17 September 2008 22:13 |
|
|