Is it Possible to Make Water More Murky?

Support for running, installing or compiling OpenMW

Before you submit a bug report for the first time, please read: Bug reporting guidelines
visvaldas
Posts: 35
Joined: 24 May 2015, 20:31

Re: Is it Possible to Make Water More Murky?

Post by visvaldas »

screenshot287.png
How about that?

Code: Select all

--- a/files/shaders/water_fragment.glsl
+++ b/files/shaders/water_fragment.glsl
@@ -34,7 +34,8 @@ const float SPEC_HARDNESS = 256.0;                 // specular highlights hardne
 const vec2 WIND_DIR = vec2(0.5f, -0.8f);
 const float WIND_SPEED = 0.2f;
 
-const vec3 WATER_COLOR = vec3(0.090195, 0.115685, 0.12745);
+// const vec3 WATER_COLOR = vec3(0.090195, 0.115685, 0.12745);
+const vec3 WATER_COLOR = vec3(0.25, 0.25, 0.1) * 0.8;
 
 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -
 
@@ -174,7 +175,7 @@ void main(void)
     float waterDepth = refractionDepth - depth;
 
     if (cameraPos.z > 0.0)
-        refraction = mix(refraction, waterColor, clamp(waterDepth/VISIBILITY, 0.0, 1.0));
+        refraction = mix(refraction, waterColor, 1 - exp(-waterDepth * 0.015));
 
     gl_FragData[0].xyz = mix( mix(refraction,  scatterColour,  lightScatter),  reflection,  fresnel) + specular * gl_LightSource[0].specular.xyz;
 #else
User avatar
Atahualpa
Posts: 1176
Joined: 09 Feb 2016, 20:03

Re: Is it Possible to Make Water More Murky?

Post by Atahualpa »

Looks nice. :)

But, first of all, we need different water types (ocean, lakes, rivers, pools) in OpenMW, plus real water geometry, plus waves and foam, plus dynamic wind and weather effects, plus... ehm. Okay, different water types would be a good start.
User avatar
lysol
Posts: 1513
Joined: 26 Mar 2013, 01:48
Location: Sweden

Re: Is it Possible to Make Water More Murky?

Post by lysol »

Atahualpa wrote: But, first of all, we need different water types (ocean, lakes, rivers, pools) in OpenMW, plus real water geometry, plus waves and foam, plus dynamic wind and weather effects, plus... ehm. Okay, different water types would be a good start.
True this.

The water color here for Balmora looks super realistic really (great job visvaldas!), but as soon as you get to the ocean, it will look wrong.
visvaldas
Posts: 35
Joined: 24 May 2015, 20:31

Re: Is it Possible to Make Water More Murky?

Post by visvaldas »

Quick proof of concept:
screenshot374.png
screenshot373.png
screenshot372.png
screenshot371.png
User avatar
lysol
Posts: 1513
Joined: 26 Mar 2013, 01:48
Location: Sweden

Re: Is it Possible to Make Water More Murky?

Post by lysol »

Is this a photoshopped screenshot it have you actually managed to make it look like this in-game..? Because it's brilliant and amazing and loads of other adjectives.
visvaldas
Posts: 35
Joined: 24 May 2015, 20:31

Re: Is it Possible to Make Water More Murky?

Post by visvaldas »

No photoshopping here :)
I'm using a texture as a map for each water color and visibility.
It would also be possible to control other parameters like wave strength(and direction?) this way.
Jenikk
Posts: 4
Joined: 07 Jan 2017, 09:28

Re: Is it Possible to Make Water More Murky?

Post by Jenikk »

Holy s***. That looks amazing! Good job visvaldas!
User avatar
lysol
Posts: 1513
Joined: 26 Mar 2013, 01:48
Location: Sweden

Re: Is it Possible to Make Water More Murky?

Post by lysol »

visvaldas wrote: 08 Aug 2017, 20:47 I'm using a texture as a map for each water color and visibility.
It would also be possible to control other parameters like wave strength(and direction?) this way.
Genius. This is so great.
magamo
Posts: 109
Joined: 28 May 2016, 17:28

Re: Is it Possible to Make Water More Murky?

Post by magamo »

Visvaldis, your work always impresses. When can you commit this (and your fog shaders) to the code base so people can start experiencing it? How close do you think you are to that point?
visvaldas
Posts: 35
Joined: 24 May 2015, 20:31

Re: Is it Possible to Make Water More Murky?

Post by visvaldas »

magamo wrote: 16 Aug 2017, 19:20 Visvaldis, your work always impresses. When can you commit this (and your fog shaders) to the code base so people can start experiencing it? How close do you think you are to that point?
When it's done ;)
I'm sorry, but I can't give you a more precise answer.
Post Reply