Fix flipping in post-processing stages and precompute the uv in those in the vert shader

This commit is contained in:
Imbris 2020-12-06 16:42:01 -05:00 committed by Avi Weinstock
parent ec0f4db3d9
commit 8c44fdaac2
4 changed files with 6 additions and 12 deletions

View File

@ -32,7 +32,7 @@ uniform texture2D t_src_depth;
layout(set = 1, binding = 3)
uniform sampler s_src_depth;
layout(location = 0) in vec2 f_pos;
layout(location = 0) in vec2 uv;
layout (std140, set = 1, binding = 4)
uniform u_locals {
@ -58,9 +58,6 @@ vec3 wpos_at(vec2 uv) {
}
void main() {
// TODO: precompute in the vertex shader?
vec2 uv = (f_pos + 1.0) * 0.5;
vec4 color = texture(sampler2D(t_src_color, s_src_color), uv);
// Apply clouds

View File

@ -18,7 +18,7 @@
#include <globals.glsl>
layout(location = 0) out vec2 f_pos;
layout(location = 0) out vec2 uv;
void main() {
// Generate fullscreen triangle
@ -27,7 +27,7 @@ void main() {
float(gl_VertexIndex % 2) * 4.0 - 1.0
);
f_pos = v_pos;
uv = (v_pos * vec2(1.0, -1.0) + 1.0) * 0.5;
gl_Position = vec4(v_pos, 0.0, 1.0);
}

View File

@ -28,7 +28,7 @@ layout(set = 1, binding = 1)
uniform sampler s_src_color;
layout(location = 0) in vec2 f_pos;
layout(location = 0) in vec2 uv;
layout (std140, set = 1, binding = 2)
uniform u_locals {
@ -150,9 +150,6 @@ vec3 _illuminate(float max_light, vec3 view_dir, /*vec3 max_light, */vec3 emitte
}
void main() {
// TODO: precompute in the vertex shader?
vec2 uv = (f_pos + 1.0) * 0.5;
/* if (medium.x == 1u) {
uv = clamp(uv + vec2(sin(uv.y * 16.0 + tick.x), sin(uv.x * 24.0 + tick.x)) * 0.005, 0, 1);
} */

View File

@ -18,7 +18,7 @@
#include <globals.glsl>
layout(location = 0) out vec2 f_pos;
layout(location = 0) out vec2 uv;
void main() {
// Generate fullscreen triangle
@ -27,7 +27,7 @@ void main() {
float(gl_VertexIndex % 2) * 4.0 - 1.0
);
f_pos = v_pos;
uv = (v_pos * vec2(1.0, -1.0) + 1.0) * 0.5;
gl_Position = vec4(v_pos, 0.0, 1.0);
}