Skip to content

Move particle vertex processing to the GPU#2086

Open
wahfl2 wants to merge 33 commits intoCaffeineMC:devfrom
wahfl2:snapshot/dev
Open

Move particle vertex processing to the GPU#2086
wahfl2 wants to merge 33 commits intoCaffeineMC:devfrom
wahfl2:snapshot/dev

Conversation

@wahfl2
Copy link

@wahfl2 wahfl2 commented Sep 23, 2023

Currently, all particle vertices are processed and rotated on the CPU, before uploading them to a shader to be rendered. Sodium optimizes this slightly with more direct and explicit math operations for more optimization opportunities. However, a lot of vector math is still being done on the CPU.

This PR moves that processing (for most particles) to the GPU in a new shader. Specifically, this PR optimizes billboard particles that haven't overridden the buildGeometry method, which means they face the camera. This is the vast majority of particles, with only a few overrides in vanilla Minecraft (shrieker, elder guardian, etc). The normal particle rendering is still in place for the particles that are built some other way.

@IMS212 IMS212 changed the base branch from snapshot/dev to dev September 23, 2023 14:09
@wahfl2 wahfl2 marked this pull request as draft September 23, 2023 20:53
@wahfl2 wahfl2 marked this pull request as ready for review November 6, 2023 20:20
@jellysquid3 jellysquid3 added this to the Sodium 0.7 milestone Dec 30, 2023
@jellysquid3 jellysquid3 added the T-enhancement Type: Enhancement label Dec 31, 2023
@douira douira removed this from the Sodium 0.7 milestone May 29, 2025
@umbrageodotus
Copy link

@douira plans for this? Or is async occlusion first? I can review and rebase the PR if needed.

@douira
Copy link
Contributor

douira commented Feb 28, 2026

If you or the original author of this PR can rebase it and demonstrate a performance improvement I can consider it for review.

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

Labels

T-enhancement Type: Enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants