Thread: Water Clarity
View Single Post
Old 06-03-10, 01:18 PM   #3
ichso
Ace of the Deep
 
Join Date: Jul 2005
Location: Germany's oldest city alive
Posts: 1,066
Downloads: 57
Uploads: 0
Default

Hi there,

I was looking into the same issue some time ago and wanted to reduce the water clarity (when viewed from the surface). I was quite happy with the result and wanted to make a little release out of it.
But because of a lack of time I stopped tweaking it further - and playing too.

Here is what I got up until that point:

Also in this thread:
http://www.subsim.com/radioroom/showthread.php?t=162424

The change done was to edit the last lines of the main function in the data/shaders/waterTranspPS.fx file like this:
(IIRC, can't test right now)
Code:
     float maxDist = WaterParams.w;

     //[ser] Increase opacity near intersections to make water edge more visible
     float shallowfactor = saturate(1/(depthlength*25 + 1));
     //[ser] Attempt a pseudo-antialiasing by decreasing opacity smoothly near zero-depth
     shallowfactor = saturate(shallowfactor - pow(shallowfactor,4))*2;
    depthlength = saturate(depthlength/maxDist + shallowfactor);
ichso is offline   Reply With Quote