Added new shaders
This commit is contained in:
42
shaders/lift-gamma-gain/shader.json
Normal file
42
shaders/lift-gamma-gain/shader.json
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"id": "lift-gamma-gain",
|
||||
"name": "Lift Gamma Gain",
|
||||
"description": "Basic color grading controls for shadows, midtones, highlights, and overall RGB offset.",
|
||||
"category": "Color",
|
||||
"entryPoint": "shadeVideo",
|
||||
"parameters": [
|
||||
{
|
||||
"id": "lift",
|
||||
"label": "Lift",
|
||||
"type": "color",
|
||||
"default": [0.5, 0.5, 0.5, 1.0]
|
||||
},
|
||||
{
|
||||
"id": "gamma",
|
||||
"label": "Gamma",
|
||||
"type": "color",
|
||||
"default": [0.5, 0.5, 0.5, 1.0]
|
||||
},
|
||||
{
|
||||
"id": "gain",
|
||||
"label": "Gain",
|
||||
"type": "color",
|
||||
"default": [0.5, 0.5, 0.5, 1.0]
|
||||
},
|
||||
{
|
||||
"id": "offset",
|
||||
"label": "Offset",
|
||||
"type": "color",
|
||||
"default": [0.5, 0.5, 0.5, 1.0]
|
||||
},
|
||||
{
|
||||
"id": "strength",
|
||||
"label": "Strength",
|
||||
"type": "float",
|
||||
"default": 1.0,
|
||||
"min": 0.0,
|
||||
"max": 1.0,
|
||||
"step": 0.01
|
||||
}
|
||||
]
|
||||
}
|
||||
20
shaders/lift-gamma-gain/shader.slang
Normal file
20
shaders/lift-gamma-gain/shader.slang
Normal file
@@ -0,0 +1,20 @@
|
||||
float3 applyLiftGammaGainOffset(float3 color)
|
||||
{
|
||||
float3 liftAdjust = (lift.rgb - 0.5) * 0.5;
|
||||
float3 offsetAdjust = (offset.rgb - 0.5) * 0.5;
|
||||
float3 gammaAdjust = exp2((gamma.rgb - 0.5) * 2.0);
|
||||
float3 gainAdjust = exp2((gain.rgb - 0.5) * 2.0);
|
||||
|
||||
float3 lifted = color + liftAdjust;
|
||||
float3 gained = lifted * gainAdjust;
|
||||
float3 corrected = pow(saturate(gained), 1.0 / max(gammaAdjust, float3(0.001)));
|
||||
return corrected + offsetAdjust;
|
||||
}
|
||||
|
||||
float4 shadeVideo(ShaderContext context)
|
||||
{
|
||||
float4 source = context.sourceColor;
|
||||
float3 graded = applyLiftGammaGainOffset(source.rgb);
|
||||
source.rgb = lerp(source.rgb, graded, strength);
|
||||
return saturate(source);
|
||||
}
|
||||
Reference in New Issue
Block a user