Name the clipped channels in the Ctrl clipping overlay again.
0c113e7 packed clipping into two alpha states (shadow / highlight), so the finish
pass could only paint white even though the legend still promised red, green,
blue and yellow. The grade pass now writes a 4-bit code (R/G/B + shadow) into
alpha and the overlay paints the channels it actually lost: red for one, yellow
for two, white for all three. The render check renders the overlay so this
cannot regress silently.
🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
+31
-11
@@ -549,10 +549,15 @@ void main(){
|
||||
|
||||
// Alpha carries the *source* clipping state to the finish pass, so the
|
||||
// warning reflects the pixels the sensor/proxy had, not the graded result.
|
||||
float clipFlag = 0.0;
|
||||
if (max(src.r, max(src.g, src.b)) >= 0.996) clipFlag += 0.5;
|
||||
if (min(src.r, min(src.g, src.b)) <= 0.004) clipFlag += 0.25;
|
||||
outColor = vec4(clamp(srgb, 0.0, 1.0), clipFlag);
|
||||
// It is a 4-bit code in sixteenths: bit 0/1/2 = red/green/blue clipped and
|
||||
// bit 3 = shadow clipped, so the overlay can still name the channels instead
|
||||
// of collapsing every highlight warning to white.
|
||||
float clipCode = 0.0;
|
||||
if (src.r >= 0.996) clipCode += 1.0;
|
||||
if (src.g >= 0.996) clipCode += 2.0;
|
||||
if (src.b >= 0.996) clipCode += 4.0;
|
||||
if (min(src.r, min(src.g, src.b)) <= 0.004) clipCode += 8.0;
|
||||
outColor = vec4(clamp(srgb, 0.0, 1.0), clipCode / 16.0);
|
||||
}`;
|
||||
|
||||
const BLUR_FRAG = `#version 300 es
|
||||
@@ -857,15 +862,30 @@ void main(){
|
||||
// Clipping overlay: which channels have run out of headroom. Red/green/blue
|
||||
// mean one channel clipped, yellow means two, white means all three — the
|
||||
// same reading Aperture's exposure warnings gave while you dragged.
|
||||
// The grade pass wrote the untouched source's clipping state into alpha:
|
||||
// 0.25 shadow, 0.50 highlight, 0.75 both. Warning about the source means it
|
||||
// still tells the truth after a curve or a shadow lift.
|
||||
float srcClip = texture(u_graded, v_uv).a;
|
||||
// The grade pass wrote the untouched source's clipping state into alpha as a
|
||||
// 4-bit code in sixteenths, so warning about the source still tells the truth
|
||||
// after a curve or a shadow lift and the channels are still known here.
|
||||
int clipCode = int(texture(u_graded, v_uv).a * 16.0 + 0.5);
|
||||
bool clipR = (clipCode & 1) != 0;
|
||||
bool clipG = (clipCode & 2) != 0;
|
||||
bool clipB = (clipCode & 4) != 0;
|
||||
bool clipShadow = (clipCode & 8) != 0;
|
||||
if (u_clip > 1.5) {
|
||||
if (srcClip >= 0.2 && srcClip < 0.5) finalCol = vec3(0.15, 0.4, 1.0);
|
||||
else if (srcClip >= 0.7) finalCol = vec3(0.15, 0.4, 1.0);
|
||||
// Shadow clipping: everything that has fallen to the bottom of the range.
|
||||
if (clipShadow) finalCol = vec3(0.15, 0.4, 1.0);
|
||||
} else if (u_clip > 0.5) {
|
||||
if (srcClip >= 0.5) finalCol = vec3(1.0);
|
||||
float n = float(clipR) + float(clipG) + float(clipB);
|
||||
if (n > 0.5) {
|
||||
vec3 mark = vec3(1.0);
|
||||
if (n < 1.5) {
|
||||
if (clipR) mark = vec3(1.0, 0.12, 0.12);
|
||||
else if (clipG) mark = vec3(0.1, 1.0, 0.2);
|
||||
else mark = vec3(0.15, 0.4, 1.0);
|
||||
} else if (n < 2.5) {
|
||||
mark = vec3(1.0, 0.9, 0.1);
|
||||
}
|
||||
finalCol = mark;
|
||||
}
|
||||
}
|
||||
outColor = vec4(finalCol, 1.0);
|
||||
}`;
|
||||
|
||||
Reference in New Issue
Block a user