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 fab9833 commit 19c713f
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion Source/EditorAssets/Projects/DefaultProject/10041.ERS
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ float PCFSamplerCubemap(float BiasedCurrentDepth, vec3 TexCoords3D, int Index, f

float shadow = 0.0;

/**
float samples = SampleSize;
float offset = 0.025;
for(float x = -offset; x < offset; x += offset / (samples * 0.5))
Expand All @@ -234,6 +235,21 @@ float PCFSamplerCubemap(float BiasedCurrentDepth, vec3 TexCoords3D, int Index, f
}
shadow /= (samples * samples * samples);

**/


int samples = SampleSize*SampleSize;
//float viewDistance = length(viewPos - fragPos);
float diskRadius = 0.01f;//(1.0 + (viewDistance / far_plane)) / 25.0;
for(int i = 0; i < samples; ++i)
{
float closestDepth = texture(DepthMapCubeArray, vec4(TexCoords3D + SampleOffsetDirections[i] * diskRadius, Index)).r;
closestDepth *= ViewDistance; // undo mapping [0;1]
if(BiasedCurrentDepth > closestDepth)
shadow += 1.0;
}
shadow /= float(samples);

return shadow;
}

Expand Down Expand Up @@ -262,6 +278,7 @@ float PoissonSamplerCube(float BiasedCurrentDepth, vec3 TexCoords3D, int Index,

float shadow = 0.0;

/**
float samples = SampleSize;
float offset = 0.025;
int PoissonIndex = 0;
Expand All @@ -280,7 +297,20 @@ float PoissonSamplerCube(float BiasedCurrentDepth, vec3 TexCoords3D, int Index,
}
}
}
shadow /= (samples * samples * samples);
shadow /= (samples * samples * samples);**/

int samples = SampleSize*SampleSize*SampleSize;
for(int i = 0; i < samples; ++i)
{

vec3 PoissonOffset = vec3(Poisson3D[i%16]/150.0f);
float closestDepth = texture(DepthMapCubeArray, vec4(TexCoords3D + PoissonOffset, Index)).r;
closestDepth *= ViewDistance; // undo mapping [0;1]
if(BiasedCurrentDepth > closestDepth)
shadow += 1.0;
}
shadow /= float(samples);


return shadow;

Expand Down Expand Up @@ -880,5 +910,6 @@ void main() {






0 comments on commit 19c713f

Please sign in to comment.