Vertex pull fullscreen lighting texture shader
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
#version 450 core
|
||||
layout(early_fragment_tests) in;
|
||||
layout(location=0)uniform vec3 lightPos;
|
||||
layout(location=1)uniform vec4 lumRad;
|
||||
layout (std140, binding = 1) uniform TheLight { vec4 lightPos; vec4 lumRad; };
|
||||
layout (binding = 0) uniform sampler2D screenTexture;
|
||||
layout (binding = 1) uniform sampler2D normals;
|
||||
in vec2 vTexPos;
|
||||
@@ -9,18 +8,18 @@ out vec4 fColor;
|
||||
float rad = lumRad.a;
|
||||
void main() {
|
||||
vec3 pos = texture(screenTexture, vTexPos).xyz;
|
||||
vec3 distVec = pos - lightPos;
|
||||
vec3 distVec = pos - lightPos.xyz;
|
||||
float dist = dot(distVec, distVec);
|
||||
if (dist > rad) {
|
||||
discard;
|
||||
}
|
||||
vec4 normbit = texture(normals, vTexPos);
|
||||
vec3 norm = normbit.xyz;
|
||||
// if (dist > rad) {
|
||||
// discard;
|
||||
// }
|
||||
vec3 norm = texture(normals, vTexPos).xyz;
|
||||
float y1 = dot(norm, distVec);
|
||||
float y2 = float(y1 > 0 ? 1 : 0);
|
||||
float x = 1 - (pow(dist / rad,4));
|
||||
//float x = 1 - (dist / rad);
|
||||
//float x = 1;
|
||||
//float x = (dist > rad ? 0 : 1);
|
||||
vec3 c = y2* x * lumRad.rgb;
|
||||
fColor = vec4(c, 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user