mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:23:52 +00:00
WIP fix
Bug is fixed, but appears to have broken vision underwater. Notes: + basically fixed by darkening the colour of water such that it is darker than refracted terrain + also disabled sunlight scattering at night. This may actually be desirable, but given there is no visible moon it seems unlikely to make much sense, and blends a lot of green into the water colour appearing luminescent at night
This commit is contained in:
parent
013916fca3
commit
cfea7736d9
8 changed files with 17 additions and 14 deletions
|
@ -35,7 +35,7 @@ namespace MWRender
|
||||||
vp->setShadowsEnabled(false);
|
vp->setShadowsEnabled(false);
|
||||||
vp->setVisibilityMask(RV_Actors + RV_Misc + RV_Statics + RV_StaticsSmall + RV_Terrain + RV_Sky);
|
vp->setVisibilityMask(RV_Actors + RV_Misc + RV_Statics + RV_StaticsSmall + RV_Terrain + RV_Sky);
|
||||||
vp->setMaterialScheme("water_refraction");
|
vp->setMaterialScheme("water_refraction");
|
||||||
vp->setBackgroundColour (Ogre::ColourValue(0.18039, 0.23137, 0.25490));
|
vp->setBackgroundColour (Ogre::ColourValue(0.090195, 0.115685, 0.12745));
|
||||||
mRenderTarget->setAutoUpdated(true);
|
mRenderTarget->setAutoUpdated(true);
|
||||||
mRenderTarget->addListener(this);
|
mRenderTarget->addListener(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -522,9 +522,10 @@ void RenderingManager::applyFog (bool underwater)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mRendering.getScene()->setFog (FOG_LINEAR, Ogre::ColourValue(0.18039, 0.23137, 0.25490), 0, 0, 1000);
|
//Ogre::ColourValue clv(0.090195, 0.115685, 0.12745);
|
||||||
mRendering.getViewport()->setBackgroundColour (Ogre::ColourValue(0.18039, 0.23137, 0.25490));
|
mRendering.getScene()->setFog (FOG_LINEAR, Ogre::ColourValue(clv));
|
||||||
mWater->setViewportBackground (Ogre::ColourValue(0.18039, 0.23137, 0.25490));
|
mRendering.getViewport()->setBackgroundColour (Ogre::ColourValue(clv));
|
||||||
|
mWater->setViewportBackground (Ogre::ColourValue(clv));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -631,12 +632,12 @@ void RenderingManager::sunDisable(bool real)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderingManager::setSunDirection(const Ogre::Vector3& direction)
|
void RenderingManager::setSunDirection(const Ogre::Vector3& direction, bool is_moon)
|
||||||
{
|
{
|
||||||
// direction * -1 (because 'direction' is camera to sun vector and not sun to camera),
|
// direction * -1 (because 'direction' is camera to sun vector and not sun to camera),
|
||||||
if (mSun) mSun->setDirection(Vector3(-direction.x, -direction.y, -direction.z));
|
if (mSun) mSun->setDirection(Vector3(-direction.x, -direction.y, -direction.z));
|
||||||
|
|
||||||
mSkyManager->setSunDirection(direction);
|
mSkyManager->setSunDirection(direction, is_moon);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderingManager::setGlare(bool glare)
|
void RenderingManager::setGlare(bool glare)
|
||||||
|
|
|
@ -145,7 +145,7 @@ public:
|
||||||
|
|
||||||
void setAmbientColour(const Ogre::ColourValue& colour);
|
void setAmbientColour(const Ogre::ColourValue& colour);
|
||||||
void setSunColour(const Ogre::ColourValue& colour);
|
void setSunColour(const Ogre::ColourValue& colour);
|
||||||
void setSunDirection(const Ogre::Vector3& direction);
|
void setSunDirection(const Ogre::Vector3& direction, bool is_moon);
|
||||||
void sunEnable(bool real); ///< @param real whether or not to really disable the sunlight (otherwise just set diffuse to 0)
|
void sunEnable(bool real); ///< @param real whether or not to really disable the sunlight (otherwise just set diffuse to 0)
|
||||||
void sunDisable(bool real);
|
void sunDisable(bool real);
|
||||||
|
|
||||||
|
|
|
@ -546,14 +546,14 @@ void SkyManager::sunDisable()
|
||||||
mSunEnabled = false;
|
mSunEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkyManager::setSunDirection(const Vector3& direction)
|
void SkyManager::setSunDirection(const Vector3& direction, bool is_moon)
|
||||||
{
|
{
|
||||||
if (!mCreated) return;
|
if (!mCreated) return;
|
||||||
mSun->setPosition(direction);
|
mSun->setPosition(direction);
|
||||||
mSunGlare->setPosition(direction);
|
mSunGlare->setPosition(direction);
|
||||||
|
|
||||||
float height = direction.z;
|
float height = direction.z;
|
||||||
float fade = ( height > 0.5) ? 1.0 : height * 2;
|
float fade = is_moon ? 0.0 : (( height > 0.5) ? 1.0 : height * 2);
|
||||||
sh::Factory::getInstance ().setSharedParameter ("waterSunFade_sunHeight", sh::makeProperty<sh::Vector2>(new sh::Vector2(fade, height)));
|
sh::Factory::getInstance ().setSharedParameter ("waterSunFade_sunHeight", sh::makeProperty<sh::Vector2>(new sh::Vector2(fade, height)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -148,7 +148,7 @@ namespace MWRender
|
||||||
|
|
||||||
void sunDisable();
|
void sunDisable();
|
||||||
|
|
||||||
void setSunDirection(const Ogre::Vector3& direction);
|
void setSunDirection(const Ogre::Vector3& direction, bool is_moon);
|
||||||
|
|
||||||
void setMasserDirection(const Ogre::Vector3& direction);
|
void setMasserDirection(const Ogre::Vector3& direction);
|
||||||
|
|
||||||
|
|
|
@ -378,11 +378,13 @@ void WeatherManager::update(float duration)
|
||||||
|
|
||||||
int facing = (mHour > 13.f) ? 1 : -1;
|
int facing = (mHour > 13.f) ? 1 : -1;
|
||||||
|
|
||||||
|
bool sun_is_moon = mHour >= mNightStart || mHour <= mSunriseTime;
|
||||||
|
|
||||||
Vector3 final(
|
Vector3 final(
|
||||||
(height - 1) * facing,
|
(height - 1) * facing,
|
||||||
(height - 1) * facing,
|
(height - 1) * facing,
|
||||||
height);
|
height);
|
||||||
mRendering->setSunDirection(final);
|
mRendering->setSunDirection(final, sun_is_moon);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TODO: import separated fadeInStart/Finish, fadeOutStart/Finish
|
* TODO: import separated fadeInStart/Finish, fadeOutStart/Finish
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#define UNDERWATER_COLOUR float3(0.18039, 0.23137, 0.25490)
|
#define UNDERWATER_COLOUR float3(0.090195, 0.115685, 0.12745)
|
||||||
|
|
||||||
#define VISIBILITY 1000.0 // how far you can look through water
|
#define VISIBILITY 1000.0 // how far you can look through water
|
||||||
|
|
||||||
|
|
|
@ -351,7 +351,7 @@
|
||||||
#if REFRACTION
|
#if REFRACTION
|
||||||
shOutputColour(0).xyz = shLerp( shLerp(refraction, scatterColour, lightScatter), reflection, fresnel) + specular * sunSpecular.xyz;
|
shOutputColour(0).xyz = shLerp( shLerp(refraction, scatterColour, lightScatter), reflection, fresnel) + specular * sunSpecular.xyz;
|
||||||
#else
|
#else
|
||||||
shOutputColour(0).xyz = shLerp(reflection, float3(0.18039, 0.23137, 0.25490), (1.0-fresnel)*0.5) + specular * sunSpecular.xyz;
|
shOutputColour(0).xyz = shLerp(reflection, float3(0.090195, 0.115685, 0.12745), (1.0-fresnel)*0.5) + specular * sunSpecular.xyz;
|
||||||
#endif
|
#endif
|
||||||
// fog
|
// fog
|
||||||
float fogValue = shSaturate((depthPassthrough - fogParams.y) * fogParams.w);
|
float fogValue = shSaturate((depthPassthrough - fogParams.y) * fogParams.w);
|
||||||
|
|
Loading…
Reference in a new issue