1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-01 16:15:36 +00:00

some potential compability fixes

This commit is contained in:
scrawl 2012-07-25 23:53:06 +02:00
parent 3feb4ce61b
commit 37c7becb07
3 changed files with 23 additions and 19 deletions

View file

@ -192,7 +192,7 @@
#if SHADOWS || SHADOWS_PSSM #if SHADOWS || SHADOWS_PSSM
float fadeRange = shadowFar_fadeStart.x - shadowFar_fadeStart.y; float fadeRange = shadowFar_fadeStart.x - shadowFar_fadeStart.y;
float fade = 1-((depthPassthrough - shadowFar_fadeStart.y) / fadeRange); float fade = 1-((depthPassthrough - shadowFar_fadeStart.y) / fadeRange);
shadow = (depthPassthrough > shadowFar_fadeStart.x) ? 1 : ((depthPassthrough > shadowFar_fadeStart.y) ? 1-((1-shadow)*fade) : shadow); shadow = (depthPassthrough > shadowFar_fadeStart.x) ? 1.0 : ((depthPassthrough > shadowFar_fadeStart.y) ? 1.0-((1.0-shadow)*fade) : shadow);
#endif #endif
#if !SHADOWS && !SHADOWS_PSSM #if !SHADOWS && !SHADOWS_PSSM
@ -205,13 +205,12 @@
#if UNDERWATER #if UNDERWATER
float3 worldPos = shMatrixMult(worldMatrix, float4(objSpacePositionPassthrough,1)).xyz; float3 worldPos = shMatrixMult(worldMatrix, float4(objSpacePositionPassthrough,1)).xyz;
float3 waterEyePos = float3(1,1,1); float3 waterEyePos = float3(1,1,1);
if (worldPos.y < waterLevel && waterEnabled == 1) // NOTE: this calculation would be wrong for non-uniform scaling
{ float4 worldNormal = shMatrixMult(worldMatrix, float4(normal.xyz, 0));
// NOTE: this calculation would be wrong for non-uniform scaling waterEyePos = intercept(worldPos, cameraPos.xyz - worldPos, float3(0,1,0), waterLevel);
float4 worldNormal = shMatrixMult(worldMatrix, float4(normal.xyz, 0)); caustics = getCaustics(causticMap, worldPos, waterEyePos.xyz, worldNormal.xyz, lightDirectionWS0.xyz, waterLevel, waterTimer, windDir_windSpeed);
waterEyePos = intercept(worldPos, cameraPos.xyz - worldPos, float3(0,1,0), waterLevel); if (worldPos.y >= waterLevel || waterEnabled != 1)
caustics = getCaustics(causticMap, worldPos, waterEyePos.xyz, worldNormal.xyz, lightDirectionWS0.xyz, waterLevel, waterTimer, windDir_windSpeed); caustics = float3(1,1,1);
}
#endif #endif

View file

@ -36,12 +36,16 @@ float pssmDepthShadow (
{ {
float shadow; float shadow;
float pcf1 = depthShadowPCF(shadowMap0, lightSpacePos0, invShadowmapSize0);
float pcf2 = depthShadowPCF(shadowMap1, lightSpacePos1, invShadowmapSize1);
float pcf3 = depthShadowPCF(shadowMap2, lightSpacePos2, invShadowmapSize2);
if (depth < pssmSplitPoints.x) if (depth < pssmSplitPoints.x)
shadow = depthShadowPCF(shadowMap0, lightSpacePos0, invShadowmapSize0); shadow = pcf1;
else if (depth < pssmSplitPoints.y) else if (depth < pssmSplitPoints.y)
shadow = depthShadowPCF(shadowMap1, lightSpacePos1, invShadowmapSize1); shadow = pcf2;
else else
shadow = depthShadowPCF(shadowMap2, lightSpacePos2, invShadowmapSize2); shadow = pcf3;
return shadow; return shadow;
} }

View file

@ -224,13 +224,14 @@
float3 worldPos = shMatrixMult(worldMatrix, float4(objSpacePosition,1)).xyz; float3 worldPos = shMatrixMult(worldMatrix, float4(objSpacePosition,1)).xyz;
float3 waterEyePos = float3(1,1,1); float3 waterEyePos = float3(1,1,1);
if (worldPos.y < waterLevel) // NOTE: this calculation would be wrong for non-uniform scaling
{ float4 worldNormal = shMatrixMult(worldMatrix, float4(normal.xyz, 0));
// NOTE: this calculation would be wrong for non-uniform scaling waterEyePos = intercept(worldPos, cameraPos.xyz - worldPos, float3(0,1,0), waterLevel);
float4 worldNormal = shMatrixMult(worldMatrix, float4(normal.xyz, 0)); caustics = getCaustics(causticMap, worldPos, waterEyePos.xyz, worldNormal.xyz, lightDirectionWS0.xyz, waterLevel, waterTimer, windDir_windSpeed);
waterEyePos = intercept(worldPos, cameraPos.xyz - worldPos, float3(0,1,0), waterLevel); if (worldPos.y >= waterLevel)
caustics = getCaustics(causticMap, worldPos, waterEyePos.xyz, worldNormal.xyz, lightDirectionWS0.xyz, waterLevel, waterTimer, windDir_windSpeed); caustics = float3(1,1,1);
}
#endif #endif
@ -285,7 +286,7 @@
#if SHADOWS || SHADOWS_PSSM #if SHADOWS || SHADOWS_PSSM
float fadeRange = shadowFar_fadeStart.x - shadowFar_fadeStart.y; float fadeRange = shadowFar_fadeStart.x - shadowFar_fadeStart.y;
float fade = 1-((depth - shadowFar_fadeStart.y) / fadeRange); float fade = 1-((depth - shadowFar_fadeStart.y) / fadeRange);
shadow = (depth > shadowFar_fadeStart.x) ? 1 : ((depth > shadowFar_fadeStart.y) ? 1-((1-shadow)*fade) : shadow); shadow = (depth > shadowFar_fadeStart.x) ? 1.0 : ((depth > shadowFar_fadeStart.y) ? 1.0-((1.0-shadow)*fade) : shadow);
#endif #endif
#if !SHADOWS && !SHADOWS_PSSM #if !SHADOWS && !SHADOWS_PSSM