Hi guys.
I need some help regarding to SSAO. I’ve followed this popular tutorial: https://learnopengl.com/Advanced-Lighting/SSAO.
Somehow, the occlusion factor is always 1, so no changes can be observed.
I debugged through the code and:
- The GBuffer textures are correct
- The problem is might be the SSAO texture itself.
So… when I generate the ssao texture onto the screen, it’s totally red and if I change the ssao shader output value to any float, it remains red. That’s why I think, the problem is somewhere over there.
The code is the same as in the tutorial, but here it is the ssao buffer:
FBO = glGenFramebuffers();
blurFBO = glGenFramebuffers();
glBindFramebuffer(GL_FRAMEBUFFER, FBO);
LOGGER.debug("> Creating color texture...");
int ssaoColorTexture = glGenTextures();
glBindTexture(GL_TEXTURE_2D, ssaoColorTexture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RED, Engine.properties.getWindowWidth(), Engine.properties.getWindowHeight(), 0, GL_RGB, GL_FLOAT, (ByteBuffer) null);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, ssaoColorTexture, 0);
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
throw new RuntimeException("SSAO buffer is not completed");
}
In the fragment shader I just use
layout (location = 0) out float OUT_Color;
And assign it:
OUT_Color =1.0f
And the value above does not affect the texture in the FBO.
What can be the problem, where should I continue debugging?