Skip to content

TARGET_PC Increase real shadow pool from 8 to 16 - #2676

Open
RgeditV1 wants to merge 1 commit into
TwilitRealm:mainfrom
RgeditV1:shadow
Open

RgeditV1 wants to merge 1 commit into
TwilitRealm:mainfrom
RgeditV1:shadow

Conversation

@RgeditV1

@RgeditV1 RgeditV1 commented Oct 1, 2026

Copy link
Copy Markdown

fix: #2653

The real shadow system (dDlst_shadowReal_c) is limited to 8 slots per frame (mReal[8], packed 4-per-channel into mShadowTexObj[2]). Once the pool is full, dDlst_shadowControl_c::setReal evicts the farthest entry in the z-sorted lis or drops the new shadow entirely if it is farther than all existing ones

Because eviction is driven by getCameraZ(), the missing shadows change with the camera angle. With ~8–10 shadowed actors on screen (e.g. NPCs/cats in a scene (even link lost his shadow)), 5+ of them intermittently lose their shadows.

some escenarios

Captura desde 2026-10-01 16-27-55 Captura desde 2026-10-01 16-44-00

include/d/d_drawlist.h:

  • Add REAL_SHADOW_MAX = 16 and REAL_SHADOW_TEX_NUM = REAL_SHADOW_MAX / 4 constants.
  • Resize mReal[8] → mReal[REAL_SHADOW_MAX].
  • Resize mShadowTexObj[2] / mShadowTexData[2] → [REAL_SHADOW_TEX_NUM] (4).

src/d/d_drawlist.cpp:

  • init(): l_realImageSize expanded to REAL_SHADOW_TEX_NUM entries
    ({192, 192, 64, 64} — keeps the original large/small split), loop bound updated.
  • reset(): loop bound 8 → REAL_SHADOW_MAX.
  • setReal(): pool-full check and free-slot scan 8 → REAL_SHADOW_MAX.

Each dDlst_shadowReal_c is ~9.5 KB (mShadowTri[256]), so this adds ~76 KB more or less to
dDlst_shadowControl_c / dDlst_list_c. Acceptable for the fix i think no?

its need more testing, if someone can helpme this is the way

  • Reproduce scene with 10+ shadowed NPCs; all shadows visible regardless of camera angle.
  • Verify no regression in imageDraw texture packing for <8 and 9–16 shadows.
  • Check distance culling path (dVar17 < -1000) still drops far shadows correctly.

Comment thread src/d/d_drawlist.cpp
@PJB3005 PJB3005 added the Visual Graphical mistakes label Oct 8, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Visual Graphical mistakes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Some entities (in this case, cats) don't have shadows.

3 participants