PC On water rendering

Hey @Faatal! As a programmer myself I like to say I really like all the hard work you have put on this game over the years. This stuff is really hard, more so in a voxel game, so I thank you for that!

I watched the A19 Dev Stream 6 last night and I noticed you said that you can see underwater from above because the fog is a global thing. I thought however, why don't you make it shader-based like they did in Crysis (2007) instead of relying on Unity's fog?

Basically, as water is alpha-blended it should be drawn in the translucent pass like any other alpha geometry, so I assume it should be a way to sample the depth buffer at that point (already drawn by the opaque pass). That's how they do soft particles I think.
So, with this and the pixel view or world-space position, you can calculate the volume of water under the surface and apply a linear fog or something better. In Crysis and other games they apply a wavelength-dependent extinction factor to the color of the framebuffer. They even calculate volumetric absorption and fake caustics in more recent games. While sampling the depthbuffer you can even apply a slight distortion like refraction.

Another detail I always think when I'm underwater in 7D2D is that the surface should be double-sided (also rendered when underwater) and should reflect downwards like in real life. Now it simply dissapears which is weird. For the reflection look at Subnautica for an example of a very good water reflection.

It shouldn't be too difficult addition to the water shader I think.
I can provide some articles that describe what I'm talking about if you're interested.

What do you think?

 
Back
Top