Fix missing sRGB conversion for dithering non-HDR pipelines (#6707)
# Objective - Fixes #6706 Zoom in on the shadow in the following images: ## Current bevy/main ### HDR On - correct  ### HDR Off - incorrect  ## This PR ### HDR On - correct  ### HDR Off - corrected  ## Close-up comparison ### New  ### Old  ## Solution - It turns out there was an outright missing sRGB conversion for dithering non-HDR cameras. - I also tried using a precise sRGB conversion, but it had no apparent effect on the final image. --- ## Changelog - Fix deband dithering intensity for non-HDR pipelines.
This commit is contained in:
parent
3643074f21
commit
0df3b19757
@ -99,7 +99,13 @@ fn fragment(in: FragmentInput) -> @location(0) vec4<f32> {
|
||||
output_color = tone_mapping(output_color);
|
||||
#endif
|
||||
#ifdef DEBAND_DITHER
|
||||
output_color = dither(output_color, in.frag_coord.xy);
|
||||
var output_rgb = output_color.rgb;
|
||||
output_rgb = pow(output_rgb, vec3<f32>(1.0 / 2.2));
|
||||
output_rgb = output_rgb + screen_space_dither(in.frag_coord.xy);
|
||||
// This conversion back to linear space is required because our output texture format is
|
||||
// SRGB; the GPU will assume our output is linear and will apply an SRGB conversion.
|
||||
output_rgb = pow(output_rgb, vec3<f32>(2.2));
|
||||
output_color = vec4(output_rgb, output_color.a);
|
||||
#endif
|
||||
return output_color;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user