I don't know how to render meshes sorry. If you can generate a dense point cloud for each frame (one point per pixel approximately) there should be no problem achieving this I think.
Actually my points are also initially obtained from depth info in an image so the same rendering code should work. If you want to do the same as the video you linked, you have to simulate a virtual camera moving around in your model and compute points reprojections.
/// Collect 3d points of keyframe.
pub fn points_3d(&self) -> Vec<Point3> {
let intrinsics = &self.config.intrinsics;
let extrinsics = &self.state.keyframe_pose;
let camera = Camera::new(intrinsics.clone(), extrinsics.clone());
let (coordinates, _z) = &self.state.keyframe_multires_data.usable_candidates_multires[0];
coordinates
.iter()
.zip(_z.iter())
.map(|(&(x, y), &_z)| camera.back_project(Point2::new(x as f32, y as f32), 1.0 / _z))
.collect()
}
In my case, as you can see in the example above, I am back projecting to 3D world coordinates from a triplet (x, y, _z)
where (x,y)
are pixel coordinates in my image, and _z
is the inverse depth of the point. I'm using this camera module (https://github.com/mpizenberg/visual-odometry-rs/blob/wasm/src/core/camera.rs) from a project I'm working on in case it's useful (only dependency is nalgebra for this module)
In your case, you only need the extrinsic parameters (translation + rotation matrix) of your camera. Once you get the matrix, you just need to multiply its inverse by every 3D point in the field view of your camera like this (https://github.com/mpizenberg/visual-odometry-rs/blob/wasm/src/core/camera.rs#L70) to get its 3D coordinates relative to the camera.
If you are actually starting from (x,y,depth) frame triplets points, you also need the camera intrinsics (contains focal distances on each axis, and coordinates of focal points which is usually at the center of the image).
For the rendering then, very similar code should work. No need of additional shader in my opinion.