Work on geometry shader based shadows

This commit is contained in:
2023-03-11 22:59:19 +00:00
parent 5724a0543e
commit 7ee3f6581d
18 changed files with 235 additions and 144 deletions
+4 -3
View File
@@ -8,14 +8,15 @@ uniform int lightID;
vec3 lightPos = posBool[lightID].xyz;
vec4 lumRad = colRad[lightID];
uniform sampler2D screenTexture;
in vec2 vTexPos;
in vec2 gTexPos;
out vec4 fColor;
void main()
{
vec3 distVec = texture(screenTexture,vTexPos).xyz - lightPos;
vec3 distVec = texture(screenTexture,gTexPos).xyz - lightPos;
float dist = dot(distVec,distVec);
if (dist > lumRad.a) {discard;}
float x = 1 - dist / lumRad.a ;
vec3 c = (x * x * x) * lumRad.rgb ;
fColor = vec4(c,0);
//fColor = vec4(c,0);
fColor = vec4(1,0,0,0);
}