Depth to World Position

For the above formula, remember to normalize vectors before taking a dot product.

WorldPosition = CameraPosition + CameraVector * { CustomDepth.r / 
    dot [ normalize(CameraVector), normalize(CameraDirectionVector) ] } 

Since getting the order of operations right took some thought - here’s the same setup in BP using a SceneDepth node:

Much thanks to everyone here over the last 6 years - really helped my understanding.

6 Likes