OpenGL: How can I render a triangle mesh at 10bit (or 12bit or 16bit) channel depth color?

Viewed 515

For a vision research experiment, I have a monitor that supports 10bit/channel (=30bit color). I want to render a triangle mesh in a simple scene that uses the full bit depth, and I want to save this rendering as a .png file. The rendering is just for single, static images, and doesn't need to happen lightning fast.

For the triangle mesh, I have:

  • List of vertices in xyz coordinates
  • List of triangles containing the indices of the vertices
  • List of the vertex normals
  • List of the triangle/face normals

My hardware includes (possibly irrelevant)

  • Dell UP3218K monitor - 8k and 10bits/channel
  • GeForce RTX 2080 Super (but can get a better one if needed)

I tried using the pyrender library, but it outputs the rendered scene as uint8 (limiting it to 8bit).

I can't find any code examples of OpenGL or PyOpenGL rendering meshes at 10bits or higher. With the increasing popularity of >8bit monitors, surely this is possible?

What can I use to render a mesh at 10 bit/channel depth?

Edit with more specific question:

I have a triangle mesh (points, vertices, normals). How can I render it (display unnecessary at this step) in a scene and save this rendering as a 10-bit depth .png file? Later, I would like to display this .png on a 10-bit monitor.

1 Answers

When you create a framebuffer object (FBO) you get to decide what kind of buffer you're rendering to. Most applications would use an GL_RGBA8 texture as the colour buffer, but you don't have to...

Here are a list of all the formats which your graphics driver is required to support. It may also support other ones which aren't on this list, but on this list are some formats that may be interesting to you:

  • GL_RGB10_A2 - 10 bits each for R/G/B, 2 bits for A - 32 bits per pixel
  • GL_RGBA16 - 16 bits each for R/G/B/A - 64 bits per pixel
  • GL_RGBA16F - 16 bits each for R/G/B/A - 64 bits per pixel - but they're floating-point numbers with with 1-bit sign, 5-bit exponent and 10-bit mantissa.
Related