mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 04:33:37 +00:00
Dither fix (#7977)
- Fixes #7965 - Code quality improvements. - Removes the unreferenced function `dither` in pbr_functions.wgsl introduced in72fbcc7
, but made obsolete inc069c54
. - Makes the reference to `screen_space_dither` in pbr.wgsl conditional on `#ifdef TONEMAP_IN_SHADER`, as the required import is conditional on the same, as deband dithering can only occur if tonemapping is also occurring. --------- Co-authored-by: Carter Anderson <mcanders1@gmail.com>
This commit is contained in:
parent
9784186fc6
commit
846b748c6f
2 changed files with 3 additions and 9 deletions
|
@ -105,8 +105,7 @@ fn fragment(in: FragmentInput) -> @location(0) vec4<f32> {
|
|||
}
|
||||
|
||||
#ifdef TONEMAP_IN_SHADER
|
||||
output_color = tone_mapping(output_color);
|
||||
#endif
|
||||
output_color = tone_mapping(output_color);
|
||||
#ifdef DEBAND_DITHER
|
||||
var output_rgb = output_color.rgb;
|
||||
output_rgb = powsafe(output_rgb, 1.0 / 2.2);
|
||||
|
@ -116,8 +115,9 @@ fn fragment(in: FragmentInput) -> @location(0) vec4<f32> {
|
|||
output_rgb = powsafe(output_rgb, 2.2);
|
||||
output_color = vec4(output_rgb, output_color.a);
|
||||
#endif
|
||||
#endif
|
||||
#ifdef PREMULTIPLY_ALPHA
|
||||
output_color = premultiply_alpha(material.flags, output_color);
|
||||
output_color = premultiply_alpha(material.flags, output_color);
|
||||
#endif
|
||||
return output_color;
|
||||
}
|
||||
|
|
|
@ -270,12 +270,6 @@ fn pbr(
|
|||
}
|
||||
#endif // NORMAL_PREPASS
|
||||
|
||||
#ifdef DEBAND_DITHER
|
||||
fn dither(color: vec4<f32>, pos: vec2<f32>) -> vec4<f32> {
|
||||
return vec4<f32>(color.rgb + screen_space_dither(pos.xy), color.a);
|
||||
}
|
||||
#endif // DEBAND_DITHER
|
||||
|
||||
#ifndef NORMAL_PREPASS
|
||||
fn apply_fog(input_color: vec4<f32>, fragment_world_position: vec3<f32>, view_world_position: vec3<f32>) -> vec4<f32> {
|
||||
let view_to_world = fragment_world_position.xyz - view_world_position.xyz;
|
||||
|
|
Loading…
Reference in a new issue