Example shaders
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 15:44:22 +10:00
parent ee6dbf7510
commit 52bf8c90ea
12 changed files with 447 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
{
"id": "false-color",
"name": "False Color",
"description": "Maps luminance ranges to exposure-assist colors for camera and shader debugging.",
"category": "Utility",
"entryPoint": "shadeVideo",
"parameters": [
{
"id": "blendAmount",
"label": "Blend",
"type": "float",
"default": 1.0,
"min": 0.0,
"max": 1.0,
"step": 0.01
},
{
"id": "showLuma",
"label": "Show Luma",
"type": "bool",
"default": false
},
{
"id": "lift",
"label": "Lift",
"type": "float",
"default": 0.0,
"min": -0.25,
"max": 0.25,
"step": 0.001
},
{
"id": "gain",
"label": "Gain",
"type": "float",
"default": 1.0,
"min": 0.25,
"max": 2.0,
"step": 0.01
}
]
}

View File

@@ -0,0 +1,26 @@
float3 falseColorRamp(float luma)
{
if (luma < 0.05)
return float3(0.0, 0.0, 0.0);
if (luma < 0.15)
return lerp(float3(0.04, 0.02, 0.24), float3(0.05, 0.18, 0.95), smoothstep(0.05, 0.15, luma));
if (luma < 0.35)
return lerp(float3(0.05, 0.18, 0.95), float3(0.0, 0.85, 1.0), smoothstep(0.15, 0.35, luma));
if (luma < 0.55)
return lerp(float3(0.0, 0.85, 1.0), float3(0.18, 0.95, 0.18), smoothstep(0.35, 0.55, luma));
if (luma < 0.75)
return lerp(float3(0.18, 0.95, 0.18), float3(1.0, 0.92, 0.08), smoothstep(0.55, 0.75, luma));
if (luma < 0.9)
return lerp(float3(1.0, 0.92, 0.08), float3(1.0, 0.35, 0.02), smoothstep(0.75, 0.9, luma));
return lerp(float3(1.0, 0.35, 0.02), float3(1.0, 0.0, 0.0), smoothstep(0.9, 1.0, luma));
}
float4 shadeVideo(ShaderContext context)
{
float3 source = context.sourceColor.rgb;
float luma = saturate((dot(source, float3(0.2126, 0.7152, 0.0722)) + lift) * max(gain, 0.001));
float3 mapped = falseColorRamp(luma);
if (showLuma)
mapped = lerp(mapped, float3(luma, luma, luma), 0.45);
return float4(lerp(source, mapped, saturate(blendAmount)), context.sourceColor.a);
}