Page 1 of 2

Should water refractions be scaled?

Posted: 06 Dec 2017, 19:39
by drummyfish
I found this on reddit:

Image

Should we do it? Here's how

Code: Select all

diff --git a/apps/openmw/mwrender/water.cpp b/apps/openmw/mwrender/water.cpp
index c4dffb7..991de1b 100644
--- a/apps/openmw/mwrender/water.cpp
+++ b/apps/openmw/mwrender/water.cpp
@@ -272,6 +272,10 @@ public:
 
     void setWaterLevel(float waterLevel)
     {
+        const float refractionScale = 0.5;
+        setViewMatrix(osg::Matrix::scale(1,1,refractionScale) *
+            osg::Matrix::translate(0,0,(1.0 - refractionScale) * waterLevel));
+
         mClipCullNode->setPlane(osg::Plane(osg::Vec3d(0,0,-1), osg::Vec3d(0,0, waterLevel)));
     }
And here's the result:

Image

(Can be made less prominent of course.)

Does it look more realistic or just weird? I can't really decide.

Re: Should water refractions be scaled?

Posted: 06 Dec 2017, 19:50
by raevol
From a realism perspective this is awesome, from a gameplay perspective this will make swimming combat really wonky. But kind of in a good way? If we do do this I think it should be an option, because some people are going to be traumatized fighting distorted murderfish.

Re: Should water refractions be scaled?

Posted: 06 Dec 2017, 19:57
by kuyondo
this is logical. I think we can also make an option to scale it. maybe in the .cfg file.

Re: Should water refractions be scaled?

Posted: 06 Dec 2017, 22:29
by drummyfish
Thank you for the feedback, I've made a PR to make this an optional setting. I keep liking this effect more and more, it really adds realism, for example look how this oar is "broken".

Image

Image

Re: Should water refractions be scaled?

Posted: 06 Dec 2017, 23:12
by AnyOldName3
Is the change we've made definitely physically correct instead of just looking physically correct in a few test cases which look good?

Re: Should water refractions be scaled?

Posted: 06 Dec 2017, 23:51
by drummyfish
AnyOldName3 wrote: 06 Dec 2017, 23:12 Is the change we've made definitely physically correct instead of just looking physically correct in a few test cases which look good?
Should be correct:

Image

Refracted rays (left) can be achieved by scaling down the space underwater (right).

Anyway we're already doing physically incorrect approximations, like the wave refractions in the water shader.

Re: Should water refractions be scaled?

Posted: 07 Dec 2017, 14:04
by wareya
If you're using RGB you're already not being physically correct, so just go all out for maximum "looks realistic to me"ness. PBR is primarily about lighting, and Morrowind's vanilla assets can't use PBR style lighting.

Re: Should water refractions be scaled?

Posted: 20 Dec 2017, 11:14
by ajira2
This is very cool. Please add it to OpenMW 0.44! (as an option if you wish, but I feel this should be mandatory and an option to disable it).

Re: Should water refractions be scaled?

Posted: 24 Dec 2017, 05:38
by Thunderforge
I'm not sure that it should be enabled by default, since it goes against the vanilla Morrowind behavior that most users will be expecting. But I would definitely like to see it as an option.

Re: Should water refractions be scaled?

Posted: 24 Dec 2017, 14:40
by AnyOldName3
The water shader is off by default, so even if it's 'on by default' it still won't show up unless the shader is enabled and then refraction is enabled as well.