googlesamples / arcore-depth-lab

ARCore Depth Lab is a set of Depth API samples that provides assets using depth for advanced geometry-aware features in AR interaction and rendering. (UIST 2020)
https://augmentedperception.github.io/depthlab/
Apache License 2.0
762 stars 152 forks source link

relighting implementation ignores camera intrinsic parameters #48

Closed qhanson closed 1 year ago

qhanson commented 1 year ago

hi, I observe that your implementation ignore the camera intricsic parameters at https://github.com/googlesamples/arcore-depth-lab/blob/53b103ea1f39221f95b89e1c675ed11debc72ca4/Assets/ARRealismDemos/Relighting/Shaders/PointsRelightingCore.cginc#L115-L131

How much is the relighting results related to this calculation. As the pinhole camera is one approximation of world imaging and the vertical and horizitional focal length most equal,

Given:
P = vec3( uv, depth)  
P = K*W  // K is one 3*4 matrix
so, 
W = K^-1*P // W is [x,y,z,1]

calculating W to perform raymarching may be not neccseary at all.

ruofeidu commented 1 year ago

Thank you Hanson! And sorry for the late reply!! This is very insightful observation! I was using a fixed phone, Pixel 3 during the toolkit writing and completely ignores other phone models. Will fix it in future variation of Depth Lab and thank you for your thoughtful comments (feel free to create a pull request to fix it!)