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

Ensure Motion Vectors are enabled by particles and skeletons when using the Motion Vector debug draw option #93055

Merged
merged 1 commit into from
Jun 12, 2024

Conversation

clayjohn
Copy link
Member

Fixes issue reported in #92711 (comment)

Particles, MultiMesh, and Skeletons need to know in advance if they should save enough information for Motion Vectors.

Further work

Motion Vectors will still be missing when using a compositor effect since the check currently only happens at draw time here:

bool motion_vectors_required;
if (using_debug_mvs) {
motion_vectors_required = true;
} else if (ce_needs_motion_vectors) {
motion_vectors_required = true;
} else if (!is_reflection_probe && using_taa) {
motion_vectors_required = true;
} else if (!is_reflection_probe && using_fsr2) {
motion_vectors_required = true;
} else {
motion_vectors_required = false;
}

We will need to add some sort of registration so if a Compositor effect requests motion vectors all systems are aware that motion vectors are needed

CC @BastiaanOlij

@clayjohn clayjohn added bug topic:rendering cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release labels Jun 11, 2024
@clayjohn clayjohn added this to the 4.3 milestone Jun 11, 2024
@clayjohn clayjohn requested a review from BastiaanOlij June 11, 2024 19:58
@clayjohn clayjohn requested a review from a team as a code owner June 11, 2024 19:58
@BastiaanOlij
Copy link
Contributor

Hmmm, it shouldn't be too hard to enhance _viewport_requires_motion_vectors to do so. We simply need to check the compositor associated with the viewport and see if any of the effects have the motion vector flag set.

One thing that makes sense to me here is to implement a helper on the Compositor itself, where a compositor effect informs the compositor it needs motion vectors and the compositor keeps a count. That way we don't need to loop through the compositor effects each time we do this check.

I'll see if I can add something for that and I'll PR it ontop of your PR.

@BastiaanOlij
Copy link
Contributor

This might be enough: #93068

@clayjohn
Copy link
Member Author

This might be enough: #93068

Awesome! Yep that should fix it for CompositorEffects.

Do you mind approving this PR so it is fixed for all cases now?

Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

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

Tested locally, it works as expected.

@akien-mga akien-mga merged commit 7561028 into godotengine:master Jun 12, 2024
16 checks passed
@akien-mga
Copy link
Member

Thanks!

@clayjohn clayjohn deleted the MV-debug branch June 12, 2024 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release topic:rendering
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants