Folks!

I have calculated the normal and depth values from shader, however this result always is limited in 8-bit floating precision. I’m looking for 32-bit floating precision. Do you have any tips how can I increase this floating precision?

I took a look on web and there is an extension to increase the precision on shaders (version 150 and GL_ARB_gpu_shader_fp64). Is it a good approach?

Vertex:

```
#version 130
out vec3 positionEyeSpace;
out vec3 normalEyeSpace;
void main() {
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
// eye space
positionEyeSpace = vec3(gl_ModelViewMatrix * gl_Vertex);
normalEyeSpace = gl_NormalMatrix * gl_Normal;
}
```

Fragment:

```
#version 130
in vec3 positionEyeSpace;
in vec3 normalEyeSpace;
uniform float farPlane;
out vec4 output;
void main() {
vec3 nNormalEyeSpace = normalize(normalEyeSpace);
// Depth calculation
vec3 nPositionEyeSpace = normalize(-positionEyeSpace);
float linearDepth = sqrt(positionEyeSpace.x * positionEyeSpace.x +
positionEyeSpace.y * positionEyeSpace.y +
positionEyeSpace.z * positionEyeSpace.z);
linearDepth = linearDepth / farPlane;
gl_FragDepth = linearDepth;
// output the normal and depth data as matrix
output = vec4(0, 0, 0, 1);
if (linearDepth <= 1) {
output.z = abs(dot(nPositionEyeSpace, nNormalEyeSpace)); // normal
output.y = linearDepth; // depth
}
}
```