Shadowmap first phase and shaders
Posted
by
KaiserJohaan
on Game Development
See other posts from Game Development
or by KaiserJohaan
Published on 2013-11-11T10:05:00Z
Indexed on
2013/11/11
10:28 UTC
Read the original article
Hit count: 253
I am using OpenGL 3.3 and am tryin to implement shadow mapping using cube maps. I have a framebuffer with a depth attachment and a cube map texture.
My question is how to design the shaders for the first pass, when creating the shadowmap.
This is my vertex shader:
in vec3 position;
uniform mat4 lightWVP;
void main()
{
gl_Position = lightWVP * vec4(position, 1.0);
}
Now, do I even need a fragment shader in this shader pass? from what I understand after reading http://www.opengl.org/wiki/Fragment_Shader, by default gl_FragCoord.z
is written to the currently attached depth component (to which my cubemap texture is bound to).
Thus I shouldnt even need a fragment shader for this pass and from what I understand, there is no other work to do in the fragment shader other than writing this value.
Is this correct?
© Game Development or respective owner