Skip to content

Fix ped shadows remaining visible at zero alpha - #5270

Open
Dryxio wants to merge 1 commit into
multitheftauto:masterfrom
Dryxio:fix-ped-shadow-alpha
Open

Fix ped shadows remaining visible at zero alpha#5270
Dryxio wants to merge 1 commit into
multitheftauto:masterfrom
Dryxio:fix-ped-shadow-alpha

Conversation

@Dryxio

@Dryxio Dryxio commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix ped shadows remaining visible when the ped's effective alpha is 0.

Before
image

After
image

Motivation

An invisible ped could still be located by its shadow when using:

setElementAlpha(ped, 0)

The shadow should disappear together with the ped and return normally when its alpha is restored.

Test plan

Tested in game on the local player:

ped-shadow-alpha-player-test.zip

  1. Disable dynamic ped shadows to use blob shadows
  2. Use /pedshadow 0
  3. Confirm the player and blob shadow disappear
  4. Use /pedshadow 255
  5. Confirm the player and shadow return
  6. Enable dynamic ped shadows and repeat the same test

Also verified that restoring alpha to 255 recreates the shadow normally.

Checklist

  • Your code should follow the coding guidelines.
  • Smaller pull requests are easier to review. If your pull request is beefy, your pull request should be reviewable commit-by-commit.

MTA applies ped alpha to the RenderWare clump while GTA uses separate visibility and real-time shadow state. This can leave blob and dynamic shadows visible after a ped becomes fully transparent.

Keep native ped visibility synchronized with the effective clump alpha, return existing real-time shadow data immediately, and skip GTA's player-specific blob-shadow submission when the local player is fully transparent.

Tested Game SA and Client Deathmatch Release|Win32. Tested in game on the local player at alpha 0 and 255 with both blob and dynamic ped shadows.
@Dryxio
Dryxio marked this pull request as ready for review August 25, 2026 14:42
@lopezloo

Copy link
Copy Markdown
Member

Should we fix issues like this? Isn't it adding unnecessary complexity? Interiors simply weren't implemented for such features. After all, the main interiorless thing is element collision. If someone wants to hide everything then he should use dimensions.

@dmi7ry

dmi7ry commented Aug 29, 2026

Copy link
Copy Markdown

Should we fix issues like this? Isn't it adding unnecessary complexity? Interiors simply weren't implemented for such features. After all, the main interiorless thing is element collision. If someone wants to hide everything then he should use dimensions.

For example, this is useful when admins are invisible. Other players can see the admin's location by the shadow.

@Dryxio

Dryxio commented Aug 29, 2026

Copy link
Copy Markdown
Contributor Author

Should we fix issues like this? Isn't it adding unnecessary complexity? Interiors simply weren't implemented for such features. After all, the main interiorless thing is element collision. If someone wants to hide everything then he should use dimensions.

I don’t get it. If a player is intentionally made invisible, shouldn’t their shadow be invisible too?

@FileEX FileEX added the bugfix Solution to a bug of any kind label Aug 30, 2026
@lopezloo

Copy link
Copy Markdown
Member

My bad, I thought this PR was about element interior, not opacity.

However, IMO it would be best to also have an scripting function to control whether element casts shadows.

@FileEX

FileEX commented Aug 31, 2026

Copy link
Copy Markdown
Member

What about vehicle shadows?

@Dryxio

Dryxio commented Aug 31, 2026

Copy link
Copy Markdown
Contributor Author

What about vehicle shadows?

I’ll open a separate PR for vehicle shadows if that’s fine

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

Labels

bugfix Solution to a bug of any kind

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants