mirror of
https://github.com/Rezmason/matrix.git
synced 2026-04-18 14:19:30 -07:00
The WebGPU rainPass now performs a high pass filter on its own fragments. I think I prefer this to a separate high pass filter, because this one is pre-blendfunc, ie. fragments will only be added to the texture if they are individually bright enough to contribute.
This commit is contained in:
@@ -37,6 +37,7 @@
|
||||
slantScale : f32;
|
||||
slantVec : vec2<f32>;
|
||||
volumetric : i32;
|
||||
highPassThreshold : f32;
|
||||
};
|
||||
|
||||
// The properties that change over time get their own buffer.
|
||||
@@ -89,6 +90,7 @@ struct VertOutput {
|
||||
|
||||
struct FragOutput {
|
||||
[[location(0)]] color : vec4<f32>;
|
||||
[[location(1)]] highPassColor : vec4<f32>;
|
||||
};
|
||||
|
||||
// Constants
|
||||
@@ -432,5 +434,17 @@ fn getSymbolUV(glyphCycle : f32) -> vec2<f32> {
|
||||
output.color = vec4<f32>(input.channel * brightness * alpha, 1.0);
|
||||
}
|
||||
|
||||
var highPassColor = output.color;
|
||||
if (highPassColor.r < config.highPassThreshold) {
|
||||
highPassColor.r = 0.0;
|
||||
}
|
||||
if (highPassColor.g < config.highPassThreshold) {
|
||||
highPassColor.g = 0.0;
|
||||
}
|
||||
if (highPassColor.b < config.highPassThreshold) {
|
||||
highPassColor.b = 0.0;
|
||||
}
|
||||
output.highPassColor = highPassColor;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user