Okay @carsten_neumann after using the following vertex shader,
#version 330 core
layout (location = 0) in vec3 aPos;
uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;
out vec4 pos;
void main()
{
pos = view * model * vec4(aPos, 1.0);
gl_Position = projection * view * model * vec4(aPos, 1.0);
}
and fragment shader,
#version 330 core
in vec4 pos;
out float frag_depth;
void main(){
frag_depth = length(pos.xyz);
}
I get this result,
The result is much more smooth as predicted (I also checked by finding the gradient). It is obviously displaying everything, even surfaces that would be occluded. Is there a way to avoid this? Utlimately I just want to render whatever is in view.
