From e22af9e7d0633c8237ed802404c6ccab472eb458 Mon Sep 17 00:00:00 2001 From: ladevieq Date: Tue, 29 Dec 2020 19:18:09 +0100 Subject: Gradient clear color --- shaders/compute.comp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'shaders') diff --git a/shaders/compute.comp b/shaders/compute.comp index 10123dc..8126536 100644 --- a/shaders/compute.comp +++ b/shaders/compute.comp @@ -1,6 +1,9 @@ layout(set = 0, binding = 0) buffer Inputs { vec3 sky_color; vec3 ground_color; + float viewport_width; + float viewport_height; + vec2 padding; vec3 [1920 * 1080] image; }; @@ -10,5 +13,8 @@ void main() { uint width = gl_NumWorkGroups.x; uint height = gl_NumWorkGroups.y; - image[y * width + x] = vec3(float (x) / width, float (y) / height, 0.0); + vec2 uv = vec2(float(x) / width, 1.0 - float(y) / height); + vec2 ndc = vec2(uv * 2.0 - 1.0); + + image[y * width + x] = mix(ground_color, sky_color, uv.y); } -- cgit v1.3