gkjohnson/webgl-shader-editor

Higher Variable Inspection Precision

gkjohnson opened this issue · 2 comments

Variables are inspected by reading back the framebuffer and converting the pixel value to a float, etc. However, colors are clamped from 0.0 to 1.0 and stored as a byte per channel, meaning a lot of data is lost between the shader and reading that data back.

Possible Solutions

  • A higher precision format, such as a 32-bit per channel texture type would afford higher precision output
  • Packing only 1 float into a single vec4 color channel output would afford more precision, but would require a lot more rendering and be harder to manage.

This seems solvable in WebGL2 with new data formats like RGBA32F:
https://webgl2fundamentals.org/webgl/lessons/webgl2-whats-new.html

ThreeJS WebGL2Renderer Issue: mrdoob/three.js#9965