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
Lambrini
Posts: 5
Joined: 12 Jan 2017, 11:23

Is it Possible to Make Water More Murky?

Post by Lambrini »

The water effects in the engine are very pretty but I feel the water is a little too clear sometimes. For example, the water in Balmora is almost invisible sometimes. I also experience in dungeons too.

Is there a way to add, say, a bit of colouration to the water so that it looks a little less crystal clear?

I looked at the wiki but I found no mention of any settings.

Cheers. :)
User avatar
silentthief
Posts: 456
Joined: 18 Apr 2013, 01:20
Location: Currently traversing the Ascadian Isles

Re: Is it Possible to Make Water More Murky?

Post by silentthief »

With the vanilla MW you could make changes to the Morrowind ini file to make the water more opaque. Check this link @ fliggerty.com for the morrowind ini tutorial

http://www.fliggerty.com/phpBB3/viewtop ... =63&t=4856

Now, just a heads up: I have not tried this in openMW myself and so I do not know what changes, if any; will show up in game. If you do alter these settings and have a result (positive or negative), please reply here so that we know. I did a quick search for "morrowind.ini" here and it found 37 pages of results, and so I did not go through those and check if anyone has made any INI file changes to this kind of thing and reported back.

ST the reporter
User avatar
Capostrophic
Posts: 794
Joined: 22 Feb 2016, 20:32

Re: Is it Possible to Make Water More Murky?

Post by Capostrophic »

Just FYI, only these Morrowind.ini water settings are used after importing:

Code: Select all

[Water]
Map Alpha=0.4
World Alpha=0.75
SurfaceFPS=12
SurfaceTexture=water
SurfaceFrameCount=32
RippleTexture=ripple
RippleFrameCount=4
RippleLifetime=3.0
RippleRotSpeed=0.5
RippleAlphas=0.7, 0.1, 0.01
NearWaterRadius=1000
NearWaterPoints=8
NearWaterIndoorTolerance=512.0
NearWaterOutdoorTolerance=1024.0
NearWaterIndoorID=Water Layer
NearWaterOutdoorID=Water Layer
UnderwaterSunriseFog=3
UnderwaterDayFog=2.5
UnderwaterSunsetFog=3
UnderwaterNightFog=4
UnderwaterIndoorFog=3
UnderwaterColor=012,030,037
UnderwaterColorWeight=0.85
Lambrini
Posts: 5
Joined: 12 Jan 2017, 11:23

Re: Is it Possible to Make Water More Murky?

Post by Lambrini »

Thank you for the replies. Sadly, the alpha settings had no effect. At least they didn't crash the game though!

It's a shame (for my personal tastes) as I feel that an island with a huge volcano in the middle of it would have murkier waters especially judging by all the air pollution there is. :P

Still, at least by using OpenMW my game doesn't fall over every 2 minutes... :)
User avatar
sjek
Posts: 442
Joined: 22 Nov 2014, 10:51

Re: Is it Possible to Make Water More Murky?

Post by sjek »

well actually they affect the game. there's no editor alpha from original ini but otherwise these works at least.
thanks for the list Capostrophic
Spoiler: Show
otherwise you can also use water textures from darker morrowind mod pack http://mw.modhistory.com/download-70-6134
User avatar
MiroslavR
Posts: 156
Joined: 12 Feb 2014, 17:45

Re: Is it Possible to Make Water More Murky?

Post by MiroslavR »

@sjek:

The NearWater* settings only affect sound. They have no visual impact.
  • NearWaterOutdoorTolerance, NearWaterIndoorTolerance - the minimum distance the player must be to the water surface for the water sound to play.
  • NearWaterRadius, NearWaterPoints - used to determine how much water is surrounding the player. Affects water sound volume.
  • NearWaterOutdoorID, NearWaterIndoorID - sound IDs for water in outdoor and indoor cells, respectively. The latter setting is not respected by vanilla MW, however this is fixed in MCP. OpenMW follows MCP behavior.
See https://github.com/OpenMW/openmw/blob/4 ... p.cpp#L807 for implementation details.
User avatar
Capostrophic
Posts: 794
Joined: 22 Feb 2016, 20:32

Re: Is it Possible to Make Water More Murky?

Post by Capostrophic »

