I'm currently trying to render to a cubemap in order to blur it. However the top and bottom faces appear much closer than they should be in the blurred version. I thought the problem came from my transformation matrices but they're just rotations. I'm beginning to believe that it's the way I'm handling the framebuffer that's causing this problem. Here's how I'm doing it :

    unsigned fbo;
    unsigned rt;
    glViewport(0, 0, size, size);
    glGenFramebuffers(1, &fbo);
    glGenRenderbuffers(1, &rt);

    glBindFramebuffer(GL_FRAMEBUFFER, fbo);
    glBindRenderbuffer(GL_RENDERBUFFER, rt);
    glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, size, size);

    //enable source cubemap, set projection

    for(int i = 0; i < 6; ++i) {
        //set rotation
        glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, target_cubemap, 0);
        //draw cube

(the images below are from the same corder)

original cubemap

blurred cubemap


Found the mistake ! I was using the projection matrix of my camera, which had the aspect ratio of the screen instead of 1.

  • \$\begingroup\$ Don't forget to come back and mark this answer as the accepted one in a couple of days :) \$\endgroup\$ – Alexandre Vaillancourt Apr 18 '18 at 1:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.