Fix postprocessing being weird

This commit is contained in:
mcrcortex
2024-12-05 00:28:06 +10:00
parent 017bf78d4c
commit 3b25d2d535
3 changed files with 8 additions and 1 deletions

View File

@@ -108,6 +108,9 @@ public class PostProcessing {
this.setSize(width, height);
glBindFramebuffer(GL_FRAMEBUFFER, this.framebuffer.id);
//glClearColor(0,0,0,0);//TODO: RESTORE THIS TO THE ORIGINAL VALUE
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
glBlitNamedFramebuffer(sourceFB, this.framebuffer.id, 0,0, width, height, 0,0, width, height, GL_DEPTH_BUFFER_BIT, GL_NEAREST);

View File

@@ -24,6 +24,10 @@ void main() {
}
float depth = texture(depthTex, UV.xy).r;
if (depth == 0.0f) {
discard;
}
depth = projDepth(rev3d(vec3(UV.xy, depth)));
depth = min(1.0f-(2.0f/((1<<24)-1)), depth);
depth = depth * 0.5f + 0.5f;

View File

@@ -53,7 +53,7 @@ void main() {
point += scale*0.5f;//Offset to the center of the textile
float depth = texture(depthTex, point).r;
vec4 ocolour = vec4(0);
if (depth < 1.0f) {
if (depth!=0.0f && depth < 1.0f) {
vec4 colour = texture(colourTex, point);
if (colour == vec4(0.0f, 0.0f, 0.0f, 0.0f)) {
ocolour = vec4(1.0f, 0.0f, 0.0f, 1.0f);