Original Post
So I am trying to decide how I want to store the shadow map data for various kinds of lights in the GPU memory.
The way I see it I can either:
1. Generate an individual texture for each light.
2. Generate a texture array for each light (i.e. a global, directional light uses a texture array of length 4 for the 4 cascaded shadow
maps, a point light uses a texture array of length 6 for all the different directions, a spot light uses an array of length 1, etc.)
3. Generate a single, massive texture array, lights reference it by index.
My intuition tells me that 2 might be the best option because it would be easier to create and destroy new lights, but on the other hand, a nice thing about 3 is that I can dynamically assign shadow maps to lights depending on proximity of lights to the viewer; so as the camera moves, nearby lights are assigned available shadow maps, and distant lights give up their shadow maps. Also, if this array size is fixed, it avoids repeated loading and unloading of texture data, and fixes a clear limit on the number of shadow renders, and the size of shadow map data in memory.
What do you all think?
The way I see it I can either:
1. Generate an individual texture for each light.
2. Generate a texture array for each light (i.e. a global, directional light uses a texture array of length 4 for the 4 cascaded shadow
maps, a point light uses a texture array of length 6 for all the different directions, a spot light uses an array of length 1, etc.)
3. Generate a single, massive texture array, lights reference it by index.
My intuition tells me that 2 might be the best option because it would be easier to create and destroy new lights, but on the other hand, a nice thing about 3 is that I can dynamically assign shadow maps to lights depending on proximity of lights to the viewer; so as the camera moves, nearby lights are assigned available shadow maps, and distant lights give up their shadow maps. Also, if this array size is fixed, it avoids repeated loading and unloading of texture data, and fixes a clear limit on the number of shadow renders, and the size of shadow map data in memory.
What do you all think?