Skip to content

Commit 1064e94

Browse files
committed
better restoration algorithm
1 parent 1dc55a8 commit 1064e94

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/engine/renderer/glsl_source/cameraEffects_fp.glsl

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -136,15 +136,13 @@ void main()
136136
{
137137
float t = threshold - ( i * ( threshold / 10 ) );
138138

139-
bvec3 cutoff = lessThan( mapped, vec3(t) );
140-
141-
#if __VERSION__ > 120
142-
vec3 interpolation = vec3(0.5f) * vec3(cutoff);
143-
#else
144-
vec3 interpolation = 0.5f * cutoff;
145-
#endif
146-
147-
mapped = mix( mapped, color.rgb, interpolation );
139+
if ( ( color.r + color.g + color.b ) < ( 3 * threshold ) )
140+
{
141+
if ( ( mapped.r + mapped.g + mapped.b ) < ( 3 * threshold ) )
142+
{
143+
mapped = mix( mapped, color.rgb, 0.5f );
144+
}
145+
}
148146
}
149147

150148
color.rgb = mapped;

0 commit comments

Comments
 (0)