shadows done
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
// vert //
|
||||
|
||||
flat out uint object_flags;
|
||||
out float distance;
|
||||
out vec4 pos;
|
||||
|
||||
void main(void) {
|
||||
object_flags = qgl_ObjectFlags;
|
||||
@@ -8,13 +10,16 @@ void main(void) {
|
||||
return;
|
||||
qgl_MaterialIndex = qgl_Material;
|
||||
qgl_FragTexture = qgl_getFragTexture();
|
||||
gl_Position = qgl_ftransform();
|
||||
pos = qgl_ftransform();
|
||||
gl_Position = pos;
|
||||
}
|
||||
|
||||
|
||||
// frag //
|
||||
|
||||
flat in uint object_flags;
|
||||
in float distance;
|
||||
in vec4 pos;
|
||||
|
||||
float z_near = 0.1f;
|
||||
const float _pe = 2.4e-7;
|
||||
@@ -27,6 +32,13 @@ void main(void) {
|
||||
discard;
|
||||
|
||||
float z = gl_FragCoord.z;
|
||||
z = z + z - 1;
|
||||
z = ((_pe - 2.) * z_near) / (z + z + _pe - 2.); // infinite depth
|
||||
qgl_FragData[0].r = z;
|
||||
|
||||
#ifdef OMNI
|
||||
gl_FragDepth = 1 - 1 / (length(pos.xyz) - z_near + 1);
|
||||
#else
|
||||
gl_FragDepth = 1 - 1 / (pos.z - z_near + 1);
|
||||
#endif
|
||||
//qgl_FragData[0].r = length(vec3(pos.xy, z));//1/gl_FragCoord.w;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user