For rendering you also need depth fog. From pixel depth to scene depth. Simple but effective formula is calcululate distance from pixel position to positionBehindTranlucency and then multiply that with density. Density can be different for each wavelength. Then you plug this to exp2 function with minus sign.
color = lerp(waterColor, sceneColor, pow(2.0, -density * distance))