diff options
| author | ladevieq <ladevie.quentin@gmail.com> | 2020-12-29 19:18:09 +0100 |
|---|---|---|
| committer | ladevieq <ladevie.quentin@gmail.com> | 2020-12-29 19:18:09 +0100 |
| commit | e22af9e7d0633c8237ed802404c6ccab472eb458 (patch) | |
| tree | fc09a1c5b790f3c04343df4a2c873a2d41d6e7fb /shaders | |
| parent | 5768c16bd01900d1eb34873a44d231011d0b744b (diff) | |
Gradient clear color
Diffstat (limited to 'shaders')
| -rw-r--r-- | shaders/compute.comp | 8 |
1 files changed, 7 insertions, 1 deletions
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); } |
