Ticket #504: shadow_culling_frustum_adjust.patch
File shadow_culling_frustum_adjust.patch, 1.8 KB (added by , 14 years ago) |
---|
-
GameView.cpp
70 70 const float CGameView::defaultFOV = DEGTORAD(20.f); 71 71 const float CGameView::defaultNear = 4.f; 72 72 const float CGameView::defaultFar = 4096.f; 73 const float CGameView::defaultCullFOV = CGameView::defaultFOV + DEGTORAD(6.0f); //add 6 degrees to the default FOV for use with the culling frustum 73 74 74 75 class CGameViewImpl : public CJSObject<CGameViewImpl> 75 76 { … … 310 311 311 312 // This can be uncommented to try getting a bigger frustum.. 312 313 // but then it makes shadow maps too low-detail. 313 //m_CullCamera.SetProjection(1.0f, 10000.0f, DEGTORAD(30)); 314 //m_CullCamera.UpdateFrustum(); 314 // 315 // Xin: I'm not sure what the previous comment is referring to with shadow maps becoming too low-detail, 316 // but one way to fix shadows popping in at the edge of the screen is to widen the culling frustum so that 317 // objects aren't culled as early. The downside is that objects will get rendered even though they appear 318 // off screen, which is somewhat inefficient. A better solution would be to decouple shadow map rendering 319 // from model rendering; as it is now, a shadow map is only rendered if its associated model is to be 320 // rendered. 321 m->CullCamera.SetProjection(defaultNear, defaultFar, defaultCullFOV); 322 m->CullCamera.UpdateFrustum(); 315 323 } 316 324 g_Renderer.SetSceneCamera(m->ViewCamera, m->CullCamera); 317 325 -
GameView.h
42 42 { 43 43 NONCOPYABLE(CGameView); 44 44 public: 45 static const float defaultFOV, default Near, defaultFar;45 static const float defaultFOV, defaultCullFOV, defaultNear, defaultFar; 46 46 47 47 private: 48 48 CGameViewImpl* m;