This is a general question about getting better than 8 bit precision in framebuffer outputs.
For example:
manager = FilterManager(base.win, base.cam)
self.colourTex = Texture()
self.depthTex = Texture()
self.normalTex = Texture()
quad = manager.renderSceneInto(colortex = self.colourTex,
depthtex = self.depthTex,
auxtex = self.normalTex)
When you run this code the default outcome is that self.normalTex is rgba8 or 8 bits of precision per channel. I would like the auxiliary buffers (e.g. normals) to be higher precision (16 bit, 32 bits – anything). I have discovered that you can get nasty visual artifacts from normals that are only 8 bit precision. Is there a way I can render to a framebuffer texture and get better than 8 bit precision in the auxiliary data? Any help would be appreciated.
The question is related to this one about precision in textures: Texture Precision for which the answer was “not yet” in 2012. I have a specific use case which is textures being used as framebuffers. Similar to that prior question, I tried changing the format using
self.normalTex.setup2dTexture
with changes like setting the components to Texture.TFloat and/or making it format 35 (Frgba32) However, after normalTex gets filled by the renderSceneInto and I look at the format it is just rgba8 again.
I saw elsewhere that some people are trying packing the data into multiple 8 bit floats in the shader that first creates the normals (which starts with full float precision). However such packed data can’t be properly interpolated by texture(). I guess you could transfer it to a texture with 16 bit or higher components by hand (using a compute shader or something) and hopefully they would then be correctly interpolated by texture(). However, this seems like a clunky workaround to something that hopefully has a more direct solution now.
This question is related to the same use case for this one: Controlling blend modes -- in general and for auxiliary buffers Specifically, at low precision I can easily fit several variables into auxiliary output buffers but I may need closer control over how aux is represented and blended to make use of higher precision output.