diff --git a/res/shaders/post.frag b/res/shaders/post.frag index 23d6c84..5fe0a7e 100644 --- a/res/shaders/post.frag +++ b/res/shaders/post.frag @@ -11,9 +11,11 @@ uniform uint windowHeight; uniform float time; void main() { - float dx = 1.0/windowWidth; - float dy = 1.0/windowHeight; - + vec2 dx = vec2(1,0) * 1.0/windowWidth; + vec2 dy = vec2(0,1) * 1.0/windowHeight; vec2 UV = gl_FragCoord.xy / vec2(windowWidth, windowHeight); - color_out = texture(framebuffer, UV); + + float z = pow(texture(depthbuffer, UV).r , 0x800); + z = abs(z*2-1)*1.2; + color_out = vec4(vec3(texture(depthbuffer, UV).r), 1.0); } diff --git a/res/shaders/post.vert b/res/shaders/post.vert index faf87eb..5815601 100644 --- a/res/shaders/post.vert +++ b/res/shaders/post.vert @@ -1,9 +1,7 @@ #version 430 core in layout(location = 0) vec3 vertex; -out layout(location = 0) vec2 UV; void main() { gl_Position = vec4(vertex, 1.0); - UV = vertex.xy*0.5 + 0.5; } diff --git a/src/renderlogic.cpp b/src/renderlogic.cpp index fc30d68..b9985c0 100644 --- a/src/renderlogic.cpp +++ b/src/renderlogic.cpp @@ -341,9 +341,9 @@ void renderFrame(GLFWwindow* window, int windowWidth, int windowHeight) { glDepthMask(GL_FALSE); // read only for (NodeDistShader a : transparent_nodes) renderNode(a.node, a.s, nullptr, false); + renderNode(hudNode, nullptr); // rootNode defined in scene.hpp glDepthMask(GL_TRUE); // read write - renderNode(hudNode, nullptr); // rootNode defined in scene.hpp // render framebuffer to window glBindFramebuffer(GL_FRAMEBUFFER, 0);