Skip to content
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

Optimize motion debris rendering #3444

Merged
merged 2 commits into from May 24, 2021

Conversation

Baezon
Copy link
Member

@Baezon Baezon commented May 22, 2021

"Asteroth, who the heck cares about motion debris rendering"

Well, you might be surprised to learn, at least on my machine in testing, occasionally motion debris rendering could take as long as a millisecond. By switching it to the batching system, it significantly reduces the render time.

As always, a bunch of other improvements and cleanup related to drawing the motion debris. It now fades in from a distance, the max distance increased as a result, and the total number increased as a result of that. The changes to the size aren't "real" changes, for reasons that are unclear to me, the switch of rendering methods significantly increased their apparent size, so I adjusted the size constants to compensate.

@Baezon Baezon added enhancement A new feature or upgrade of an existing feature to add additional functionality. graphics A feature or issue related to graphics (2d and 3d) labels May 22, 2021

if ( (vdist < MIN_DIST_RANGE) || (vdist > MAX_DIST_RANGE) )
d->active = 0;
batching_add_bitmap(Debris_vclips[mdebris.vclip].bm + frame, &pnt, 0, mdebris.size, alpha);
Copy link
Member

Choose a reason for hiding this comment

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

I do not see a call to actually execute the batches you add here in this function and if I remember correctly that is what actually makes the GPU do stuff in that system. While that does not cause issues with the rendering of the debris it might change your measurements since no graphics operations actually take place within this scope but the cost is added somewhere else.

This is still a worthwhile change but might not be the x30 performance increase you are seeing in your measurements.

Copy link
Member Author

Choose a reason for hiding this comment

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

On second thought, you are right, that number I remembered was specifically this loop itself because I wanted the gauge the effect of increasing the total number of debris (its been a little bit since I wrote this code). But in general I am aware that the batch renders themselves should also be counted, which did come out favorably although I can't recall the exact numbers produced.

@JohnAFernandez JohnAFernandez merged commit c10d6ec into scp-fs2open:master May 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A new feature or upgrade of an existing feature to add additional functionality. graphics A feature or issue related to graphics (2d and 3d)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants