Depth Mapping Functions - sinisterchipmunk/jax GitHub Wiki
Import: //= require "shaders/functions/depth_map"
vec4 pack_depth(const in float depth)
Packs a single float value into a 4-component vector. Each component of the vector is in the range 0..1, so the vector is safe to use as RGBA color output. This function is particularly useful for shadow mapping, among other things. Disable alpha blending, or it will interfere with the packed depth value.
float unpack_depth(const in vec4 rgba_depth)
Unpacks a depth that was previously packed with the pack_depth
function.