bxt-rs icon indicating copy to clipboard operation
bxt-rs copied to clipboard

Fix colour values not being decoded/encoded

Open GameChaos opened this issue 1 year ago • 7 comments

Colloquially known as "gamma correction".

Apologies if my code is poopy or organised in the wrong place.

Colour values need to be decoded with the correct transfer function before blending or doing other stuff to them (and later encoded with the OETF (opto electrical transfer function) for display on a monitor).

The sRGB standard defines piecewise and pure power curves as transfer functions. I've opted to use the power curves, because most sRGB monitors use the pure power curve as an EOTF (x^(1/2.2)). More info can be found here with people arguing if it's right or not :) https://community.acescentral.com/t/srgb-piece-wise-eotf-vs-pure-gamma/4024

Here are some images for comparison (screenshots from recorded video, so quality is a bit meh): image image

The first one is where incorrectly no encoding/decoding is done, so things will look darker and "energy" isn't preserved.

GameChaos avatar Nov 26 '24 15:11 GameChaos

+1. Sampling recording does look a lot darker than non sampling and I think this has been neglected for a while.

khanghugo avatar Nov 26 '24 15:11 khanghugo

I assume this is a similar fix to https://github.com/crashfort/SourceDemoRender/issues/68?

Also, could you upload two videos to compare in motion?

Also, we might want to do the same change to the CPU-only fallback path, though I'm worried that it might drop the performance too much. Will need to benchmark.

YaLTeR avatar Nov 26 '24 15:11 YaLTeR

I assume this is a similar fix to crashfort/SourceDemoRender#68?

yes, same fix

comparison videos: https://www.youtube.com/watch?v=Tl01yt_Uud4 https://www.youtube.com/watch?v=TaTIonPFT5k

looked at the cpu fallback code, seems way too complex for me to handle :/

GameChaos avatar Nov 26 '24 19:11 GameChaos

Could you upload .mp4 here on github? Without YT compression

YaLTeR avatar Nov 26 '24 19:11 YaLTeR

Could you upload .mp4 here on github? Without YT compression

files are too big :(

put them on mediafire: https://www.mediafire.com/file/g4fxqhmdgbp4i6m/blending+clips.zip/file

GameChaos avatar Nov 26 '24 22:11 GameChaos

As I understand, stationary frames should not change color, but they do, for example red on the very first frame:

image

YaLTeR avatar Nov 27 '24 08:11 YaLTeR

oh crap. could it be because of quantisation? i'll take a look soon :tm:

GameChaos avatar Nov 30 '24 22:11 GameChaos