Fix postprocessing being weird
This commit is contained in:
@@ -108,6 +108,9 @@ public class PostProcessing {
|
|||||||
|
|
||||||
this.setSize(width, height);
|
this.setSize(width, height);
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, this.framebuffer.id);
|
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);
|
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);
|
glBlitNamedFramebuffer(sourceFB, this.framebuffer.id, 0,0, width, height, 0,0, width, height, GL_DEPTH_BUFFER_BIT, GL_NEAREST);
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,10 @@ void main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
float depth = texture(depthTex, UV.xy).r;
|
float depth = texture(depthTex, UV.xy).r;
|
||||||
|
if (depth == 0.0f) {
|
||||||
|
discard;
|
||||||
|
}
|
||||||
|
|
||||||
depth = projDepth(rev3d(vec3(UV.xy, depth)));
|
depth = projDepth(rev3d(vec3(UV.xy, depth)));
|
||||||
depth = min(1.0f-(2.0f/((1<<24)-1)), depth);
|
depth = min(1.0f-(2.0f/((1<<24)-1)), depth);
|
||||||
depth = depth * 0.5f + 0.5f;
|
depth = depth * 0.5f + 0.5f;
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ void main() {
|
|||||||
point += scale*0.5f;//Offset to the center of the textile
|
point += scale*0.5f;//Offset to the center of the textile
|
||||||
float depth = texture(depthTex, point).r;
|
float depth = texture(depthTex, point).r;
|
||||||
vec4 ocolour = vec4(0);
|
vec4 ocolour = vec4(0);
|
||||||
if (depth < 1.0f) {
|
if (depth!=0.0f && depth < 1.0f) {
|
||||||
vec4 colour = texture(colourTex, point);
|
vec4 colour = texture(colourTex, point);
|
||||||
if (colour == vec4(0.0f, 0.0f, 0.0f, 0.0f)) {
|
if (colour == vec4(0.0f, 0.0f, 0.0f, 0.0f)) {
|
||||||
ocolour = vec4(1.0f, 0.0f, 0.0f, 1.0f);
|
ocolour = vec4(1.0f, 0.0f, 0.0f, 1.0f);
|
||||||
|
|||||||
Reference in New Issue
Block a user