Hi guys ! Here are the latest news.
I mainly worked on my screen space foam rendering algorithm:
The idea is pretty simple, while I generate my heightmap, normalmap and so on I also generate a velocity map which encodes the speed and direction of my water fragments. Then during rendering I can use a simple raytracing algorithm to decide if the fragment will soon collides some opaque geometry. Then I modify the albedo and material of the fragment in function of the distance to the collision in order to generate foam. Since I generate my velocity map with the other maps, I have a free Perlin noise that I can use to perturb my velocity vectors, to give it the random flavor that foam has.
I also changed my old sinus wave to a Gerstner wave. I generate it by taking N samples on [0,1], moving them along a circle (or ellipse) with angle depending on x. And then I just do a quadratic interpolation between my resulting points, so that I get a function y = f(x). It looks like that (linear interp here):
Quadratic interpolation allows me to compute very quickly the normal map.
Moreover, I added some antialiasing to interesction between 2.5D sprites (which was kind of ugly because of artefacts due to lack of precision in heightmaps). The idea is simple: I use the alpha pass to put some fragments that should be behind, on top, with opacity depending on the difference of depth. It is not very accurate, but the difference is subtle enough to really be a good tradeoff:
Top left: without AA, without SSAO ; Top right: without AA, with SSAO
Bottom left: with AA, without SSAO ; Bottom right: with AA, with SSAO
And that's it for today, stay tuned !