From 518997394e159fb51aaff5cb6bdbd2ce91c0d1d8 Mon Sep 17 00:00:00 2001 From: datacrystals Date: Thu, 23 Jun 2022 12:09:14 +0000 Subject: [PATCH] Implement Settings To Control Rendering (#220) --- .../Projects/DefaultProject/10041.ERS | 39 ++++++++++--------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/Source/EditorAssets/Projects/DefaultProject/10041.ERS b/Source/EditorAssets/Projects/DefaultProject/10041.ERS index 661777b321..da871dfff8 100644 --- a/Source/EditorAssets/Projects/DefaultProject/10041.ERS +++ b/Source/EditorAssets/Projects/DefaultProject/10041.ERS @@ -238,6 +238,26 @@ float PCFSamplerCubemap(float BiasedCurrentDepth, vec3 TexCoords3D, int Index, f } +float PoissonSampler(float Bias, vec3 ProjCoords, int Index, float CurrentDepth, int SampleSize) { + + float shadow = 0.0f; + vec2 texelSize = 1.0f / textureSize(DepthMapArray, 0).xy; + + for(int x = -SampleSize; x <= SampleSize; ++x) + { + for(int y = -SampleSize; y <= SampleSize; ++y) + { + vec2 TexCoords2D = ProjCoords.xy + (vec2(x, y) * texelSize); + int index = int(x*y)%16; + float pcfDepth = texture(DepthMapArray, vec3(TexCoords2D + PoissonDisk[index]/700.0f, Index)).r; + shadow += CurrentDepth - Bias > pcfDepth ? 1.0f : 0.0f; + } + } + shadow /= (SampleSize*2)*(SampleSize*2); + return shadow; + +} + float PoissonSamplerCube(float BiasedCurrentDepth, vec3 TexCoords3D, int Index, float ViewDistance, int SampleSize) { float shadow = 0.0; @@ -288,25 +308,6 @@ float StratifiedPoissonSampler(float Bias, vec3 ProjCoords, int Index, float Cur } -float PoissonSampler(float Bias, vec3 ProjCoords, int Index, float CurrentDepth, int SampleSize) { - - float shadow = 0.0f; - vec2 texelSize = 1.0f / textureSize(DepthMapArray, 0).xy; - - for(int x = -SampleSize; x <= SampleSize; ++x) - { - for(int y = -SampleSize; y <= SampleSize; ++y) - { - vec2 TexCoords2D = ProjCoords.xy + (vec2(x, y) * texelSize); - int index = int(x*y)%16; - float pcfDepth = texture(DepthMapArray, vec3(TexCoords2D + PoissonDisk[index]/700.0f, Index)).r; - shadow += CurrentDepth - Bias > pcfDepth ? 1.0f : 0.0f; - } - } - shadow /= (SampleSize*2)*(SampleSize*2); - return shadow; - -}