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

Black is not black anymore? #6

Open
AnonN10 opened this issue Jun 30, 2023 · 3 comments
Open

Black is not black anymore? #6

AnonN10 opened this issue Jun 30, 2023 · 3 comments

Comments

@AnonN10
Copy link

AnonN10 commented Jun 30, 2023

There is a black patch of screen that clipped through a solid sphere, where no light goes in, therefore it should be pitch black. The tonemapper seems to skew the blacks towards dark-gray, losing effective LDR range a bit and removing contrast from the image. After inspecting LUT in renderdoc, I've noticed that the pixel at (0, 0, 0) is not actually black, but has a value 0.00014.

LUT:
image

With tonemapper:
image

Without tonemapper:
image

@h3r2tic
Copy link
Owner

h3r2tic commented Jun 30, 2023

Ah, quantization, what hast thou done?

Yeah, it would probably be a good idea to special-case that. Thanks for noticing and finding the cause!

@Froyok
Copy link

Froyok commented Jan 2, 2024

I wonder if this could be related to the same issue I noticed a while ago and mentioned on Mastodon: https://mastodon.gamedev.place/@froyok/109921004547221001

@Froyok
Copy link

Froyok commented Jul 26, 2024

Commenting again on this, I decided to "fix" it (well, more like compensate) in a quick and dirty way. The minimum value is 0.00014 in the LUT and the maximum 0.99805, so it's not a perfect 0-1 range, therefor I scaled the color result after the LUT is applied.

Which look something like this:

vec3 Tonemap_Tony_RemapRange( vec3 TonyColor )
{
	// Tony LUT min value is 0.00014 instead of 0.0
	// Max value is 0.99805 and not 1.0.
	const float Scale = 1.0 / ( 0.99805 - 0.00014 );
	return Saturate( ( TonyColor - 0.00018 ) * Scale );
}

Which that you get back true blacks. Haven't noticed change with highlights/pure white pixels (but that's harder to distinguish anyway).

[EDIT] Okay scratch that, this stupid fix introduces other issues (some clipping notably). So I advise against it.

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

No branches or pull requests

3 participants