Skip to content

Fix bullet penetration rendering multiple tracers#1895

Merged
Rainyan merged 2 commits into
NeotokyoRebuild:masterfrom
Rainyan:bug/multi-tracers
Mar 30, 2026
Merged

Fix bullet penetration rendering multiple tracers#1895
Rainyan merged 2 commits into
NeotokyoRebuild:masterfrom
Rainyan:bug/multi-tracers

Conversation

@Rainyan
Copy link
Copy Markdown
Member

@Rainyan Rainyan commented Mar 27, 2026

Description

Fix a situation where a bullet that penetrates a surface would render a new tracer for each penetration (from the muzzle, not from the point beyond the penetration!)

The bullet penetration logic is recursive, so each call to FireBullets would set up a new tracer. This PR will prevent the tracer creation if the associated FireBulletsInfo_t::m_flPenetration value does not match the weapon's GetPenetration value, i.e. if the attack has already penetrated and hence lost some of its penetration value. As such, this fix also asserts that all surface materials will have a non-zero penetration resistance value associated with them (which is the case currently).

An alternative to outright blocking the reentrant tracers would be firing the continuation tracer from the bullet hole of the penetration exit (instead of doing multi-tracers from the gun, which simply looks weird), but since the issue for this bug mentions particle budget worries, it would probably have to be implemented as a single tracer that gets fired at the termination of the penetration chain. In any case, I considered that out of scope for this fix.

Toolchain

  • Windows MSVC VS2022

Linked Issues

Rainyan added 2 commits March 27, 2026 16:12
The bullet penetration logic is recursive, and this could cause bullets
to render multiple tracers per one shot. Check that the current
penetrating force of the shot equals the used weapon's original
penetrating force, i.e. that no surfaces have yet been penetrated.

This asserts that any penetrated surfaces will incur a non-zero
penetration cost.
@Rainyan Rainyan requested a review from a team March 27, 2026 14:33
@DESTROYGIRL DESTROYGIRL requested a review from a team March 29, 2026 16:38
@Rainyan Rainyan merged commit 52e62ee into NeotokyoRebuild:master Mar 30, 2026
7 checks passed
@Rainyan Rainyan deleted the bug/multi-tracers branch March 30, 2026 11:43
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.

Gun tracers sometimes appear multiple times per shot

3 participants