summaryrefslogtreecommitdiff
path: root/shaders/clouds.kage
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2024-04-22 17:32:17 +0100
committerdavidovski <david@davidovski.xyz>2024-04-22 17:32:17 +0100
commitb0a8bb642f919eaa0c36b9d861c47e0cc4a99440 (patch)
treed9e184cec7db11ad8dc7c93b9e68291bc5beceae /shaders/clouds.kage
parenteeca23dc59e60def65dfefc28b69d6cfc85467ff (diff)
use grass
Diffstat (limited to 'shaders/clouds.kage')
-rw-r--r--shaders/clouds.kage11
1 files changed, 7 insertions, 4 deletions
diff --git a/shaders/clouds.kage b/shaders/clouds.kage
index 26597e5..62a0ae0 100644
--- a/shaders/clouds.kage
+++ b/shaders/clouds.kage
@@ -13,6 +13,7 @@ const cloudlight = 0.3
const cloudcover = 0.2
const cloudalpha = 8.0
const skytint = 0.5
+const colorDepth = 64
func rand(co vec2) float {
return fract(sin(dot(co.xy, vec2(12.9898,-78.233))) * 43758.5453)
@@ -59,10 +60,11 @@ func fbm(n vec2) float {
func Fragment(dstPos vec4, srcPos vec2, color vec4) vec4 {
m := mat2(1.6, 1.2, -1.2, 1.6)
- skycolour1 := vec3(0.45, 0.57, 0.66)
- skycolour2 := vec3(0.55, 0.77, 0.86)
+ skycolour := vec3(0.68, 0.81, 0.86)
+ //skycolour2 := vec3(0.55, 0.77, 0.86)
+
+ p := floor(srcPos.xy) / imageSrc0Size().xy;
- p := srcPos.xy / imageSrc0Size().xy;
uv := p*vec2(imageSrc0Size().x/imageSrc0Size().y,1.0);
time := Time * speed
q := fbm(uv * cloudscale * 0.5)
@@ -120,12 +122,13 @@ func Fragment(dstPos vec4, srcPos vec2, color vec4) vec4 {
c += c1
- skycolour := mix(skycolour2, skycolour1, p.y);
+ //skycolour := mix(skycolour2, skycolour1, 0);
cloudcolour := vec3(1.1, 1.1, 0.9) * clamp((clouddark + cloudlight*c), 0.0, 1.0);
f = cloudcover + cloudalpha*f*r;
result := mix(skycolour, clamp(skytint * skycolour + cloudcolour, 0.0, 1.0), clamp(f + c, 0.0, 1.0));
+ result = floor(result*colorDepth)/colorDepth
return vec4( result, 1.0 );
}