Water shaders, OpenMW vs MGEXE

Feedback on past, current, and future development.
User avatar
kuyondo
Posts: 221
Joined: 29 Mar 2016, 17:45

Water shaders, OpenMW vs MGEXE

Post by kuyondo » 12 Jul 2018, 09:40

OpenMW
Image
Image
MGEXE
Image
Image

User avatar
akortunov
Posts: 392
Joined: 13 Mar 2017, 13:49
Location: Samara, Russian Federation
Github profile: https://github.com/akortunov

Re: Water shaders, OpenMW vs MGEXE

Post by akortunov » 12 Jul 2018, 10:10

And? What kind of conclusion should we do?
As for me, shaders looks pretty similar on these screenshots.
Only differences I see:
1. MGE has a bloom.
2. Water color is different a bit because of sky reflection.

User avatar
wareya
Posts: 221
Joined: 09 May 2015, 13:07

Re: Water shaders, OpenMW vs MGEXE

Post by wareya » 12 Jul 2018, 11:00

They're comparing the more-transparency-near-shores that MGEXE has. It's a nice feature. OpenMW doesn't have it right now.
paying attention to #1751/#1816 #2473 #3609 #3862/#3929 #3807 #4297

User avatar
AnyOldName3
Posts: 1090
Joined: 26 Nov 2015, 03:25

Re: Water shaders, OpenMW vs MGEXE

Post by AnyOldName3 » 12 Jul 2018, 12:15

I'm pretty sure the depth of the water is used for something already (as at the very least it's something that needs to be known to get refraction right. If the effect isn't there, we do already have all the data we need to implement it.
AnyOldName3, Master of Shadows

User avatar
drummyfish
Posts: 154
Joined: 22 Oct 2017, 10:13
Github profile: https://gitlab.com/drummyfish
Contact:

Re: Water shaders, OpenMW vs MGEXE

Post by drummyfish » 12 Jul 2018, 13:49

AnyOldName3 wrote:
12 Jul 2018, 12:15
I'm pretty sure the depth of the water is used for something already (as at the very least it's something that needs to be known to get refraction right. If the effect isn't there, we do already have all the data we need to implement it.
Yep, we already have the depth data. We're currently discussing the water shader improvements at GitLab, will add this feature.

User avatar
drummyfish
Posts: 154
Joined: 22 Oct 2017, 10:13
Github profile: https://gitlab.com/drummyfish
Contact:

Re: Water shaders, OpenMW vs MGEXE

Post by drummyfish » 12 Jul 2018, 14:28

quick test:

Code: Select all

diff --git a/files/shaders/water_fragment.glsl b/files/shaders/water_fragment.glsl
index 7511375..4025c1c 100644
--- a/files/shaders/water_fragment.glsl
+++ b/files/shaders/water_fragment.glsl
@@ -253,10 +253,10 @@ void main(void)
 
     // refraction
 #if REFRACTION
-    vec3 refraction = texture2D(refractionMap, screenCoords - screenCoordsOffset).rgb;
+    vec3 underwater = texture2D(refractionMap, screenCoords - screenCoordsOffset).rgb;
 
     // brighten up the refraction underwater
-    refraction = (cameraPos.z < 0.0) ? clamp(refraction * 1.5, 0.0, 1.0) : refraction;
+    vec3 refraction = (cameraPos.z < 0.0) ? clamp(underwater * 1.5, 0.0, 1.0) : underwater;
 #endif
     // specular
     vec3 R = reflect(vVec, normal);
@@ -269,7 +269,11 @@ void main(void)
     if (cameraPos.z > 0.0)
         refraction = mix(refraction, waterColor, clamp(depthSampleDistorted/VISIBILITY, 0.0, 1.0));
 
-    gl_FragData[0].xyz = mix( mix(refraction,  scatterColour,  lightScatter),  reflection,  fresnel) + specular * gl_LightSource[0].specular.xyz;
+    vec3 output = mix( mix(refraction,  scatterColour,  lightScatter),  reflection,  fresnel) + specular * gl_LightSource[0].specular.xyz;
+    output = mix( underwater, output, pow(shore,10));
+
+    gl_FragData[0].xyz = output;
+
 #else
     gl_FragData[0].xyz = mix(reflection,  waterColor,  (1.0-fresnel)*0.5) + specular * gl_LightSource[0].specular.xyz;
 #endif
Image

User avatar
psi29a
Posts: 4200
Joined: 29 Sep 2011, 10:13
Github profile: https://github.com/psi29a/
Contact:

Re: Water shaders, OpenMW vs MGEXE

Post by psi29a » 12 Jul 2018, 14:32

Nice work!

I also noticed something where water can look 'wavey' when it gets close to the shore... pulling back and coming ashore. I'm assuming this is a trick of the shader where parts goes invisible when coming into contact with a low-grade sloop. Maybe I got that wrong and there is in fact 'volume' to the shader or water plane where it ungulates.

User avatar
AnyOldName3
Posts: 1090
Joined: 26 Nov 2015, 03:25

Re: Water shaders, OpenMW vs MGEXE

Post by AnyOldName3 » 12 Jul 2018, 15:48

I think the transparency effect there is way too strong. IRL, it's easy to see where the water starts and the ground stops, but in those screenshots, it isn't.
AnyOldName3, Master of Shadows

User avatar
drummyfish
Posts: 154
Joined: 22 Oct 2017, 10:13
Github profile: https://gitlab.com/drummyfish
Contact:

Re: Water shaders, OpenMW vs MGEXE

Post by drummyfish » 12 Jul 2018, 16:39

AnyOldName3 wrote:
12 Jul 2018, 15:48
I think the transparency effect there is way too strong. IRL, it's easy to see where the water starts and the ground stops, but in those screenshots, it isn't.
I agree, however I noticed that this is how it's usually done in games, e.g. 0 A. D.:

Image

It's probably considered looking nicer than the sharp edges, even if not % 100 realistic. It could be made less prominent though (by changing the pow parameter).

Also this effect is only possible with refractions enabled. Without refractions the water is rendered differently, there is no depth information, it's just a plane with alpha blending.

User avatar
MiroslavXO
Posts: 97
Joined: 13 Feb 2016, 01:07

Re: Water shaders, OpenMW vs MGEXE

Post by MiroslavXO » 12 Jul 2018, 18:10

I really dislike normal map for OpenMW version, waves look better in MGEXE.

Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests