This may be more of a shader question? I don’t know.
Basically, I’m trying to create a smooth transition for the camera to go from above water (no fog / underwater effects) to underwater. Currently I switch the mode based simply on the Y position of the camera, when it goes under the water level the underwater effects turn on. This is prone to showing a frame under the water without the underwater effects when the camera is moving fast. This happens in a lot of games, but I’ve seen it done right in games like Crysis. You can have the camera hover at the point where you can see both above and below the water and half the screen appears above water, and half below.
Any ideas? I’ve tried muddling with shader tricks and ZTest but nothing so far. I would suspect it requires two cameras and some sort of mask based on the water surface plane. Is this possible in Unity?
I’m now using a semi-transparent box. I just position it for the camera and keep it at the water surface level. When the camera is transitioning to underwater it blocks the clear view of the underwater objects. It’s sort of kludgy, but it works for now.
I made one look pretty good once by adjusting the transform of the camera when entering the water surface. The way i did it was when my player transform got the correct distance under the water surface that the camera was about to go under the camera transform would lower on the y just enough to get past that clear view. Worked like a charm.
Its kind of funny, that it took four years with 60 dev’s to create Oblivion and they couldn’t fix the water problem. lol
I think that Oblivion will always be that one epic game that could of used some more polishing.
That’s funny because Oblivion is a prime example of this. It’s easy to hover at the water surface and see where every slaughterfish is.
I like your solution, though it won’t work in my case because the player has complete control over the camera. I would love to know how they did it “right” for games like Crysis though. I have a stylized cartoony look in my game. This solution wouldn’t work for something more realistic.