@@ -15,11 +15,9 @@ const float kPi = 3.1415926536;
1515const float kEuler = 2.718281828459 ;
1616const float kMax = 1.0 ;
1717
18- #define UNIFIED_SCANLINE_BLOOM
1918
2019const float kBeamWidth = 0.5 ;
2120
22- const vec3 kLuminanceWeights = vec3 (0.2126 , 0.7152 , 0.0722 );
2321
2422const uint kChannelMask = 3u;
2523const uint kFirstChannelShift = 2u;
@@ -188,7 +186,7 @@ vec3 LinearToSignal(const vec3 linear_colour)
188186
189187vec3 HDR10(const vec3 hdr_linear)
190188{
191- vec3 pq_input = hdr_linear * vec3 (global.PaperWhiteNits / kMaxNitsFor2084);
189+ vec3 pq_input = hdr_linear * vec3 (global.BrightnessNits / kMaxNitsFor2084);
192190
193191 vec3 hdr10 = LinearToST2084(max (pq_input, vec3 (0 .0f)));
194192
@@ -197,7 +195,7 @@ vec3 HDR10(const vec3 hdr_linear)
197195
198196vec4 HDR10(const vec4 hdr_linear)
199197{
200- vec3 pq_input = hdr_linear.rgb * vec3 (global.PaperWhiteNits / kMaxNitsFor2084);
198+ vec3 pq_input = hdr_linear.rgb * vec3 (global.BrightnessNits / kMaxNitsFor2084);
201199
202200 vec3 hdr10 = LinearToST2084(max (pq_input, vec3 (0 .0f)));
203201
@@ -258,30 +256,6 @@ vec3 ScanlineColour(const vec2 tex_coord,
258256 float distance_adjusted = max (0.0 , raw_distance);
259257 float effective_distance = distance_adjusted * 2.0 ;
260258
261- #ifdef UNIFIED_SCANLINE_BLOOM
262- /* Unified bloom: compute a single horizontal interpolation from luminance
263- * so the scanline envelope is shared across all channels in the phosphor
264- * triad, preventing colour shifts from per-channel bloom differences. */
265- float lum_0 = dot (signal_0, kLuminanceWeights);
266- float lum_1 = dot (signal_1, kLuminanceWeights);
267- float lum_horiz_interp = Bezier(narrowed_source_pixel_offset, BeamControlPoints(beam_attack, lum_0 > lum_1));
268- float beam_intensity = clamp (mix (lum_0, lum_1, lum_horiz_interp), 0.0 , 1.0 );
269-
270- float beam_width = mix (scanline_min, scanline_max, beam_intensity);
271- float scanline_dist = clamp (effective_distance / beam_width, 0.0 , 1.0 );
272- vec4 control_points = vec4 (1.0 , 1.0 , beam_intensity * scanline_attack, 0.0 );
273- float envelope = Bezier(scanline_dist, control_points);
274-
275- for (int ch = 0 ; ch < 3 ; ch++ )
276- {
277- float horiz_interp = Bezier(narrowed_source_pixel_offset, BeamControlPoints(beam_attack, signal_0[ch] > signal_1[ch]));
278- float signal_channel = mix (signal_0[ch], signal_1[ch], horiz_interp);
279-
280- result[ch] = envelope * signal_channel;
281- }
282- #else
283- /* Per-channel bloom: each channel computes its own scanline envelope based on
284- * its individual brightness (models independent electron gun bloom). */
285259 for (int ch = 0 ; ch < 3 ; ch++ )
286260 {
287261 float horiz_interp = Bezier(narrowed_source_pixel_offset, BeamControlPoints(beam_attack, signal_0[ch] > signal_1[ch]));
@@ -298,7 +272,6 @@ vec3 ScanlineColour(const vec2 tex_coord,
298272
299273 result[ch] = luminance * signal_channel;
300274 }
301- #endif
302275
303276 return result;
304277}
@@ -418,15 +391,15 @@ void main()
418391 {
419392 /* scRGB mode: sRGB to linear for scRGB / HDR16 swapchain.
420393 * Scale by MaxNits / kscRGBWhiteNits because scRGB 1.0 = 80 nits.
421- * Using MaxNits (not PaperWhiteNits ) so the SDR UI fills the
394+ * Using MaxNits (not BrightnessNits ) so the SDR UI fills the
422395 * display's native range, preserving tonal balance uniformly. */
423396 if ((global.Scanlines > 0.0 ) && (global.OutputSize.y > 240.0 * 4.0 ))
424397 {
425398 /* Scanlines() returns linear Rec.709 with mask already applied in Rec.709 space.
426399 * scRGB units: 1.0 = 80 nits. */
427400 vec3 linear = Scanlines(vTexCoord);
428401
429- FragColor = vec4 (linear * (global.PaperWhiteNits / kscRGBWhiteNits), 1.0 );
402+ FragColor = vec4 (linear * (global.BrightnessNits / kscRGBWhiteNits), 1.0 );
430403 }
431404 else
432405 {
0 commit comments