From b0a8bb642f919eaa0c36b9d861c47e0cc4a99440 Mon Sep 17 00:00:00 2001 From: davidovski Date: Mon, 22 Apr 2024 17:32:17 +0100 Subject: use grass --- shaders/vcr_lite.kage | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 shaders/vcr_lite.kage (limited to 'shaders/vcr_lite.kage') diff --git a/shaders/vcr_lite.kage b/shaders/vcr_lite.kage new file mode 100644 index 0000000..405195c --- /dev/null +++ b/shaders/vcr_lite.kage @@ -0,0 +1,33 @@ +//go:build ignore + +//kage:unit pixels + +package main + +var Time float +var NoiseOffset float + +const noiseX = 840.0 +const noiseY = 840.0 +const speed = 0.01 + +const colorOffsetIntensity = 0.1 + +func rand(co vec2) float { + return fract(sin(dot(co.xy, vec2(12.9898,78.233))) * 43758.5453) +} + + +func Fragment(dstPos vec4, srcPos vec2, color vec4) vec4 { + time := Time * speed + uv := srcPos / imageSrc0Size() + + uv.x = uv.x + (rand(vec2(time,srcPos.y)) - 0.5) / (noiseX); + uv.y = uv.y + (rand(vec2(time))-0.5) / (noiseY) + offsetR := vec2(0.006 * sin(time), 0.0) * colorOffsetIntensity + offsetG := vec2(0.0073 * (cos(time * 0.97)), 0.0) * colorOffsetIntensity + r := imageSrc0UnsafeAt((uv+offsetR) * imageSrc0Size()).r + g := imageSrc0UnsafeAt((uv+offsetG) * imageSrc0Size()).g + b := imageSrc0UnsafeAt(uv * imageSrc0Size()).b + return vec4(r, g, b, 1.0) +} -- cgit v1.2.1