static void RenderSpotLight(MyLightRenderElement lightElement, MyEffectPointLight effectPointLight) { MyRenderLight light = lightElement.Light; //Matrix lightViewProjectionShadow = Matrix.Identity; // Always cull clockwise (render inner parts of object), depth test is done in PS using light radius and cone angle RasterizerState.CullClockwise.Apply(); DepthStencilState.None.Apply(); //m_device.BlendState = BlendState.Additive; //Need to use max because of overshinning places where multiple lights shine MyStateObjects.Light_Combination_BlendState.Apply(); if (lightElement.RenderShadows && lightElement.ShadowMap != null) { m_spotShadowRenderer.SetupSpotShadowBaseEffect(effectPointLight, lightElement.ShadowLightViewProjectionAtZero, lightElement.ShadowMap); } effectPointLight.SetNearSlopeBiasDistance(0); effectPointLight.SetLightPosition((Vector3)(light.Position - MyRenderCamera.Position)); effectPointLight.SetLightIntensity(light.Intensity); effectPointLight.SetSpecularLightColor(light.SpecularColor); effectPointLight.SetFalloff(light.Falloff); effectPointLight.SetLightViewProjection((Matrix)(lightElement.ViewAtZero * lightElement.Projection)); effectPointLight.SetReflectorDirection(light.ReflectorDirection); effectPointLight.SetReflectorConeMaxAngleCos(1 - light.ReflectorConeMaxAngleCos); effectPointLight.SetReflectorColor(light.ReflectorColor); effectPointLight.SetReflectorRange(light.ReflectorRange); effectPointLight.SetReflectorIntensity(light.ReflectorIntensity); effectPointLight.SetReflectorTexture(light.ReflectorTexture); effectPointLight.SetReflectorFalloff(light.ReflectorFalloff); if (lightElement.RenderShadows) { effectPointLight.SetTechnique(effectPointLight.SpotShadowTechnique); } else { effectPointLight.SetTechnique(effectPointLight.SpotTechnique); } MyDebugDraw.DrawConeForLight(effectPointLight, lightElement.World); }