mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-17 01:23:51 +00:00
Improve shadow performance: halve resolution, 9x fewer PCF taps, throttle depth pass
- SHADOW_MAP_SIZE 2048→1024: 4x fewer pixels rasterized in depth pass - Replace 9-tap manual PCF loop with single hardware PCF tap in all 4 receiver shaders (terrain.frag, wmo_renderer, m2_renderer, character_renderer). GL_LINEAR + GL_COMPARE_REF_TO_TEXTURE already gives 2×2 bilinear PCF per tap for free, so quality is maintained while doing 9x fewer texture fetches. - Throttle shadow depth pass to every 2 frames; OpenGL depth texture persists between frames so receivers always have a valid shadow map. 1-frame lag at 60 fps is invisible.
This commit is contained in:
parent
7ab25c63c9
commit
c4d0a21713
6 changed files with 14 additions and 35 deletions
|
|
@ -223,7 +223,7 @@ private:
|
|||
void shutdownPostProcess();
|
||||
|
||||
// Shadow mapping
|
||||
static constexpr int SHADOW_MAP_SIZE = 2048;
|
||||
static constexpr int SHADOW_MAP_SIZE = 1024;
|
||||
uint32_t shadowFBO = 0;
|
||||
uint32_t shadowDepthTex = 0;
|
||||
uint32_t shadowShaderProgram = 0;
|
||||
|
|
@ -231,6 +231,7 @@ private:
|
|||
glm::vec3 shadowCenter = glm::vec3(0.0f);
|
||||
bool shadowCenterInitialized = false;
|
||||
bool shadowsEnabled = false;
|
||||
int shadowFrameCounter_ = 0; // throttle: only re-render depth map every 2 frames
|
||||
|
||||
public:
|
||||
void setShadowsEnabled(bool enabled) { shadowsEnabled = enabled; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue