mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 15:29:55 +00:00
Make sun specularity behavior more intuitive (bug #6190)
Remove sun visibility influence on object specularity Subdue sun visibility influence on water specularity
This commit is contained in:
parent
2488ecebc5
commit
12abd30e9f
4 changed files with 10 additions and 7 deletions
|
@ -22,6 +22,7 @@
|
|||
Bug #5977: Fatigueless NPCs' corpse underwater changes animation on game load
|
||||
Bug #6025: Subrecords cannot overlap records
|
||||
Bug #6027: Collisionshape becomes spiderweb-like when the mesh is too complex
|
||||
Bug #6190: Unintuitive sun specularity time of day dependence
|
||||
Bug #6222: global map cell size can crash openmw if set to too high a value
|
||||
Bug #6313: Followers with high Fight can turn hostile
|
||||
Bug #6427: Enemy health bar disappears before damaging effect ends
|
||||
|
|
|
@ -702,7 +702,7 @@ namespace MWRender
|
|||
{
|
||||
// need to wrap this in a StateUpdater?
|
||||
mSunLight->setDiffuse(diffuse);
|
||||
mSunLight->setSpecular(specular);
|
||||
mSunLight->setSpecular(osg::Vec4f(specular.x(), specular.y(), specular.z(), specular.w() * sunVis));
|
||||
|
||||
mPostProcessor->getStateUpdater()->setSunColor(diffuse);
|
||||
mPostProcessor->getStateUpdater()->setSunVis(sunVis);
|
||||
|
|
|
@ -789,8 +789,7 @@ namespace MWWorld
|
|||
mRendering.configureFog(
|
||||
mResult.mFogDepth, underwaterFog, mResult.mDLFogFactor, mResult.mDLFogOffset / 100.0f, mResult.mFogColor);
|
||||
mRendering.setAmbientColour(mResult.mAmbientColor);
|
||||
mRendering.setSunColour(
|
||||
mResult.mSunColor, mResult.mSunColor * mResult.mGlareView * glareFade, mResult.mGlareView * glareFade);
|
||||
mRendering.setSunColour(mResult.mSunColor, mResult.mSunColor, mResult.mGlareView * glareFade);
|
||||
|
||||
mRendering.getSkyManager()->setWeather(mResult);
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ const float SCATTER_AMOUNT = 0.3; // amount of sunlight scatter
|
|||
const vec3 SCATTER_COLOUR = vec3(0.0,1.0,0.95); // colour of sunlight scattering
|
||||
|
||||
const vec3 SUN_EXT = vec3(0.45, 0.55, 0.68); //sunlight extinction
|
||||
const float SUN_SPEC_FADING_THRESHOLD = 0.15; // visibility at which sun specularity starts to fade
|
||||
|
||||
const float SPEC_HARDNESS = 256.0; // specular highlights hardness
|
||||
|
||||
|
@ -172,6 +173,8 @@ void main(void)
|
|||
vec3 waterColor = WATER_COLOR * sunFade;
|
||||
|
||||
vec4 sunSpec = lcalcSpecular(0);
|
||||
// alpha component is sun visibility; we want to start fading specularity when visibility is low
|
||||
sunSpec.a = min(1.0, sunSpec.a / SUN_SPEC_FADING_THRESHOLD);
|
||||
|
||||
// artificial specularity to make rain ripples more noticeable
|
||||
vec3 skyColorEstimate = vec3(max(0.0, mix(-0.3, 1.0, sunFade)));
|
||||
|
@ -179,7 +182,7 @@ void main(void)
|
|||
|
||||
#if REFRACTION
|
||||
// no alpha here, so make sure raindrop ripple specularity gets properly subdued
|
||||
rainSpecular *= clamp(fresnel*6.0 + specular * sunSpec.w, 0.0, 1.0);
|
||||
rainSpecular *= clamp(fresnel*6.0 + specular * sunSpec.a, 0.0, 1.0);
|
||||
|
||||
// refraction
|
||||
vec3 refraction = sampleRefractionMap(screenCoords - screenCoordsOffset).rgb;
|
||||
|
@ -200,7 +203,7 @@ void main(void)
|
|||
vec3 scatterColour = mix(SCATTER_COLOUR*vec3(1.0,0.4,0.0), SCATTER_COLOUR, clamp(1.0-exp(-sunHeight*SUN_EXT), 0.0, 1.0));
|
||||
vec3 lR = reflect(lVec, lNormal);
|
||||
float lightScatter = clamp(dot(lVec,lNormal)*0.7+0.3, 0.0, 1.0) * clamp(dot(lR, vVec)*2.0-1.2, 0.0, 1.0) * SCATTER_AMOUNT * sunFade * clamp(1.0-exp(-sunHeight), 0.0, 1.0);
|
||||
gl_FragData[0].xyz = mix( mix(refraction, scatterColour, lightScatter), reflection, fresnel) + specular * sunSpec.xyz + rainSpecular;
|
||||
gl_FragData[0].xyz = mix(mix(refraction, scatterColour, lightScatter), reflection, fresnel) + specular * sunSpec.rgb * sunSpec.a + rainSpecular;
|
||||
gl_FragData[0].w = 1.0;
|
||||
|
||||
// wobbly water: hard-fade into refraction texture at extremely low depth, with a wobble based on normal mapping
|
||||
|
@ -213,8 +216,8 @@ void main(void)
|
|||
shoreOffset = clamp(mix(shoreOffset, 1.0, clamp(linearDepth / WOBBLY_SHORE_FADE_DISTANCE, 0.0, 1.0)), 0.0, 1.0);
|
||||
gl_FragData[0].xyz = mix(rawRefraction, gl_FragData[0].xyz, shoreOffset);
|
||||
#else
|
||||
gl_FragData[0].xyz = mix(reflection, waterColor, (1.0-fresnel)*0.5) + specular * sunSpec.xyz + rainSpecular;
|
||||
gl_FragData[0].w = clamp(fresnel*6.0 + specular * sunSpec.w, 0.0, 1.0); //clamp(fresnel*2.0 + specular * gl_LightSource[0].specular.w, 0.0, 1.0);
|
||||
gl_FragData[0].xyz = mix(reflection, waterColor, (1.0-fresnel)*0.5) + specular * sunSpec.rgb * sunSpec.a + rainSpecular;
|
||||
gl_FragData[0].w = clamp(fresnel*6.0 + specular * sunSpec.a, 0.0, 1.0); //clamp(fresnel*2.0 + specular * gl_LightSource[0].specular.a, 0.0, 1.0);
|
||||
#endif
|
||||
|
||||
gl_FragData[0] = applyFogAtDist(gl_FragData[0], radialDepth, linearDepth, far);
|
||||
|
|
Loading…
Reference in a new issue