wave-harmonic / crest

A class-leading water system implemented in Unity
MIT License
3.5k stars 478 forks source link

How to get depth map from camera? #1061

Closed critopadolf closed 2 years ago

critopadolf commented 2 years ago

I would like to get the distance from the camera to the surface of the ocean for each pixel. The "Animated Waves" Debugging option gives the height of the waves, but how could I get the position of the surface points?

critopadolf commented 2 years ago

I defined a new view type ` #elif _DEBUGVISUALISE_DEPTHWAVES col = 0.001*half3(pixelZ, pixelZ, pixelZ);

endif`

The 0.001 just makes it look pretty. Is there a reason 'half' is used? I'd like a super accurate depth estimation.