I am trying to recreate Outerra's ocean rendering and was curious how you implemented the transparency effect near the shore:
![](http://2.bp.blogspot.com/-U45V0ub9CNA/TV0LnSrjYNI/AAAAAAAAAEo/4riE7itmIWg/s1600/water-r7g30b70.jpg)
Based on
http://outerra.blogspot.com/2011/02/ocean-rendering.html more than simple alpha blending is required. Presumably, you are rendering the terrain into color and depth Frame Buffer Objects and then computing the water color based on that. I would guess that the water depth is derived directly from the depth buffer.
My question is then how you are dealing with multisampling. Resolving a multisampled depth buffer selects the smallest depth for each fragment. If this value is used directly, it produces artifacts around antialiased object in front of the ocean (because it thinks that the water has a negative depth at those locations). I've considered selecting the
highest depth at each point from the multisampled depth texture. However, I suspect this would also cause artifacts unless only the right samples from the color buffer were used, and even then might have issues when water is rastered for some of samples in a pixel. Am I overlooking something?