refactor: Enhance TV bezel shading and texture effects for improved visual fidelity
Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
@@ -29,17 +29,21 @@ void main() {
|
|||||||
centered *= 1.0 + radius2 * 0.045;
|
centered *= 1.0 + radius2 * 0.045;
|
||||||
uv = centered * 0.5 + 0.5;
|
uv = centered * 0.5 + 0.5;
|
||||||
|
|
||||||
// Fill outside warped bounds with a subtle gray plastic TV bezel.
|
// Fill outside warped bounds with a darker consumer-TV charcoal bezel.
|
||||||
if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) {
|
if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) {
|
||||||
vec2 clampedUv = clamp(uv, 0.0, 1.0);
|
vec2 clampedUv = clamp(uv, 0.0, 1.0);
|
||||||
vec2 edgeDelta = abs(uv - clampedUv);
|
vec2 edgeDelta = abs(uv - clampedUv);
|
||||||
float overflow = max(edgeDelta.x, edgeDelta.y);
|
float overflow = max(edgeDelta.x, edgeDelta.y);
|
||||||
|
|
||||||
float verticalShade = 0.96 + 0.06 * (1.0 - (FlutterFragCoord().y / uResolution.y));
|
float verticalShade = 0.90 + 0.08 * (1.0 - (FlutterFragCoord().y / uResolution.y));
|
||||||
float depthShade = 1.0 - smoothstep(0.0, 0.06, overflow) * 0.18;
|
float depthShade = 1.0 - smoothstep(0.0, 0.06, overflow) * 0.24;
|
||||||
float grain = sin(FlutterFragCoord().x * 0.21 + FlutterFragCoord().y * 0.11) * 0.01;
|
float grain = sin(FlutterFragCoord().x * 0.21 + FlutterFragCoord().y * 0.11) * 0.007;
|
||||||
|
float moldedHighlight = smoothstep(0.08, 0.0, overflow) * 0.045;
|
||||||
|
|
||||||
vec3 bezelColor = vec3(0.46, 0.46, 0.44) * verticalShade * depthShade + vec3(grain);
|
vec3 bezelColor =
|
||||||
|
vec3(0.26, 0.26, 0.25) * verticalShade * depthShade +
|
||||||
|
vec3(moldedHighlight) +
|
||||||
|
vec3(grain);
|
||||||
fragColor = vec4(bezelColor, 1.0);
|
fragColor = vec4(bezelColor, 1.0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user