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);
|
||||
}
|
||||
Reference in New Issue
Block a user