stk-code_catmod/data/shaders/shadow.geom
Vincent Lejeune 934d1f10b8 Shadow: Use Geometry Shader for better perfs.
The 3 cascades are now rendered in a single pass, using 2D array texture and
a GS to do the dispatch ("layered rendering").
It's possible to use instancing instead but it requires the AMD_vertex_shader_layer
extension which is oddly part of opengl 4.2.
2014-02-11 21:07:44 +01:00

25 lines
403 B
GLSL

#version 330 core
uniform mat4 ModelViewProjectionMatrix[3];
layout(triangles) in;
layout(triangle_strip, max_vertices=9) out;
in vec2 tc[3];
out vec2 uv;
void main(void)
{
for (int j = 0; j<3; j++)
{
gl_Layer = j;
for(int i=0; i<3; i++)
{
uv = tc[i];
gl_Position = ModelViewProjectionMatrix[j] * gl_in[i].gl_Position;
EmitVertex();
}
EndPrimitive();
}
}