Should water refractions be scaled?

Everything about development and the OpenMW source code.
User avatar
drummyfish
Posts: 154
Joined: 22 Oct 2017, 10:13
Contact:

Should water refractions be scaled?

Post 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.
User avatar
raevol
Posts: 3093
Joined: 07 Aug 2011, 01:12
Location: Caldera

Re: Should water refractions be scaled?

Post 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.
kuyondo
Posts: 243
Joined: 29 Mar 2016, 17:45

Re: Should water refractions be scaled?

Post by kuyondo »

this is logical. I think we can also make an option to scale it. maybe in the .cfg file.
User avatar
drummyfish
Posts: 154
Joined: 22 Oct 2017, 10:13
Contact:

Re: Should water refractions be scaled?

Post 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
User avatar
AnyOldName3
Posts: 2666
Joined: 26 Nov 2015, 03:25

Re: Should water refractions be scaled?

Post 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?
User avatar
drummyfish
Posts: 154
Joined: 22 Oct 2017, 10:13
Contact:

Re: Should water refractions be scaled?

Post 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.
User avatar
wareya
Posts: 338
Joined: 09 May 2015, 13:07

Re: Should water refractions be scaled?

Post 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.
ajira2
Posts: 55
Joined: 30 Oct 2017, 14:27

Re: Should water refractions be scaled?

Post 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).
User avatar
Thunderforge
Posts: 503
Joined: 06 Jun 2017, 05:57

Re: Should water refractions be scaled?

Post 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.
User avatar
AnyOldName3
Posts: 2666
Joined: 26 Nov 2015, 03:25

Re: Should water refractions be scaled?

Post 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.
Post Reply