Open NormandErwan opened 6 years ago
I never got a chance to actually implement this correctly into the repo and make a pull request but I did make a shader for this which seemed to increase performance by a lot. This is only the omnidir one but using this one as a guide the pinhole one should be pretty straightforward. Just leaving this here in case it helps someone. https://github.com/MatthewHallberg/WalmartJarvis/blob/main/Assets/Shaders/UnDistort.shader
Sorry forgot something, I was getting the inverse of the rectified cam matrices before passing it into the shader: https://github.com/MatthewHallberg/WalmartJarvis/blob/main/Assets/Scripts/Undistort.cs and the shader also uses this remap function: https://github.com/MatthewHallberg/WalmartJarvis/blob/main/Assets/Shaders/Interpolation.cginc Also, thank you for this amazing repo!
Instead of using the slow
remap
function on CPU, it would be better to undistort the camera image with a shader on GPU as Steptoe did with its AR-Rift : http://willsteptoe.com/post/67401705548/ar-rift-aligning-tracking-and-video-spaces-part for pinhole camerasTo shaders are needed : one for pinhole undistortion, and one for omnidir undistortion.