1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-02-23 15:05:34 +01:00

#23 fading shadows

This commit is contained in:
XProger 2017-04-24 00:30:53 +03:00
parent 9734a6cc6d
commit a254f2944f

View File

@ -343,13 +343,18 @@ varying vec4 vTexCoord; // xy - atlas coords, zw - caustics coords
} else
rShadow /= 4.0;
return rShadow;
float fade = clamp(dot(vLightVec, vLightVec), 0.0, 1.0);
return rShadow + (1.0 - rShadow) * fade;
}
float getShadow() {
// min(dot(vNormal.xyz, lv), vLightProj.w) > 0.0
// clamp(dot(lv, lv), 2.0), 0.0, 1.0);
return vLightProj.w > 0.0 ? getShadow(vLightProj) : 1.0;
#ifdef TYPE_ROOM
float vis = min(dot(vNormal.xyz, vLightVec), vLightProj.w);
#else
float vis = vLightProj.w;
#endif
return vis > 0.0 ? getShadow(vLightProj) : 1.0;
}
#endif