Depth pass video sequence to depthkit format conversion

Hello
I am looking for a way to convert a videos to depthkit data to play on Looking glass. I am assuming that I have the full colored video and a render z-depth pass in Grayslcae. Assume that the source is lost so the only way is to work with his data. I also downloaded a sample from depthkit video page analyze the metadata. I work mostly with AE and Maya so this is new to me.

Based on this i was able to determine how i could remap the black and white depth pass to a color pass. It looks like the color spectrum on this sample is from yellow(closest) to violet(furthest) and i’m assuming it goes full way to red etc. I tried to mimic that using a pre-renered zdepth and here are some examples

Here is a link to the video of how that works. https://youtu.be/7PVu9Xrya64 (sorry for the quality as i did not have my main recording equipment at the moment)

I also used this code that got from the depth kit sample and modified it
{
“depthImageSize”: {
“x”: 1440.0,
“y”: 1280.0
},

"farClip": 0.95555,
"nearClip": 0.35555,

“format”: “perpixel”,
“textureHeight”: 1440,
“textureWidth”: 1280
}

I was not able to find the documentation for the metadata so this is trial and error.

For the most part it is working ok but there are large artifacts present on the edges when the front plane meets the background.

The same image while using the grey scale zdepth image does not have any artifacts but does not allow for animation. Looks like the gray scale image is using the background pixels to fill in the space and the color coded material is using the object pixels to fill it in. There is also some kind of a choker that Easts a way the edges of the character using the gray scale image. I am assuming that helps to fill in the edges.

I think there could be some color spill when converting the zdepth to color that might be causing this. but i am not sure.

Is it possible to know what is the difference in converting the material from zdepth and form the color depth. ? looks like the depth version is superior as it builds the depth from 0-1 based on the brightness.

Trying to find a way to move forward but it is very close. There are hours of pre-rendered materials that could be converted to play on the looking glass if this works.