I would like to downsample my depth buffer and my normals.
For that, I take in input of my shader, the corresponding textures (depth, normal), and I write my new values in a multi render target.

I downsample the normals by doing a simple average of four texels and for the depth buffer, I can choose the max or min of four texels.

My color attachment's format for the downsampled buffer is R32F.
How could I write my new depth floating point value in it?
I tried: gl_FragData[1].r = newDepth; But it doesn't seem to store correctly a float with 32 bits precision.

To get a pixel's depth, I know that I can do:
float depth = texture2D(depth, tc).x;
But what about to output a single float with 32 bits precision?

  • 3
    $\begingroup$ Why do you think it does not store correctly? Does your GL_DEPTH_COMPONENT is also 32 bit float type? $\endgroup$
    – mdkdy
    Commented Jan 28, 2017 at 10:28


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.