public void RenderForLight(Matrix lightViewProjection, ref BoundingBox lightBoundingBox, Texture shadowRenderTarget, Texture shadowDepth, int spotIndex)
        {
            m_renderElementsForShadows.Clear();
            m_castingRenderObjectsUnique.Clear();

            m_spotFrustum.Matrix = lightViewProjection;

            //MyRender.GetEntitiesFromPrunningStructure(ref lightBoundingBox, m_castingRenderObjects);
            MyRender.GetEntitiesFromShadowStructure(ref lightBoundingBox, m_castingRenderObjects);

            foreach (MyElement element in m_castingRenderObjects)
            {
                MyRenderObject renderObject = (MyRenderObject)element;
                MyEntity       entity       = ((MyRenderObject)element).Entity;

                if (entity != null)
                {
                    if (entity is MyVoxelMap)
                    {
                        // Changed m_castersBox to lightBoundingBox, should work
                        //(entity as MyVoxelMap).GetRenderElementsForShadowmap(m_renderElementsForShadows, ref lightBoundingBox, m_spotFrustum, MyLodTypeEnum.LOD0, false);
                        (entity as MyVoxelMap).GetRenderElementsForShadowmap(m_renderElementsForShadows, renderObject.RenderCellCoord.Value, MyLodTypeEnum.LOD0, false);
                    }
                    else
                    {
                        if (entity.ModelLod0 != null)
                        {
                            MyRender.CollectRenderElementsForShadowmap(m_renderElementsForShadows, m_transparentRenderElementsForShadows, entity, entity.ModelLod0);
                        }
                    }
                }
            }

            // Set our targets
            MyMinerGame.SetRenderTarget(shadowRenderTarget, shadowDepth);
            MyMinerGame.Static.GraphicsDevice.Clear(ClearFlags.All, new ColorBGRA(1.0f), 1.0f, 0);

            DepthStencilState.Default.Apply();
            RasterizerState.CullNone.Apply();
            BlendState.Opaque.Apply();

            RenderShadowMap(lightViewProjection);

            MyRender.TakeScreenshot("ShadowMapSpot", shadowRenderTarget, MyEffectScreenshot.ScreenshotTechniqueEnum.Color);
        }