Skip to content

Fix for shadow rendering and GS Alpha handling for dither effects.#86

Merged
wagrenier merged 2 commits into
Mikompilation:mainfrom
HikikoMarmy:main
Jun 22, 2026
Merged

Fix for shadow rendering and GS Alpha handling for dither effects.#86
wagrenier merged 2 commits into
Mikompilation:mainfrom
HikikoMarmy:main

Conversation

@HikikoMarmy

Copy link
Copy Markdown
Contributor

Dither / finder effects

MikuPan now handles several PS2 GS alpha blend modes explicitly for 2D sprite/effect rendering instead of routing everything through the normal alpha blend path.

This fixes the camera/finder dither effect, which was previously drawn as an overly strong noisy overlay. The finder dither uses GS alpha mode 0x41, equivalent to: (Cd - Cs) * As + Cd

The renderer now supports the relevant GS alpha paths, including normal alpha, additive, subtractive, destination boost, and the destination-minus-source mode used by the finder dither. A small helper shader is used for the destination-alpha contribution needed by the 0x41 approximation.

Shadows

This also fixes several shadow rendering issues:

  • Corrects silhouette/PU header parsing when building the shadow.
  • Fixes the shadow projection/sample orientation.
  • Updates the shadow shader path so the occlusion sample matches the PS2 orientation.

Add GS alpha-aware sprite rendering for effect paths such as finder dither.
Mode 0x41 now uses a two-pass approximation of (Cd - Cs) * As + Cd instead of normal sprite blending, fixing the overly
strong camera fuzz. Also supports additive/subtractive/destination boost modes and restores normal sprite state after special draws.
@wagrenier wagrenier merged commit ff96037 into Mikompilation:main Jun 22, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants