Continue work on shadow rendering

This commit is contained in:
2023-03-14 11:20:38 +00:00
parent 9947979b52
commit 6af041bb8c
20 changed files with 417 additions and 380 deletions
+10 -8
View File
@@ -4,12 +4,14 @@ uniform vec4 lumRad;
uniform sampler2D screenTexture;
in vec2 vTexPos;
out vec4 fColor;
void main()
{
vec3 distVec = texture(screenTexture,vTexPos).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);
float rad = lumRad.a;
void main() {
vec3 distVec = texture(screenTexture, vTexPos).xyz - lightPos;
float dist = dot(distVec, distVec);
if (dist > rad) {
discard;
}
float x = 1 - dist / rad;
vec3 c = (x * x * x) * lumRad.rgb;
fColor = vec4(c, 0);
}