adjustments to control and stack saving
All checks were successful
CI / React UI Build (push) Successful in 11s
CI / Native Windows Build And Tests (push) Successful in 2m28s
CI / Windows Release Package (push) Successful in 2m44s

This commit is contained in:
Aiden
2026-05-10 22:10:54 +10:00
parent 46129a6044
commit c8a4bd4c7b
10 changed files with 539 additions and 221 deletions

View File

@@ -0,0 +1,49 @@
{
"id": "white-balance-correction",
"name": "White Balance Correction",
"description": "Operator-friendly tint, color balance, and exposure correction intended to pair with the white match probe.",
"category": "Color",
"entryPoint": "shadeVideo",
"parameters": [
{
"id": "warmCool",
"label": "Warm / Cool",
"type": "float",
"default": 0.0,
"min": -1.0,
"max": 1.0,
"step": 0.001,
"description": "Moves the image cooler at negative values and warmer at positive values."
},
{
"id": "greenMagenta",
"label": "Green / Magenta",
"type": "float",
"default": 0.0,
"min": -1.0,
"max": 1.0,
"step": 0.001,
"description": "Moves the image toward magenta at negative values and toward green at positive values."
},
{
"id": "exposure",
"label": "Exposure",
"type": "float",
"default": 0.0,
"min": -4.0,
"max": 4.0,
"step": 0.01,
"description": "Exposure offset in stop units, using a Blender-style 2^exposure brightness scale."
},
{
"id": "strength",
"label": "Strength",
"type": "float",
"default": 1.0,
"min": 0.0,
"max": 1.0,
"step": 0.01,
"description": "Blends the correction with the original image."
}
]
}

View File

@@ -0,0 +1,35 @@
float3 applyWhiteBalanceOnly(float3 color)
{
float warmAmount = clamp(warmCool, -1.0, 1.0);
float tintAmount = clamp(greenMagenta, -1.0, 1.0);
// Warm/cool pivots red against blue while keeping green more stable.
float3 warmCoolGain = float3(
exp2(warmAmount * 0.35),
exp2(-abs(warmAmount) * 0.08),
exp2(-warmAmount * 0.35));
// Green/magenta pivots green against the average of red and blue.
float3 tintGain = float3(
exp2(-tintAmount * 0.22),
exp2(tintAmount * 0.35),
exp2(-tintAmount * 0.22));
return color * warmCoolGain * tintGain;
}
float3 applyExposureLikeBlender(float3 color)
{
// Match the compositor-style exposure model: every +1.0 stop doubles the
// image and every -1.0 stop halves it.
return color * exp2(exposure);
}
float4 shadeVideo(ShaderContext context)
{
float4 source = context.sourceColor;
float3 balanced = applyWhiteBalanceOnly(source.rgb);
float3 corrected = applyExposureLikeBlender(balanced);
source.rgb = lerp(source.rgb, corrected, saturate(strength));
return source;
}