Palette Tonemap improvements
Posted: Wed Sep 07, 2016 16:48
Full branch:
https://github.com/raa-eruanna/gzdoom/t ... te-tonemap
Compare URL:
https://github.com/coelckers/gzdoom/com ... te-tonemap
Not ready to make a pull request just yet, as I am still debating over some parts of this.
As-is - what it does is it simply improves the LUT generation by favoring colors a little bit more like how Doom's original COLORMAP did. In my opinion, the current palette tonemap is a bit quirky and I am not 100% with the colors it chooses - when you go to E2M2 from Doom it becomes painfully obvious as to why.
So what this does is it tries to fix that problem - it makes higher color distances "even more" distant but still close enough that occasionally other ramps can be picked.
Now - my version of BestColor (with some comments and help from dpJudas) is a bit slower than ZDoom's, but not by much. When testing this function, I can get micro-stutters from live colormap generation in ZDoom's software renderer but only if I cripple my CPU. When I run my CPU at full speed the stutters are gone. (And that's only at 2.5GHz, too)
Originally dpJudas wanted everything in that function to be floats instead of doubles, but when I did that the loss of precision was enough to defeat the entire purpose of replacing that function. Otherwise I would've tended to agree - less is better.
So here is what I am wondering, before I make an official pull request:
Should I make this version of BestColor specific only to tonemap gen? If yes - then that's all I need to know.
If not - should I make a separate pull request to replace ZDoom's, or should this version be specific to GZDoom? The function as-is retains the same functionality as ZDoom's, just with a slightly different algorithm, and will be used in GZDoom's software renderer.
https://github.com/raa-eruanna/gzdoom/t ... te-tonemap
Compare URL:
https://github.com/coelckers/gzdoom/com ... te-tonemap
Not ready to make a pull request just yet, as I am still debating over some parts of this.
As-is - what it does is it simply improves the LUT generation by favoring colors a little bit more like how Doom's original COLORMAP did. In my opinion, the current palette tonemap is a bit quirky and I am not 100% with the colors it chooses - when you go to E2M2 from Doom it becomes painfully obvious as to why.
So what this does is it tries to fix that problem - it makes higher color distances "even more" distant but still close enough that occasionally other ramps can be picked.
Now - my version of BestColor (with some comments and help from dpJudas) is a bit slower than ZDoom's, but not by much. When testing this function, I can get micro-stutters from live colormap generation in ZDoom's software renderer but only if I cripple my CPU. When I run my CPU at full speed the stutters are gone. (And that's only at 2.5GHz, too)
Originally dpJudas wanted everything in that function to be floats instead of doubles, but when I did that the loss of precision was enough to defeat the entire purpose of replacing that function. Otherwise I would've tended to agree - less is better.
So here is what I am wondering, before I make an official pull request:
Should I make this version of BestColor specific only to tonemap gen? If yes - then that's all I need to know.
If not - should I make a separate pull request to replace ZDoom's, or should this version be specific to GZDoom? The function as-is retains the same functionality as ZDoom's, just with a slightly different algorithm, and will be used in GZDoom's software renderer.