Work on lightmaps, add file
This commit is contained in:
@@ -7,16 +7,30 @@ layout (std140, binding = 1) uniform LightsBlock
|
||||
//uniform int lightID;
|
||||
vec3 lightPos = posBool[gl_Layer].xyz;
|
||||
vec4 lumRad = colRad[gl_Layer];
|
||||
uniform sampler2D screenTexture;
|
||||
layout (binding = 0) uniform sampler2D screenTexture;
|
||||
layout (binding = 1) uniform sampler2D normals;
|
||||
in vec2 gTexPos;
|
||||
out vec4 fColor;
|
||||
void main()
|
||||
{
|
||||
float rad = lumRad.a;
|
||||
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(0.05,0,0,0);
|
||||
// float x = 1 - dist / lumRad.a ;
|
||||
// vec3 c = (x * x * x) * lumRad.rgb ;
|
||||
// fColor = vec4(c,0);
|
||||
// //fColor = vec4(0.05,0,0,0);
|
||||
vec4 normbit = texture(normals, gTexPos);
|
||||
vec3 norm = normbit.xyz;
|
||||
float y1 = dot(normalize(norm), normalize(distVec));
|
||||
float y2 = float(y1 > 0 ? 1 : 0);
|
||||
//float y3 = clamp(0.5 * (y1 + 1),0,1) ;
|
||||
float y3 = clamp(2*y1 + 1,0,1) ;
|
||||
//float y3 = clamp(0.5 * (y1 + 2),0,1) ;
|
||||
//float y = float(normbit.w == 0 ? y3 : y2);
|
||||
float y = y2;
|
||||
float x = 1 - dist / rad;
|
||||
vec3 c = y* (x * x * x) * lumRad.rgb;
|
||||
fColor = vec4(c, 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user