So, I have experimented with different solutions.
I'm having problems getting a functional transition between entering into water. You can see the terrain for a small amount of time.
To combat this, I am using pixel perfect testing in the renderer (since it interpolates the camera position, and implements some bobbing).
I have also made the water rendering phase cull FRONT the same frame and after you enter into water, vs BACK when outside water.
This will work, since my in-water effect is post-processed. At least, that's what I hoped. It doesn't work completely. There is ~1 frame where you can still see half the terrain, kind of like tearing.
Edit: It turns out it's simply the znear plane causing me problems.
How do you solve that?
Edit2: I wish I could flip-flop the "plane," if it even was a plane. If it was an actual plane, I could render the water sligthly higher up after entering into it.
I just checked if (player.x, player.y - camera.getZNear(), player.z) was inside water, and if he was, move the player instantly down ZNear.
It works, but only if entering water up/down, which is the majority of cases anyways.
Edited by Kaptein, 15 June 2014 - 12:11 PM.