Skip to content

Commit

Permalink
Implement Settings To Control Rendering (#220)
Browse files Browse the repository at this point in the history
  • Loading branch information
datacrystals committed Jun 23, 2022
1 parent 1b02dd6 commit 5189973
Showing 1 changed file with 20 additions and 19 deletions.
39 changes: 20 additions & 19 deletions Source/EditorAssets/Projects/DefaultProject/10041.ERS
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

}



Expand Down

0 comments on commit 5189973

Please sign in to comment.