This commit is contained in:
2026-05-02 16:40:21 +10:00
parent 8d01ea4a3c
commit 1a4c33b9dc
23 changed files with 3725 additions and 401 deletions

View File

@@ -0,0 +1,50 @@
{
"id": "studio-color",
"name": "Studio Color",
"description": "A built-in sample shader package that demonstrates the runtime parameter contract.",
"category": "Built-in",
"entryPoint": "shadeVideo",
"parameters": [
{
"id": "brightness",
"label": "Brightness",
"type": "float",
"default": 1.0,
"min": 0.0,
"max": 2.0,
"step": 0.01
},
{
"id": "offset",
"label": "Offset",
"type": "vec2",
"default": [0.0, 0.0],
"min": [-0.2, -0.2],
"max": [0.2, 0.2],
"step": [0.001, 0.001]
},
{
"id": "tint",
"label": "Tint",
"type": "color",
"default": [1.0, 1.0, 1.0, 1.0]
},
{
"id": "invert",
"label": "Invert",
"type": "bool",
"default": false
},
{
"id": "mode",
"label": "Mode",
"type": "enum",
"default": "normal",
"options": [
{ "value": "normal", "label": "Normal" },
{ "value": "luma", "label": "Luma" },
{ "value": "posterize", "label": "Posterize" }
]
}
]
}

View File

@@ -0,0 +1,23 @@
float4 shadeVideo(ShaderContext context)
{
float2 uv = clamp(context.uv + offset, float2(0.0, 0.0), float2(1.0, 1.0));
float4 color = sampleVideo(uv);
color.rgb *= brightness;
color *= tint;
if (invert)
color.rgb = 1.0 - color.rgb;
if (mode == 1)
{
float luma = dot(color.rgb, float3(0.2126, 0.7152, 0.0722));
color.rgb = float3(luma, luma, luma);
}
else if (mode == 2)
{
color.rgb = floor(color.rgb * 4.0) / 4.0;
}
return saturate(color);
}