Should water refractions be scaled?

Everything about development and the OpenMW source code.
Post Reply
User avatar
drummyfish
Posts: 83
Joined: 22 Oct 2017, 10:13
Github profile: https://github.com/drummyfish
Contact:

Should water refractions be scaled?

Post by drummyfish » 06 Dec 2017, 19:39

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: 2498
Joined: 07 Aug 2011, 01:12
Location: Caldera

Re: Should water refractions be scaled?

Post by raevol » 06 Dec 2017, 19:50

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.

User avatar
kuyondo
Posts: 118
Joined: 29 Mar 2016, 17:45

Re: Should water refractions be scaled?

Post by kuyondo » 06 Dec 2017, 19:57

this is logical. I think we can also make an option to scale it. maybe in the .cfg file.

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

Re: Should water refractions be scaled?

Post by drummyfish » 06 Dec 2017, 22:29

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: 564
Joined: 26 Nov 2015, 03:25

Re: Should water refractions be scaled?

Post by AnyOldName3 » 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?

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

Re: Should water refractions be scaled?

Post by drummyfish » 06 Dec 2017, 23:51

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: 92
Joined: 09 May 2015, 13:07

Re: Should water refractions be scaled?

Post by wareya » 07 Dec 2017, 14:04

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.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests