GPUParticles3D: Zero modelview matrix of billboard materials when model matrix is zeroes #75090
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.
Resolves #72650 by zeroing the modelview matrix of billboards when all scales (X, Y, Z) of the model matrix are exactly zero. This was hypothesized to be the issue by @QbieShay in this comment: the particle gets a zero transform when it is inactive, but since the billboarded material ignores the rotation/scale of the model matrix, this method of preventing them from being rendered was not working.
This implementation introduces a conditional branch to the shader for billboarded materials. An alternative is a non-branching implementation that adds an unconditional 16 multiplications with e.g. the following line:
I chose the branching form since it will nearly always be synchronized across the wavefront, particularly in the non-particle use-case where the scales will all be non-zero, and this will most often avoid the cost of the 16 multiplications.