Skip to content

Commit 87a0242

Browse files
garamond13Filoppi
authored andcommitted
Luma: Cleanup Luma bloom
1 parent fcb7184 commit 87a0242

1 file changed

Lines changed: 1 addition & 21 deletions

File tree

‎Shaders/Includes/Bloom.hlsl‎

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -58,33 +58,13 @@ void bloom_main_vs(uint vid : SV_VertexID, out float4 pos : SV_Position, out flo
5858
pos = float4(texcoord * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);
5959
}
6060

61-
// t - soft threshold, should be in range (0, +inf)
62-
// h - knee height, should be in range (0, t)
63-
// p - knee sharpness, should be in range (1, +inf)
64-
//
65-
// f(x) = x - x / (1 + h / (t - h) * (|x| / t)^p)
66-
//
67-
// This can break for large p (20+)!
68-
//float3 luma_bloom_threshold(float3 color)
69-
//{
70-
// // Rename.
71-
// const float t = LUMA_BLOOM_THRESHOLD_SOFT_THRESHOLD;
72-
// const float h = LUMA_BLOOM_THRESHOLD_KNEE_HEIGHT;
73-
// const float p = LUMA_BLOOM_THRESHOLD_KNEE_SHARPNESS;
74-
//
75-
// color = max(0.0, color);
76-
// const float k = max(color.r, max(color.g, color.b));
77-
// const float u = h / (t - h) * pow(k / t, p);
78-
// return color * (u / (1.0 + u)); // Optimized, color * scale(k) / k
79-
//}
80-
8161
// t - soft threshold, should be in range (0, +inf)
8262
// h - knee height, should be in range (0, t)
8363
// p - knee sharpness, should be in range (1, +inf)
8464
//
8565
// f(x) = x - x / (1 + exp2(log2(h / (t - h)) + p * log2(|x| / t)))
8666
//
87-
// This is equivalent to f(x) = x - x / (1 + h / (t - h) * (|x| / t)^p) implementation, but safe for large p.
67+
// This would be equivalent to f(x) = x - x / (1 + h / (t - h) * (|x| / t)^p) implementation, but safe for large p.
8868
float3 luma_bloom_threshold(float3 color)
8969
{
9070
// Rename.

0 commit comments

Comments
 (0)