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

Fractal colorizer is callibrated for sRGB #38

Open
Kneelawk opened this issue Aug 6, 2022 · 1 comment
Open

Fractal colorizer is callibrated for sRGB #38

Kneelawk opened this issue Aug 6, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@Kneelawk
Copy link
Owner

Kneelawk commented Aug 6, 2022

The Issue

Currently the default fractal colorizer outputs raw sRGB values instead of the linear-sRGB values expected by shaders. This means that sometimes rendering to the wrong surface or texture format will cause fractals to look "washed-out".

The Workaround

The current work around is to just keep fractal textures in Rgba8Unorm format and to only render to Bgra8Unorm surfaces. Rendering fractal textures to a Rgb8UnormSrgb texture would cause generated PNGs to look washed-out and using a Bgra8UnormSrgb surface format will make the fractal look washed-out in the viewer.

The Solution

My eventual plan for a solution for this is to switch everything over to Rgba8UnormSrgb and Bgra8UnormSrgb formats and just have this specific colorizer convert its output back to linear-sRGB in the shader and not perform any conversion for the CPU variant.

When new colorizers are introduced, GPU colorizers will output linear-sRGB by default in the shader and let WGPU convert their output to sRGB for storage. CPU colorizers will also output linear-sRGB by default but will have to have their output manually converted to sRGB.

@Kneelawk Kneelawk added the bug Something isn't working label Aug 6, 2022
@Kneelawk
Copy link
Owner Author

Kneelawk commented Aug 6, 2022

I should note that not everything supports the Bgra8UnormSrgb surface format (e.g. WebGPU). So instead, I should probably have it be configurable whether any colorizer outputs sRGB or linear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant