Stabilize foliage shadows and smooth motion transitions

- keep shadow projection center fixed while moving to remove per-frame projection churn flicker

- replace delayed post-move catch-up with immediate stop transition and idle smoothing

- rework foliage shadow caster motion to use blended phase-shifted UV samples for continuous position transitions

- reduce high-frequency foliage threshold popping by removing threshold warping path

- sharpen terrain receive filtering with tuned 5-tap PCF weights/offset for more detailed shadows

- raise shadow map resolution to 1536 and keep light-space texel snapping for stable sampling

- set shadows enabled by default and lower global shadow strength from 0.65 to 0.62

- keep foliage animation speed consistent between moving and idle at 80%
This commit is contained in:
Kelsi 2026-02-21 02:23:08 -08:00
parent 1003b25ff4
commit 7717ab8d6b
8 changed files with 111 additions and 54 deletions

View file

@ -101,6 +101,7 @@ struct M2ModelGPU {
bool isSmoke = false; // True for smoke models (UV scroll animation)
bool isSpellEffect = false; // True for spell effect models (skip particle dampeners)
bool disableAnimation = false; // Keep foliage/tree doodads visually stable
bool shadowWindFoliage = false; // Apply wind sway in shadow pass for foliage/tree cards
bool hasTextureAnimation = false; // True if any batch has UV animation
// Particle emitter data (kept from M2Model)

View file

@ -235,15 +235,15 @@ private:
void shutdownPostProcess();
// Shadow mapping
static constexpr int SHADOW_MAP_SIZE = 1024;
static constexpr int SHADOW_MAP_SIZE = 1536;
uint32_t shadowFBO = 0;
uint32_t shadowDepthTex = 0;
uint32_t shadowShaderProgram = 0;
glm::mat4 lightSpaceMatrix = glm::mat4(1.0f);
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
bool shadowsEnabled = true;
int shadowPostMoveFrames_ = 0; // transition marker for movement->idle shadow recenter
public:
void setShadowsEnabled(bool enabled) { shadowsEnabled = enabled; }