Sha256: 70d0b47213de074acfbc6354f5100cfd8e4bbf64ee0598b9616ba5717d3b3c1d
Contents?: true
Size: 833 Bytes
Versions: 19
Compression:
Stored size: 833 Bytes
Contents
#include common #include logdepthbuf_pars_fragment vec4 pack_depth( const in float depth ) { const vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 ); const vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 ); vec4 res = mod( depth * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 ); // vec4 res = fract( depth * bit_shift ); res -= res.xxyz * bit_mask; return res; } void main() { #include logdepthbuf_fragment #ifdef USE_LOGDEPTHBUF_EXT fragColor = pack_depth( gl_FragDepthEXT ); #else fragColor = pack_depth( gl_FragCoord.z ); #endif // fragColor = pack_depth( gl_FragCoord.z / gl_FragCoord.w ); // float z = ( ( gl_FragCoord.z / gl_FragCoord.w ) - 3.0 ) / ( 4000.0 - 3.0 ); // fragColor = pack_depth( z ); // fragColor = vec4( z, z, z, 1.0 ); }
Version data entries
19 entries across 19 versions & 2 rubygems