Bitpacking into buffers with webgl (shadertoy)
Assuming you are not going to filter the buffer using HW texture filtering: since you only need 4 values for the material index, pack it in the sign bits of uv x and y.