Additional shaders
This commit is contained in:
46
shaders/anamorphic-desqueeze/shader.json
Normal file
46
shaders/anamorphic-desqueeze/shader.json
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"id": "anamorphic-desqueeze",
|
||||
"name": "Anamorphic Desqueeze",
|
||||
"description": "Desqueezes anamorphic footage by 1.3x, 1.33x, 1.5x, or 2x with fit or fill framing.",
|
||||
"category": "Transform",
|
||||
"entryPoint": "shadeVideo",
|
||||
"parameters": [
|
||||
{
|
||||
"id": "desqueezeFactor",
|
||||
"label": "Desqueeze",
|
||||
"type": "enum",
|
||||
"default": "x1_33",
|
||||
"options": [
|
||||
{ "value": "x1_3", "label": "1.3x" },
|
||||
{ "value": "x1_33", "label": "1.33x" },
|
||||
{ "value": "x1_5", "label": "1.5x" },
|
||||
{ "value": "x2_0", "label": "2x" }
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "framing",
|
||||
"label": "Framing",
|
||||
"type": "enum",
|
||||
"default": "fit",
|
||||
"options": [
|
||||
{ "value": "fit", "label": "Fit" },
|
||||
{ "value": "fill", "label": "Fill" }
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "pan",
|
||||
"label": "Pan",
|
||||
"type": "vec2",
|
||||
"default": [0.0, 0.0],
|
||||
"min": [-1.0, -1.0],
|
||||
"max": [1.0, 1.0],
|
||||
"step": [0.001, 0.001]
|
||||
},
|
||||
{
|
||||
"id": "outsideColor",
|
||||
"label": "Outside Color",
|
||||
"type": "color",
|
||||
"default": [0.0, 0.0, 0.0, 1.0]
|
||||
}
|
||||
]
|
||||
}
|
||||
32
shaders/anamorphic-desqueeze/shader.slang
Normal file
32
shaders/anamorphic-desqueeze/shader.slang
Normal file
@@ -0,0 +1,32 @@
|
||||
float selectedDesqueezeFactor()
|
||||
{
|
||||
if (desqueezeFactor == 0)
|
||||
return 1.3;
|
||||
if (desqueezeFactor == 1)
|
||||
return 1.3333333;
|
||||
if (desqueezeFactor == 2)
|
||||
return 1.5;
|
||||
return 2.0;
|
||||
}
|
||||
|
||||
float4 shadeVideo(ShaderContext context)
|
||||
{
|
||||
float factor = selectedDesqueezeFactor();
|
||||
float2 centered = context.uv - 0.5;
|
||||
|
||||
if (framing == 0)
|
||||
{
|
||||
centered.y *= factor;
|
||||
}
|
||||
else
|
||||
{
|
||||
centered.x /= factor;
|
||||
}
|
||||
|
||||
float2 sourceUv = centered + 0.5 - pan;
|
||||
bool inside = sourceUv.x >= 0.0 && sourceUv.x <= 1.0 && sourceUv.y >= 0.0 && sourceUv.y <= 1.0;
|
||||
if (!inside)
|
||||
return outsideColor;
|
||||
|
||||
return sampleVideo(sourceUv);
|
||||
}
|
||||
8
shaders/smpte-color-bars/shader.json
Normal file
8
shaders/smpte-color-bars/shader.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"id": "smpte-color-bars",
|
||||
"name": "SMPTE Color Bars",
|
||||
"description": "Generates a procedural SMPTE RP 219-style 16:9 color bar test pattern matching the common Wikimedia 1920x1080 reference layout.",
|
||||
"category": "Calibration",
|
||||
"entryPoint": "shadeVideo",
|
||||
"parameters": []
|
||||
}
|
||||
90
shaders/smpte-color-bars/shader.slang
Normal file
90
shaders/smpte-color-bars/shader.slang
Normal file
@@ -0,0 +1,90 @@
|
||||
float3 hexColor(float r, float g, float b)
|
||||
{
|
||||
return float3(r, g, b) / 255.0;
|
||||
}
|
||||
|
||||
float3 smpteTop(float x)
|
||||
{
|
||||
if (x < 240.0)
|
||||
return hexColor(102.0, 102.0, 102.0);
|
||||
if (x < 445.0)
|
||||
return hexColor(191.0, 191.0, 191.0);
|
||||
if (x < 651.0)
|
||||
return hexColor(191.0, 191.0, 0.0);
|
||||
if (x < 857.0)
|
||||
return hexColor(0.0, 191.0, 191.0);
|
||||
if (x < 1063.0)
|
||||
return hexColor(0.0, 191.0, 0.0);
|
||||
if (x < 1269.0)
|
||||
return hexColor(191.0, 0.0, 191.0);
|
||||
if (x < 1475.0)
|
||||
return hexColor(191.0, 0.0, 0.0);
|
||||
if (x < 1680.0)
|
||||
return hexColor(0.0, 0.0, 191.0);
|
||||
return hexColor(102.0, 102.0, 102.0);
|
||||
}
|
||||
|
||||
float3 smpteMiddleA(float x)
|
||||
{
|
||||
if (x < 240.0)
|
||||
return hexColor(0.0, 255.0, 255.0);
|
||||
if (x < 445.0)
|
||||
return hexColor(0.0, 63.0, 105.0);
|
||||
if (x < 1680.0)
|
||||
return hexColor(191.0, 191.0, 191.0);
|
||||
return hexColor(0.0, 0.0, 255.0);
|
||||
}
|
||||
|
||||
float3 smpteMiddleB(float x)
|
||||
{
|
||||
if (x < 240.0)
|
||||
return hexColor(255.0, 255.0, 0.0);
|
||||
if (x < 445.0)
|
||||
return hexColor(65.0, 0.0, 119.0);
|
||||
if (x < 1475.0)
|
||||
{
|
||||
float ramp = saturate((x - 445.0) / (1475.0 - 445.0));
|
||||
return float3(ramp, ramp, ramp);
|
||||
}
|
||||
if (x < 1680.0)
|
||||
return float3(1.0, 1.0, 1.0);
|
||||
return hexColor(255.0, 0.0, 0.0);
|
||||
}
|
||||
|
||||
float3 smpteBottom(float x)
|
||||
{
|
||||
if (x < 240.0)
|
||||
return hexColor(38.0, 38.0, 38.0);
|
||||
if (x < 549.0)
|
||||
return float3(0.0, 0.0, 0.0);
|
||||
if (x < 960.0)
|
||||
return float3(1.0, 1.0, 1.0);
|
||||
if (x < 1268.0)
|
||||
return float3(0.0, 0.0, 0.0);
|
||||
if (x < 1337.0)
|
||||
return hexColor(5.0, 5.0, 5.0);
|
||||
if (x < 1405.0)
|
||||
return float3(0.0, 0.0, 0.0);
|
||||
if (x < 1474.0)
|
||||
return hexColor(10.0, 10.0, 10.0);
|
||||
if (x < 1680.0)
|
||||
return float3(0.0, 0.0, 0.0);
|
||||
return hexColor(38.0, 38.0, 38.0);
|
||||
}
|
||||
|
||||
float4 shadeVideo(ShaderContext context)
|
||||
{
|
||||
float2 uv = saturate(context.uv);
|
||||
float2 pixel = float2(uv.x, 1.0 - uv.y) * float2(1920.0, 1080.0);
|
||||
|
||||
if (pixel.y < 630.0)
|
||||
return float4(smpteTop(pixel.x), 1.0);
|
||||
|
||||
if (pixel.y < 720.0)
|
||||
return float4(smpteMiddleA(pixel.x), 1.0);
|
||||
|
||||
if (pixel.y < 810.0)
|
||||
return float4(smpteMiddleB(pixel.x), 1.0);
|
||||
|
||||
return float4(smpteBottom(pixel.x), 1.0);
|
||||
}
|
||||
15
shaders/solid-color/shader.json
Normal file
15
shaders/solid-color/shader.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"id": "solid-color",
|
||||
"name": "Solid Color",
|
||||
"description": "Fills the frame with a single user-selected color.",
|
||||
"category": "Color",
|
||||
"entryPoint": "shadeVideo",
|
||||
"parameters": [
|
||||
{
|
||||
"id": "fillColor",
|
||||
"label": "Fill",
|
||||
"type": "color",
|
||||
"default": [1.0, 1.0, 1.0, 1.0]
|
||||
}
|
||||
]
|
||||
}
|
||||
4
shaders/solid-color/shader.slang
Normal file
4
shaders/solid-color/shader.slang
Normal file
@@ -0,0 +1,4 @@
|
||||
float4 shadeVideo(ShaderContext context)
|
||||
{
|
||||
return saturate(fillColor);
|
||||
}
|
||||
Reference in New Issue
Block a user