Pass shadowmap size

This commit is contained in:
luboslenco 2018-11-07 13:11:38 +01:00
parent acd7b70975
commit e6c1f2dccc
3 changed files with 17 additions and 2 deletions

View file

@ -108,8 +108,6 @@ vec4 LUTlookup(in vec4 textureColor, in sampler2D lookupTable) {
}
float vignette() {
// vignetting from iq
// return 0.4 + 0.6 * pow(16.0 * texCoord.x * texCoord.y * (1.0 - texCoord.x) * (1.0 - texCoord.y), 0.2);
return 0.3 + 0.7 * pow(16.0 * texCoord.x * texCoord.y * (1.0 - texCoord.x) * (1.0 - texCoord.y), 0.2);
}
@ -272,6 +270,11 @@ void main() {
fragColor.rgb += vec3(mod((mod(x, 13.0) + 1.0) * (mod(x, 123.0) + 1.0), 0.01) - 0.005) * compoGrainStrength;
#endif
#ifdef _CGrainStatic
float x = (texCo.x + 4.0) * (texCo.y + 4.0) * 10.0;
fragColor.rgb += vec3(mod((mod(x, 13.0) + 1.0) * (mod(x, 123.0) + 1.0), 0.01) - 0.005) * 0.09;
#endif
#ifdef _CVignette
fragColor.rgb *= vignette();
#endif

View file

@ -55,6 +55,9 @@ uniform sampler2D gbuffer2;
#ifdef _LightIES
//!uniform sampler2D texIES;
#endif
#ifdef _SMSizeUniform
uniform vec2 smSizeUniform;
#endif
#ifdef _SSS
vec2 lightPlane;
@ -141,7 +144,11 @@ void main() {
if (lightShadow == 1) {
vec4 lPos = LWVP * vec4(p + n * shadowsBias * 10, 1.0);
if (lPos.w > 0.0) {
#ifdef _SMSizeUniform
visibility = shadowTest(shadowMap, lPos.xyz / lPos.w, shadowsBias, smSizeUniform);
#else
visibility = shadowTest(shadowMap, lPos.xyz / lPos.w, shadowsBias, shadowmapSize);
#endif
}
}
else if (lightShadow == 2) { // Cube

View file

@ -115,6 +115,11 @@
"name": "sdftex",
"link": "_sdfTexture",
"ifdef": ["_DFRS"]
},
{
"name": "smSizeUniform",
"link": "_shadowMapSize",
"ifdef": ["_SMSizeUniform"]
}
],
"vertex_shader": "../include/pass_volume.vert.glsl",