Panorama with depth enhancement

Slightly off topic query: I was looking at the example on the three site: three.js vr - panorama with depth
which I’ve got working with a model of my own. But, I noted some limitations, where you get distortions from the mapping.
I came across an example where the depth map was 24 bit rather than 8, the information being encoded into the RGB channels. (You can see their’s here: https://krpano.com/releases/1.20.11/viewer/examples/depthmap/depthmap-24bit-encoding/depthmap_24bits_rgb.png)
What I’ve not been able to find is how you might create the enhanced quality depth map? I’ve had a pretty good search but not found anything, does anyone have any pointers/hints?