Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

New effect function fxAddShadow #1003

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
CrosRoad95 wants to merge 791 commits into multitheftauto:master from CrosRoad95:fxAddShadow
Closed

New effect function fxAddShadow #1003

CrosRoad95 wants to merge 791 commits into multitheftauto:master from CrosRoad95:fxAddShadow

Conversation

@CrosRoad95
Copy link

@CrosRoad95 CrosRoad95 commented Jun 19, 2019
edited by patrikjuvonen
Loading

syntax:

bool fxAddShadow ( [ string shadowType, ] Vector3 position, Vector2 offsetA, Vector2 offsetB [, int color = 0x80FFFFFF, float zDistance = 4, bool drawOnWater = false, bool drawOnBuildings = true ] )

Must be used in render function like other dx functions, works better in PreRender ( avoid 1 frame lag )
returns nil if arguments are invalid, or false if limit of up to 48 shadows reach. size of shadow should not be greater than 64x64 units. the more shadows in the larger size, they started to be less precise.

if shadowType skipped, plain color will used
they are small graphical glitches at connetion of triangles

  • zDistance - how far below shadow will looking for collision
  • drawOnWater - seems to not working properly
  • drawOnBuildings - increese amount of objects which supports shadows
  • offsetA/B - are defining size of shadow, typicaly -X, 0, 0, X is shadow X units in all 4 direction
  • color - if you don't know, back to school

All allowed shadows types are below

Example script:

shadows = {"car", "ped", "heli", "bike", "rcbaron", "explosion", "headlight1", "headlight2", "blood", "headman", "wincrack", "lamp"}
addEventHandler( "onClientPreRender", root, function()
 x,y,z = getElementPosition(localPlayer)
 fxAddShadow(x,y,z, -1, 0, 0, 1, tocolor(255,0,0,128), 10, false, true)
 for i,v in ipairs(shadows)do
 fxAddShadow(v,2331.64697 - i * 2.5, -1658.43030, 13.43058, -1, 0, 0, 1, tocolor(255,255,255,255), 10, false, true)
 end
end)

Screenshots:
image
image
image

image
"car", "ped", "heli", "bike", "rcbaron", "explosion", "headlight1", "headlight2", "blood", "headman", "wincrack", "lamp" from left to right

theSarrum, lex128, patrikjuvonen, salwador, dtpfl, jey-banned, tederis, XaskeL, PlatinMTA, Shuubaru, and 7 more reacted with thumbs up emoji
Copy link

Einheit-101 commented Jun 21, 2019
edited by qaisjp
Loading

drawOnWater may work if you apply a shader to the water which enables depth buffer usage.

technique simple
{
 pass P0
 {
		ZEnable = true;
		ZWriteEnable = true;
		ZFunc = 4;
		DepthBias = 0.000001;
		SlopeScaleDepthBias = 2;
 }
}

@patrikjuvonen patrikjuvonen added the enhancement New feature or request label Jun 21, 2019
Copy link
Author

i fixed conflicts and i'm waiting for marge

StrixG reacted with eyes emoji

@qaisjp qaisjp added this to the 1.6 milestone Oct 14, 2019
Copy link
Contributor

@qaisjp qaisjp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work overall, good job. I've left a few comments.

Also some files affect all line endings - please can you fix? If you don't know how, I can try to document instructions when I find the time. Just let me know.

Copy link
Author

Make an tutorial how to fix line endings and pin up somewhere future

Copy link
Author

fixed again, unteaded due #1122

Copy link
Contributor

qaisjp commented Mar 14, 2020
edited
Loading

#1122 is resolved, please can you test this? and resolve conversations for the bits above that you've done

@qaisjp qaisjp added the feedback Further information is requested label Mar 14, 2020
Copy link
Contributor

@qaisjp qaisjp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice PR. here's some changes for you.

Comment on lines 30 to 31
m_textureMap[eShadowType::PLANE] = new RwTexture();
}
Copy link

@ghost ghost Apr 20, 2020
edited by ghost
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can crash the program. You don't allocate memory for Rw textures using the new operator. You have to use RwTextureCreate. I want to know where you are deleting this texture? It looks like this will cause a memory leak.

Copy link
Author

@CrosRoad95 CrosRoad95 Dec 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont know how properly use wrcreatetexture, and current code doesnt crash

@qaisjp qaisjp modified the milestones: 1.5.8, 1.6 Apr 20, 2020
Copy link
Contributor

buepas commented Jun 8, 2020

What's the current state of this @CrosRoad95 ?

Copy link
Author

after some updates, it starts crashing almost all time

@patrikjuvonen patrikjuvonen marked this pull request as draft January 16, 2021 22:54
@patrikjuvonen patrikjuvonen marked this pull request as ready for review January 17, 2021 10:44
@patrikjuvonen patrikjuvonen removed their request for review September 25, 2022 11:25
@patrikjuvonen patrikjuvonen removed the feedback Further information is requested label Apr 8, 2023
@patrikjuvonen patrikjuvonen marked this pull request as draft April 8, 2023 09:10
@patrikjuvonen patrikjuvonen added the feedback Further information is requested label Apr 8, 2023
MTABot and others added 18 commits September 17, 2023 15:51
Copy link
Member

botder commented Sep 19, 2023

The changes seem fine, but you have translation commits in the branch and pull request now.

@botder botder removed the feedback Further information is requested label Sep 19, 2023
Copy link
Author

updated

Copy link
Member

botder commented Sep 20, 2023

The changes for the translation files are still there.

Copy link
Author

The changes for the translation files are still there.

fixed

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

Reviewers

@tederis tederis tederis left review comments

@botder botder botder requested changes

+4 more reviewers

@qaisjp qaisjp qaisjp requested changes

@SDraw SDraw SDraw left review comments

@TheNormalnij TheNormalnij TheNormalnij left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

enhancement New feature or request

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /