mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Avoided black hexagons when bloom is enabled by suppressing NaN/Inf pixels during the first bloom blur pass
This commit is contained in:
parent
0332902349
commit
5217b5090c
@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
- The menu map now properly handles dragging the map, zooming, and setting the waypoint when hovering icons
|
||||
- Falling through an airship in flight should no longer be possible (although many issues with airship physics remain)
|
||||
- Avoided black hexagons when bloom is enabled by suppressing NaN/Inf pixels during the first bloom blur pass
|
||||
|
||||
## [0.11.0] - 2021-09-11
|
||||
|
||||
|
@ -68,17 +68,21 @@ vec4 filteredDownsample(vec2 uv, vec2 halfpixel) {
|
||||
return sum / 32.0;
|
||||
}
|
||||
|
||||
vec4 simplesample(vec2 uv) {
|
||||
return textureLod(sampler2D(t_src_color, s_src_color), uv, 0);
|
||||
vec4 naninf_filter_sample(vec2 uv) {
|
||||
vec4 color = textureLod(sampler2D(t_src_color, s_src_color), uv, 0);
|
||||
// TODO: ensure NaNs/Infs are not produced in the first place
|
||||
bvec4 nan = isnan(color);
|
||||
bvec4 inf = isinf(color);
|
||||
return mix(mix(color, vec4(0.0), nan), vec4(100.0), inf);
|
||||
}
|
||||
|
||||
// From: https://community.arm.com/cfs-file/__key/communityserver-blogs-components-weblogfiles/00-00-00-20-66/siggraph2015_2D00_mmg_2D00_marius_2D00_notes.pdf
|
||||
vec4 downsample(vec2 uv, vec2 halfpixel) {
|
||||
vec4 sum = simplesample(uv) * 4.0;
|
||||
sum += simplesample(uv - halfpixel.xy);
|
||||
sum += simplesample(uv + halfpixel.xy);
|
||||
sum += simplesample(uv + vec2(halfpixel.x, -halfpixel.y));
|
||||
sum += simplesample(uv - vec2(halfpixel.x, -halfpixel.y));
|
||||
vec4 sum = naninf_filter_sample(uv) * 4.0;
|
||||
sum += naninf_filter_sample(uv - halfpixel.xy);
|
||||
sum += naninf_filter_sample(uv + halfpixel.xy);
|
||||
sum += naninf_filter_sample(uv + vec2(halfpixel.x, -halfpixel.y));
|
||||
sum += naninf_filter_sample(uv - vec2(halfpixel.x, -halfpixel.y));
|
||||
|
||||
return sum / 8.0;
|
||||
}
|
||||
|
@ -286,7 +286,11 @@ impl<'frame> Drawer<'frame> {
|
||||
(0..bloom::NUM_SIZES - 1).for_each(|index| {
|
||||
let bind = &bloom_binds[index].bind_group;
|
||||
let view = &bloom_tgts[index + 1];
|
||||
// Do filtering out of non-bright things during the first downsample
|
||||
// Do filtering during the first downsample
|
||||
// NOTE: We currently blur all things without filtering by brightness.
|
||||
// This is left in for those that might want to experminent with filtering by
|
||||
// brightness, and it is used to filter out NaNs/Infs that would infect all the
|
||||
// pixels they are blurred with.
|
||||
let (label, pipeline) = if index == 0 {
|
||||
(
|
||||
format!("downsample filtered {}", index + 1),
|
||||
|
Loading…
Reference in New Issue
Block a user