Cube Map Sampling
I'm currently attempting to implement omnidirectional shadow maps, and I've gotten to the stage where I am ready to create the necessary shaders.
However, one problem I have is how do I calculate which face I have to sample? I'm rather new to cube maps, so all I know is that I need to supply it with a vec4.
I attempted to re-use the method that I'm using to calculate the direction of a ray leaving the player camera (normalize the lightPosition - vertexPosition), but this doesn't seem to work.
Finally, as a secondary question, I've also read about samplerCubeShadow on the OpenGL wiki, does this provide any benefits over the default cube map sampler?
Thanks for the help!
In traditional cube map sampling you don't provide a face, you provide a 3D vector describing a direction from the center of the cube to select a texel when fetching. That means you practically simply have to transform the vertex position into the light's space, interpolate it and use that vector as the texture coordinates for the cube map lookup.
Disclaimer: This is my personal profile. Whatever I write here is my personal opinion and none of my statements or speculations are anyhow related to my employer and as such should not be treated as accurate or valid and in no case should those be considered to represent the opinions of my employer.
Technical Blog: http://www.rastergrid.com/blog/