osc multi arguments
Some checks failed
CI / Native Windows Build And Tests (push) Failing after 7s
CI / React UI Build (push) Has been cancelled
CI / Windows Release Package (push) Has been cancelled

This commit is contained in:
2026-05-03 14:51:57 +10:00
parent 7dc4b552a5
commit 0560ea3c49
8 changed files with 436 additions and 48 deletions

View File

@@ -0,0 +1,63 @@
{
"id": "composition-guides",
"name": "Composition Guides",
"description": "Overlays rule-of-thirds guides and a center crosshair for camera alignment and framing.",
"category": "Utility",
"entryPoint": "shadeVideo",
"parameters": [
{
"id": "showThirds",
"label": "Rule of Thirds",
"type": "bool",
"default": true
},
{
"id": "showCrosshair",
"label": "Center Crosshair",
"type": "bool",
"default": true
},
{
"id": "lineColor",
"label": "Line Color",
"type": "color",
"default": [1.0, 1.0, 1.0, 1.0]
},
{
"id": "lineOpacity",
"label": "Line Opacity",
"type": "float",
"default": 0.65,
"min": 0.0,
"max": 1.0,
"step": 0.01
},
{
"id": "lineThicknessPixels",
"label": "Line Thickness",
"type": "float",
"default": 2.0,
"min": 0.5,
"max": 12.0,
"step": 0.1
},
{
"id": "crosshairSizePixels",
"label": "Crosshair Size",
"type": "float",
"default": 54.0,
"min": 8.0,
"max": 240.0,
"step": 1.0
},
{
"id": "crosshairGapPixels",
"label": "Crosshair Gap",
"type": "float",
"default": 10.0,
"min": 0.0,
"max": 80.0,
"step": 1.0
}
]
}

View File

@@ -0,0 +1,48 @@
float lineMask(float coordinate, float target, float pixelThickness, float resolution)
{
float halfWidth = max(pixelThickness, 0.5) * 0.5 / max(resolution, 1.0);
float distanceToLine = abs(coordinate - target);
float feather = halfWidth * 0.85 + (1.0 / max(resolution, 1.0));
return 1.0 - smoothstep(halfWidth, feather, distanceToLine);
}
float thirdsMask(float2 uv, float2 resolution)
{
float thickness = max(lineThicknessPixels, 0.5);
float mask = 0.0;
mask = max(mask, lineMask(uv.x, 1.0 / 3.0, thickness, resolution.x));
mask = max(mask, lineMask(uv.x, 2.0 / 3.0, thickness, resolution.x));
mask = max(mask, lineMask(uv.y, 1.0 / 3.0, thickness, resolution.y));
mask = max(mask, lineMask(uv.y, 2.0 / 3.0, thickness, resolution.y));
return mask;
}
float crosshairMask(float2 uv, float2 resolution)
{
float2 pixel = (uv - 0.5) * resolution;
float halfThickness = max(lineThicknessPixels, 0.5) * 0.5;
float halfSize = max(crosshairSizePixels, 1.0) * 0.5;
float halfGap = max(crosshairGapPixels, 0.0) * 0.5;
float horizontalExtent = step(abs(pixel.x), halfSize) * (1.0 - step(abs(pixel.x), halfGap));
float verticalExtent = step(abs(pixel.y), halfSize) * (1.0 - step(abs(pixel.y), halfGap));
float horizontalLine = horizontalExtent * (1.0 - smoothstep(halfThickness, halfThickness + 1.5, abs(pixel.y)));
float verticalLine = verticalExtent * (1.0 - smoothstep(halfThickness, halfThickness + 1.5, abs(pixel.x)));
return max(horizontalLine, verticalLine);
}
float4 shadeVideo(ShaderContext context)
{
float2 resolution = max(context.outputResolution, float2(1.0, 1.0));
float mask = 0.0;
if (showThirds)
mask = max(mask, thirdsMask(context.uv, resolution));
if (showCrosshair)
mask = max(mask, crosshairMask(context.uv, resolution));
float opacity = saturate(lineOpacity * lineColor.a) * mask;
float3 color = lerp(context.sourceColor.rgb, lineColor.rgb, opacity);
return float4(color, context.sourceColor.a);
}