Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix colour values not being decoded/encoded #112

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

GameChaos
Copy link

@GameChaos GameChaos commented Nov 26, 2024

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.

@khanghugo
Copy link
Contributor

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

@YaLTeR
Copy link
Owner

YaLTeR commented Nov 26, 2024

I assume this is a similar fix to crashfort/SourceDemoRender#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.

@GameChaos
Copy link
Author

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 :/

@YaLTeR
Copy link
Owner

YaLTeR commented Nov 26, 2024

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

@GameChaos
Copy link
Author

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

@YaLTeR
Copy link
Owner

YaLTeR commented Nov 27, 2024

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

image

@GameChaos
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants