-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7a5f489
commit c74d37a
Showing
15 changed files
with
134 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#pragma once | ||
|
||
#define SHADER_PATH "src/shaders" | ||
#define SHADER_PATH "src/shaders" | ||
|
||
/* TODO: make dependent on some ENV VAR */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#version 410 core | ||
|
||
layout(triangles, invocations = 16) in; | ||
layout(triangle_strip, max_vertices = 3) out; | ||
|
||
uniform mat4 lightSpaceMatrices[16]; | ||
|
||
void main() | ||
{ | ||
for (int i = 0; i < 3; ++i) | ||
{ | ||
gl_Position = lightSpaceMatrices[gl_InvocationID] * gl_in[i].gl_Position; | ||
gl_Layer = gl_InvocationID; | ||
EmitVertex(); | ||
} | ||
EndPrimitive(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,18 @@ | ||
float shadowCalculation(vec4 sPos, sampler2D shadow){ | ||
float shadowCalculation(vec4 sPos, sampler2DArray shadow, int layer, float bias){ | ||
vec3 projCoords = sPos.xyz / sPos.w; | ||
projCoords = projCoords * 0.5 + 0.5; | ||
float closestDepth = texture(shadow, projCoords.xy).r; | ||
float closestDepth = texture(shadow, vec3(projCoords.xy, layer)).r; | ||
float currentDepth = projCoords.z; | ||
|
||
float bias = 0.005; | ||
float sha = 0.0; | ||
vec2 texelSize = 1.0 / textureSize(shadow, 0); | ||
for(int x = -1; x <= 1; ++x) | ||
{ | ||
for(int y = -1; y <= 1; ++y) | ||
{ | ||
float pcfDepth = texture(shadow, projCoords.xy + vec2(x, y) * texelSize).r; | ||
sha += currentDepth - bias > pcfDepth ? 1.0 : 0.0; | ||
} | ||
vec2 texelSize = 1.0 / textureSize(shadow, 0).xy; | ||
for(int x = -1; x <= 1; ++x){ | ||
for(int y = -1; y <= 1; ++y){ | ||
float pcfDepth = texture(shadow, vec3(projCoords.xy + vec2(x, y) * texelSize, layer)).r; | ||
sha += currentDepth - bias > pcfDepth ? 1.0 : 0.0; | ||
} | ||
} | ||
if(projCoords.z > 1.0) return 0.0; | ||
sha /= 9.0; | ||
return sha; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.