Normal Map From SCNRenderer

Hi everyone !


I would to build a multy pass rendering engine based on scenekit and OpenGL. I saw that with a SCNRenderer I can render the color and depth map of my scene in my own framebuffer.


    //load Framebuffers
    glGenFramebuffers(1, &myFBO);
    glBindFramebuffer(GL_FRAMEBUFFER, myFBO);

    geometryBufferDrawBuffer = GL_COLOR_ATTACHMENT0;
    glDrawBuffers(1, &geometryBufferDrawBuffer);

    // Attach textures to framebuffer
    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 , GL_TEXTURE_2D, colorTexture, 0);
    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depthTexture, 0);

    [scenekitRenderer renderAtTime:currentTime];


But I also need to get the normal map. Is there a way to get it ? I tryed to attach a texture to a second color attachement, but I only get the color map. And I can't render the scene with my own shaders.


Thank you for your helps !

Normal Map From SCNRenderer
 
 
Q