Hello everyone,
I'm currently working on a water surface simulation and got some problems concerning the reflection.
I have a reflection camera which is mirrored in the water plane. If the water surface is a perfect flat plane you can specify a clipping plane and draw the rendered reflection texture directly on the water surface. Now I got the problem that my surface isn't flat. The deviation of the z coordinate of the surface from the perfect plane is calculated due to some uv-coordinates which are calculated on the cpu. How am I supposed to clip the reflection texture on that calculated surface?
The only idea I got is that I take the depth texture from the reflection camera, calculate the world position with the help of the depth texture, transform the world position in the model space of the water surface, calculate expensive the uv coordinates matching this world position, calculate the z deviation of the water surface at this point and compare the calculated z of the depth texture with the calculated z of the water surface.
This seems crazy to me besides I got some problems implementing this.
I am sure there must be a faster/easier solution. Can anyone help me?