Add alternate shadow volume rendering pathway (layered geo)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#version 450 core
|
||||
layout (triangles) in;
|
||||
layout (invocations = 20) in;
|
||||
layout (triangle_strip, max_vertices = 3) out;
|
||||
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
|
||||
layout (std140, binding = 1) uniform LightsBlock
|
||||
@@ -7,8 +8,7 @@ layout (std140, binding = 1) uniform LightsBlock
|
||||
vec4 posBool[20];
|
||||
vec4 colRad[20];
|
||||
} ;
|
||||
uniform int lightID;
|
||||
vec3 lightPos = posBool[lightID].xyz ;
|
||||
vec3 lightPos = posBool[gl_InvocationID].xyz ;
|
||||
float theBool = posBool[gl_InvocationID].w;
|
||||
// this code is duplicated in lineShadow.geom, should not be changed on its own
|
||||
vec4 projNear (vec4 pos)
|
||||
@@ -35,8 +35,11 @@ void main()
|
||||
{
|
||||
// the front cap
|
||||
vec4 v1 = vec4 (0,0,1,0) ;
|
||||
gl_Layer = gl_InvocationID;
|
||||
gl_Position = theMat * projNear(p0); EmitVertex();
|
||||
gl_Layer = gl_InvocationID;
|
||||
gl_Position = theMat * projNear(p1); EmitVertex();
|
||||
gl_Layer = gl_InvocationID;
|
||||
gl_Position = theMat * projNear(p2); EmitVertex();
|
||||
EndPrimitive();
|
||||
}
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
#version 450 core
|
||||
layout (location = 0) in vec3 position;
|
||||
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
|
||||
uniform vec3 lightPos;
|
||||
uniform vec4 lumRad;
|
||||
out vec3 dField;
|
||||
out vec3 lum;
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position,1);
|
||||
|
||||
@@ -4,9 +4,9 @@ layout (std140, binding = 1) uniform LightsBlock
|
||||
vec4 posBool[20];
|
||||
vec4 colRad[20];
|
||||
} ;
|
||||
uniform int lightID;
|
||||
vec3 lightPos = posBool[lightID].xyz;
|
||||
vec4 lumRad = colRad[lightID];
|
||||
//uniform int lightID;
|
||||
vec3 lightPos = posBool[gl_Layer].xyz;
|
||||
vec4 lumRad = colRad[gl_Layer];
|
||||
uniform sampler2D screenTexture;
|
||||
in vec2 gTexPos;
|
||||
out vec4 fColor;
|
||||
@@ -17,6 +17,6 @@ void main()
|
||||
if (dist > lumRad.a) {discard;}
|
||||
float x = 1 - dist / lumRad.a ;
|
||||
vec3 c = (x * x * x) * lumRad.rgb ;
|
||||
//fColor = vec4(c,0);
|
||||
fColor = vec4(1,0,0,0);
|
||||
fColor = vec4(c,0);
|
||||
//fColor = vec4(0.05,0,0,0);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#version 450 core
|
||||
layout (triangles) in;
|
||||
layout (triangle_strip, max_vertices = 3) out;
|
||||
layout (points) in;
|
||||
layout (triangle_strip, max_vertices = 4) out;
|
||||
layout (invocations = 20) in;
|
||||
layout (std140, binding = 1) uniform LightsBlock
|
||||
{
|
||||
@@ -8,18 +8,26 @@ layout (std140, binding = 1) uniform LightsBlock
|
||||
vec4 colRad[20];
|
||||
} ;
|
||||
float theBool = posBool[gl_InvocationID].w;
|
||||
in vec2 vTexPos[];
|
||||
out vec2 gTexPos;
|
||||
void main()
|
||||
{
|
||||
if (theBool == 1){
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
gTexPos = vTexPos[i];
|
||||
gTexPos = vec2(0,1);
|
||||
gl_Position = vec4(-1,1,0,1) ;
|
||||
gl_Layer = gl_InvocationID;
|
||||
EmitVertex();
|
||||
gTexPos = vec2(0,0);
|
||||
gl_Position = vec4(-1,-1,0,1) ;
|
||||
gl_Layer = gl_InvocationID;
|
||||
EmitVertex();
|
||||
gTexPos = vec2(1,1);
|
||||
gl_Position = vec4(1,1,0,1) ;
|
||||
gl_Layer = gl_InvocationID;
|
||||
EmitVertex();
|
||||
gTexPos = vec2(1,0);
|
||||
gl_Position = vec4(1,-1,0,1) ;
|
||||
gl_Layer = gl_InvocationID;
|
||||
gl_Position = gl_in[i].gl_Position;
|
||||
EmitVertex();
|
||||
}
|
||||
EndPrimitive();
|
||||
}else {}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
#version 450 core
|
||||
layout (location = 0) in vec2 pos;
|
||||
layout (location = 1) in vec2 texPos;
|
||||
out vec2 vTexPos;
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(pos,0,1);
|
||||
vTexPos = texPos;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user