Babylon.js - Video with Depth Maps
For years cameras have just recorded a flat 2D image. Going back a century though photographers have experimented with stereo images. Initially they would use two lens slightly offset to record onto film. Some experimented with prisms and other methods, but the basic idea to record an image from two slightly separate view pervaled. A different method of creating depth images has emerged lately, a camera that actually can measure depth by various means (Laser, structured light etc.). The resulting image has an RGB component and depth component per pixel. The question, how to display that in Babylon?
Let's look at the code to make a video texture:
var ANote0VideoMat = new BABYLON.StandardMaterial("m", scene);
var ANote0VideoVidTex = new BABYLON.VideoTexture("vidtex", "bella_poser.mov", scene);
ANote0VideoMat.diffuseTexture = ANote0VideoVidTex;
ANote0VideoMat.roughness = 1;
Can we combine that with the new bumpTexture?
var light = new BABYLON.SpotLight("spotLight", new BABYLON.Vector3(0, 30, -10), new BABYLON.Vector3(0, -1, 0), Math.PI / 3, 2, scene);
Yes we can! Finally can we combine bumpTexture and VideoTexture?
ANote0VideoMat.bumpTexture = new BABYLON.VideoTexture("vidtex2", "normal.mov", scene);
Yes!!!
But that doesn't give a lot of real depth, I'm guessing it is faking it. What about displacement? https://www.babylonjs-playground.com/#WUYDVT#2