Outerra forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Download Outerra Tech Demo. Unofficial Outerra Discord server, MicroProse Discord server for OWS.

Author Topic: Ocean transparency & multisampling  (Read 6472 times)

fixeli

  • Newbie
  • Posts: 2
  • newbie
Ocean transparency & multisampling
« on: July 13, 2014, 02:57:18 pm »

I am trying to recreate Outerra's ocean rendering and was curious how you implemented the transparency effect near the shore:



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?
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: Ocean transparency & multisampling
« Reply #1 on: July 14, 2014, 03:45:19 am »

Reflected and in-scattered light from the bottom is actually rendered in the terrain pass. Water surface pass only modulates it with the light reflected from the water surface, and it doesn't need any depth information at that point.
Logged

fixeli

  • Newbie
  • Posts: 2
  • newbie
Re: Ocean transparency & multisampling
« Reply #2 on: July 14, 2014, 09:47:07 pm »

I knew I was overlooking something. That is a far more elegant solution! :)

What resources did you use to get the equations for in-scattering, Fresnel effect, etc.?
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: Ocean transparency & multisampling
« Reply #3 on: July 15, 2014, 02:37:15 am »

Mostly what I could google, generally knowing the behavior of light going through particles - so I looked for spectral attenuation and light scattering coefficients in (sea) water. It's configurable in env settings too, but the two should be correlated somehow; it's not always easy to get what one wants with those settings.
Logged