@Name: Compositional Guide
@Version: 1.0
@Description: Draws compositional overlay guides. Use the checkbox to disable this for the final render. Mode 0: rule-of-thirds. Mode 1: center cross.
@Mode: 0.0
float line_width_px = 3.0;
float h_line_width = line_width_px / float(height);
float v_line_width = line_width_px / float(width);
float guide = 0.0;
if (@Mode >= 0.0 && @Mode < 1.0) {
// Rule-of-thirds: lines at 1/3 and 2/3
float h1 = abs(uv.y - 1.0/3.0);
float h2 = abs(uv.y - 2.0/3.0);
float v1 = abs(uv.x - 1.0/3.0);
float v2 = abs(uv.x - 2.0/3.0);
float h_line = 1.0 - smoothstep(h_line_width * 0.5, h_line_width * 0.5 + 0.001, min(h1, h2));
float v_line = 1.0 - smoothstep(v_line_width * 0.5, v_line_width * 0.5 + 0.001, min(v1, v2));
guide = max(h_line, v_line);
} else if (@Mode >= 1.0 && @Mode < 2.0) {
// Center cross: lines at 1/2
float h_center = abs(uv.y - 0.5);
float v_center = abs(uv.x - 0.5);
float h_line = 1.0 - smoothstep(h_line_width * 0.5, h_line_width * 0.5 + 0.001, h_center);
float v_line = 1.0 - smoothstep(v_line_width * 0.5, v_line_width * 0.5 + 0.001, v_center);
guide = max(h_line, v_line);
}
if (guide > 0.0) {
vec3 guide_color = vec3(1.0) - input_color.rgb; // Inverted color for good contrast
output_color = vec4(mix(input_color.rgb, guide_color, guide), input_color.a);
} else {
output_color = input_color;
}