Add fxAddShadow with custom DX texture support - #5337
Open
Xenius97 wants to merge 1 commit into
Open
Conversation
Member
|
What about #1003 (comment)? |
Contributor
Author
I've used for long hours without any issues, no crashes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds the client-side fxAddShadow Lua function by porting PR #4559.
The implementation originates from work by CrosRoad95 in PR #1003. After the original code was abandoned, it was reassembled and modernized in PR #4559, with known crashes and stability issues addressed.
This version extends that work further by allowing the first argument to be either a built-in shadow name or a live 2D DX texture element:
Position and offset arguments may also be passed as Vector3 and Vector2 values. The function is client-side only and is also available through the
Effect.createShadowOOP alias.The supported built-in textures are:
Custom textures may be created with
dxCreateTexture. Two-dimensional render targets and screen sources are also supported.Each call queues a shadow for one GTA render pass, so
fxAddShadowmust be called every frame, preferably fromonClientPreRender. The queue shares GTA’s native 48-shadow limit and retains its own GPU reference until rendering completes.https://imgur.com/l5s9lYC
Motivation
The original implementation provides a useful way for Lua resources to access GTA: San Andreas’ projected-shadow system, but it was never merged and was eventually left behind.
This PR brings the modernized implementation into the client while preserving the fixes from the previous work. Support for custom DX textures expands its use beyond GTA’s built-in shadows, allowing resources to render custom transparent masks, projected lighting, and similar world effects without requiring separate geometry.
Test plan
fx-shadow-test.zip
Checklist