diff --git a/.vs/shader3/v14/.suo b/.vs/shader3/v14/.suo index 5ea8fd8..31c34ae 100644 Binary files a/.vs/shader3/v14/.suo and b/.vs/shader3/v14/.suo differ diff --git a/res/shader/hdr.fs b/res/shader/hdr.fs index 9b73734..f7a23bb 100644 --- a/res/shader/hdr.fs +++ b/res/shader/hdr.fs @@ -22,7 +22,16 @@ float CalculateShadow(){ float depthInShadowMap = texture2D(U_ShadowMap, fragPos.xy).r; float currentDepth = fragPos.z; - float shadow = currentDepth > depthInShadowMap ? 1.0 : 0.0; + + vec2 texelSize = 1.0/textureSize(U_ShadowMap, 0); + float shadow = 0; + for(int y = -1; y < 1; ++y){ + for(int x = -1; x < 1; ++x){ + float pcfDepth = texture2D(U_ShadowMap, fragPos.xy + texelSize * vec2(x,y)).r; + shadow += (currentDepth-0.05) > pcfDepth ? 1.0 : 0.0; + } + } + shadow/=9.0; return shadow; }