Map Alpha and World Alpha settings are used as an argument for createSimpleWaterStateSet() function (they're not used for shader water).

SurfaceFPS, SurfaceTexture, SurfaceFrameCount are all used for animating simple water, namely, the first one is used for the speed of playback, the second is used when OpenMW searches for the textures of simple water and the last is the frame count - OpenMW uses a loop to find all the textures with file names with number suffixes from 00 to 31 (in case of the default frame count).
I.e.: OpenMW searches for textures/water/[SurfaceTexture][00 to (SurfaceFrameCount-1)].dds and then playbacks these textures when using simple water @ [SurfaceFPS] FPS.

RippleTexture and RippleFrameCount are used in the same fashion for ripple simulation. Ripples are these circles on the water which appear when someone is swimming. Ripples are technically particles, so RippleLifeTime and RippleRotSpeed are used as the lifetime and velocity of those particles. Shader water too uses those (arguably poor looking) ripples so these settings apply to it.

RippleAlphas are apparently not used, I've mistaken, sorry.

Underwater[Time of day]Fog are used for calculating underwater fog start. View distance is multiplied by (1 - underwater fog value) or something, I'm not sure.

And UnderwaterColor(Weight) values are used for underwater tint, simple as that.

For essentially every setting which affects shader water look no further than water_fragment.glsl file in [OpenMW root folder]/resources/shaders, it has some configurable parameters.
User avatar
sjek
Posts: 442
Joined: 22 Nov 2014, 10:51

Re: Is it Possible to Make Water More Murky?

Post by sjek »

ok. without going to writing that math up more so xD
I think it goes like, as it relies on the fact waterlevel - pos.z diminishing to zero when going at surface as waterlevel is itself hardcoded to -1 in exterior........... or so

volume = player distance from water surface in z, multiplied with proportional amount of underwater terrain points on grid with number of tiles on side from NearWaterPoints value. one tile's size is near constant determined by NearWaterRadius.

haven't datamined the reverse engineering or tried mods / vanilla , but the sound is hard to get played even in open sea. have to look further but from the soundmanager part it might be that it get's run over by update or sound index checking afetr if(mNearWaterSound) part the volume variable being trigger for looping.

there's the underwater fog calculation https://github.com/OpenMW/openmw/blob/m ... r.cpp#L469

Code: Select all

            setFogColor(mUnderwaterColor * mUnderwaterWeight + mFogColor * (1.f-mUnderwaterWeight));
            mStateUpdater->setFogStart(mViewDistance * (1 - mUnderwaterFog));
mStateUpdater->setFogEnd(mViewDistance);
Spoiler: Show
-----------------------------------------------------------------------------------
Then for the shaders: using water as example:

the pipeline seems to be defined via uniform which are by the definition the info what is given from application to the GLSL shaders. the gl_lightposition , gl_position , gl_ .... are essentially uniforms defined in opengl itself as preset functions.

basically vertex shader names punch of variables with style : varying type name, modified / defined after
  • varying vec3 screenCoordsPassthrough;
    varying vec4 position;
    varying float depthPassthrough;
which can be used in this case, in fragment shader, vertex handling the vertex information on the scene and fragment shader then uses that to modify what's shown on the screen..
  • gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
gl_position should define the position from individual vertices, but more generally it's the variable that is passed forward to fragment shader. for googling that, there's multiple versions of GLSL in exixtence, used defined in shader with #version at the start. openmw's are in 120 = 1.2
  • vec, mat are vectors and matrices with number given dimensions. the shaders being vector and matrix mathematics in short or vector matrix arithmetics
like with changing the depthPassthrough = gl_Position.z; line to depthPassthrough = gl_Position.z * gl_Position.x * gl_Position.y;
i have kinda no idea how the resulting matrix is deformed by that action but this was the result
Image
Image
comparing to the originals
Image
Image
so don't know how that excessive clipping can be avoided

Then in the fragment shader Uniform Sampler2D or 3D can be used to take texture coordinates from the engine.
otherwise haven't looked into that part yet.

DISCLAIMER: This is probably much saver in fragment shader. good to have package for reinstall to different folder as this can corrupt the shader pathway somehow. :mrgreen:
ie. with geometry shader function water turned all black in surface and got normal map showing dependent on view angle.

-----------------------------------------------------------------------------------

there's written uniform definitions in the code:
osg::Uniform("envMapColor", osg::Vec4f(1,1,1,1))
osg::Uniform("diffuseMap", texunit)
osg::Uniform("normalMap", 0)
osg::Uniform("reflectionMap", 1)
osg::Uniform("near", mNearClip)
osg::Uniform("far", mViewDistance)
osg::Uniform("envMapColor", mColor)

source code places:
Spoiler: Show
this one wonders: seems to iterate over shader text with adduniform and define shadertemplates for the vertex and fragment shaders.
https://github.com/OpenMW/openmw/blob/m ... r.cpp#L299

-----------------------------------------------------------------------------------

Tutorials: basics: Image
User avatar
sjek
Posts: 442
Joined: 22 Nov 2014, 10:51

Re: Is it Possible to Make Water More Murky?

Post by sjek »

in retrospec there's watercolour rbg as vector value in line 37 which coud be easiest.
float shadow =1.0, line 83 , multiplies the specular value, and for fresnel clamping, althought not sure what it does, in line 148. Line 145 contains the refractive indices in both ways from the surface https://en.wikipedia.org/wiki/Refractiv ... cal_values
User avatar
MiroslavR
Posts: 156
Joined: 12 Feb 2014, 17:45

Re: Is it Possible to Make Water More Murky?

Post by MiroslavR »

sjek wrote:haven't datamined the reverse engineering or tried mods / vanilla , but the sound is hard to get played even in open sea.
The sound does play, but it's usually much quieter than vanilla. I believe OpenMW handles volumes differently in general: see https://github.com/OpenMW/openmw/pull/1141.
Post Reply