|
@@ -31,28 +31,28 @@ fun bloom_upsample_pass_vert(input: vert_in): vert_out {
|
|
|
return output;
|
|
|
}
|
|
|
|
|
|
-fun upsample_dual_filter(tex: tex2d, tex_coord: float2, texel_size: float2): float3 {
|
|
|
+fun upsample_dual_filter(tex_coord: float2, texel_size: float2): float3 {
|
|
|
var delta: float2 = texel_size * constants.sample_scale;
|
|
|
|
|
|
var result: float3;
|
|
|
result = sample_lod(tex, sampler_linear, tex_coord + float2(-delta.x * 2.0, 0.0), 0.0).rgb;
|
|
|
result += sample_lod(tex, sampler_linear, tex_coord + float2(-delta.x, delta.y), 0.0).rgb * 2.0;
|
|
|
result += sample_lod(tex, sampler_linear, tex_coord + float2(0.0, delta.y * 2.0), 0.0).rgb;
|
|
|
- result += sample_lod(tex, sampler_linear, tex_coord + delta, 0.0).rgb * 2.0;
|
|
|
+ result += sample_lod(tex, sampler_linear, tex_coord + delta, 0.0).rgb * 2.0;
|
|
|
result += sample_lod(tex, sampler_linear, tex_coord + float2(delta.x * 2.0, 0.0), 0.0).rgb;
|
|
|
result += sample_lod(tex, sampler_linear, tex_coord + float2(delta.x, -delta.y), 0.0).rgb * 2.0;
|
|
|
result += sample_lod(tex, sampler_linear, tex_coord + float2(0.0, -delta.y * 2.0), 0.0).rgb;
|
|
|
- result += sample_lod(tex, sampler_linear, tex_coord - delta, 0.0).rgb * 2.0;
|
|
|
+ result += sample_lod(tex, sampler_linear, tex_coord - delta, 0.0).rgb * 2.0;
|
|
|
|
|
|
return result * (1.0 / 12.0);
|
|
|
}
|
|
|
|
|
|
fun bloom_upsample_pass_frag(input: vert_out): float4 {
|
|
|
var color: float4;
|
|
|
- color.rgb = upsample_dual_filter(tex, input.tex, constants.screen_size_inv);
|
|
|
+ color.rgb = upsample_dual_filter(input.tex, constants.screen_size_inv);
|
|
|
|
|
|
if (constants.current_mip_level == 0) {
|
|
|
- color.rgb = color.rgb * bloom_strength;
|
|
|
+ color.rgb = color.rgb * float3(bloom_strength, bloom_strength, bloom_strength);
|
|
|
}
|
|
|
|
|
|
color.a = 1.0;
|