UNPKG

pex-renderer

Version:

Physically Based Renderer for Pex

11 lines (10 loc) 344 B
module.exports = /* glsl */ ` //from http://spidergl.org/example.php?id=6 vec4 packDepth(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 = fract(depth * bit_shift); res -= res.xxyz * bit_mask; return res; } `