Skip to content

Fix transparency regression for draw-last DFFs with active alpha test - #5174

Open
compromissado wants to merge 1 commit into
multitheftauto:masterfrom
compromissado:fix-draw-last-dff-alpha
Open

Fix transparency regression for draw-last DFFs with active alpha test#5174
compromissado wants to merge 1 commit into
multitheftauto:masterfrom
compromissado:fix-draw-last-dff-alpha

Conversation

@compromissado

Copy link
Copy Markdown

Summary

Restores the dual-pass transparency behavior used in release/1.6.0 for blended 3D primitives that write to the depth buffer.

In 1.7, the #5006 change skips the second transparency pass when alpha test is enabled with ALPHAREF > 2. This can cause incorrect transparency and lighting in custom draw_last DFF models that use soft texture alpha.

This removes that alpha-test gate from both primitive draw paths:

  • CDirect3DEvents9::OnDrawPrimitive
  • CDirect3DEvents9::OnDrawIndexedPrimitive

The existing constraints remain unchanged: the dual pass still only applies to blended, depth-writing, non-PositionT 3D draws. HUD and screen-space rendering remain excluded.

Reproduction

Load a custom DFF with smooth/partial texture alpha and enable its transparency:

engineReplaceModel(dff, modelId, true)

--additional
engineSetModelFlag(modelId, "draw_last", true)
engineSetModelFlag(modelId, "additive", true)

With alpha test active, the #5006 condition prevents the second transparency pass, causing the rendering regression shown below.

Before

image

After

mta-screen_2026-08-10_18-41-14

Testing

Built Release|Win32 successfully.

Tested in-game with a custom model using alpha transparency.

Confirmed that the interior no longer exhibits the transparency/lighting regression.
Restores the same dual-pass decision rule used by the latest release/1.6.0 branch.

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.

1 participant