Question

I'm doing omni directional shadow mapping and one thing I cannot grasp is during the lighting stage, how does one get the vector to use in sampling the cubemap?

In the shadow pass I just use the depth values, so I need to be in the same space now. But how do I know which of the six view matrices to use (as it is one for each face) to convert the world space position into the NDC space?

For example, using this as a reference, looking at the fragment shader there is a "light_view_matrix" - but what is it? Light view matrix... of what face? I generated one for each face during shadow pass.

Was it helpful?

Solution

There is actually a very in-depth tutorial on shadow mapping with the programmable pipeline, check out Tutorial 16: Shadow mapping

A quote on the site about Point lights:

Point lights

Same thing, but with depth cubemaps. A cubemap is a set of 6 textures, one on each side of >a cube; what’s more, it is not accessed with standard UV coordinates, but with a 3D vector >representing a direction.

The depth is stored for all directions in space, which make possible for shadows to be >cast all around the point light.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top