dhewm / dhewm3

dhewm 3 main repository
https://dhewm3.org/
GNU General Public License v3.0
1.8k stars 346 forks source link

Dither to adress color banding #608

Open markanini opened 2 months ago

markanini commented 2 months ago

Maybe this is a naive request, but can we have dither? Apparently TDM added it at one point, maybe somethign similar in Dhewm3 would improve banding in semi-dark scenes, like in the attached video clip.

TDM reference 1. https://www.moddb.com/news/the-dark-mod-212-is-here Ctrl+F "dither". 2. https://github.com/search?q=repo%3Afholger%2Fthedarkmod+dither&type=commits Hopefully these links give some ideas.

https://github.com/user-attachments/assets/1af0b8a9-5de4-449d-b242-2ea17275f588

DanielGibson commented 2 months ago

I don't think so. Porting soft particles from TDM 2.04 was doable because at that point their renderer was still more similar to the original Doom3 renderer, but this would most probably be harder. (Also, even porting soft particles turned out a lot more work than I originally though, so I'm fed up with graphics features for now. However, if anyone else wants to do this, I'd merge the code if it's ok)

However, Sikkmod has some kind of Dither feature, maybe that works well enough for your needs (I haven't tried it).

nbohr1more commented 2 months ago

We ( TDM ) have a 64-bit FBO so banding was already significantly reduced when 64-bit color was introduced in v2.08.

Dithering was added due to the scrutiny over our God-ray design and seeing that the fog was significantly worse looking than our God-rays which had dithering. I guess I should try reducing to 32-bit FBO and toggling postprocess dither on and off to see what that looks like.

Vanilla Doom 3 uses texture generation instead of FBO but I'm not sure you can do 64-bit texture generation via OpenGL 2.x \ ARB pipelines. Yes, dither could be a postprocess shader but that just adds another fillrate heavy step to an engine that is already suffering from extreme fillrate requirements.