8000 Load images in linear gamma by hollasch · Pull Request #1450 · RayTracing/raytracing.github.io · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Load images in linear gamma #1450

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

Merged
merged 2 commits into from
Mar 23, 2024
Merged

Load images in linear gamma #1450

merged 2 commits into from
Mar 23, 2024

Conversation

hollasch
Copy link
Collaborator

We were using the STBI stbi_load() function, which loads gamma-corrected byte data from the given image.

Instead, we want our image data to be in linear space for internal computation, with a final gamma=2 correction applied when we write the rendered result.

Happily, there's an stbi_loadf() function that loads linearly-encoded image data as triples of 32-bit floating-point values.

We don't really need to explain all the machinery, as we kind of just plop rtw_stb_image.h down for the readers to use. I do add some explanation though that we want loaded images to be in linear color space.

Resolves #842

We were using the STBI `stbi_load()` function, which loads
gamma-corrected byte data from the given image.

Instead, we want our image data to be in linear space for internal
computation, with a final gamma=2 correction applied when we write the
rendered result.

Happily, there's an `stbi_loadf()` function that loads linearly-encoded
image data as triples of 32-bit floating-point values.

We don't really need to explain all the machinery, as we kind of just
plop `rtw_stb_image.h` down for the readers to use. I do add some
explanation though that we want loaded images to be in linear color
space.

Resolves #842
@hollasch hollasch added this to the v4.0.0-alpha.2 milestone Mar 21, 2024
@hollasch hollasch requested a review from a team March 21, 2024 21:24
@hollasch hollasch self-assigned this Mar 21, 2024
@hollasch hollasch merged commit 6af7b47 into dev Mar 23, 2024
@hollasch hollasch deleted the linear-decode-on-image-load branch March 23, 2024 20:50
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.

2 participants
0