Skip to content

feat: implement proof of concept animated gizmos #18895

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

RobWalt
Copy link
Contributor

@RobWalt RobWalt commented Apr 21, 2025

Objective

  • This is a new attempt to implement animated gizmos
  • This PR is supposed to supersede my first try here Animated gizmos #14645
  • This is still a proof of concept of a second approach of tackling the issue. I generally would like to have a discussion here to decide whether to use the old approach from the PR mentioned above or the new approach sketched in the first commits here

Solution

There are generally two approaches I have considered: The old one, which is CPU based and the new one which is GPU based.

Old solution

  • This old solution would basically replicate the existing API for the animated versions of it
  • Lot's of code would be reused
  • The implementation would happen in the rust code

New solution

  • The implementation is based on modifying the gizmo shader directly
  • There are just some new variants on the gizmo line style enum
  • This introduces a bit more uniform data to the shader (everything time based, we could probably make that cleaner, the current version is just a proof of concept).
  • Also the time uniforms need to be constantly updated
  • Unfortunately I've noticed that the lines are rough around the edges ... literally. For curved lines the shader approach seems to be suboptimal as it will produce dashes of varying lengths. This is probably caused from the way we use small lines to draw curved lines.

Testing

  • You can try to run the new version of animated gizmos via the 2D gizmos example

Showcase

TODO

This section is optional. If this PR does not include a visual change or does not add a new feature, you can delete this section.

  • Help others understand the result of this PR by showcasing your awesome work!
  • If this PR adds a new feature or public API, consider adding a brief pseudo-code snippet of it in action
  • If this PR includes a visual change, consider adding a screenshot, GIF, or video
    • If you want, you could even include a before/after comparison!
  • If the Migration Guide adequately covers the changes, you can delete this section

While a showcase should aim to be brief and digestible, you can use a toggleable section to save space on longer showcases:

println!("My super cool code.");

@alice-i-cecile alice-i-cecile added A-Animation Make things move and change over time A-Gizmos Visual editor and debug gizmos S-Needs-Design This issue requires design work to think about how it would best be accomplished C-Feature A new feature, making something new possible X-Contentious There are nontrivial implications that should be thought through labels Apr 23, 2025
@RobWalt RobWalt force-pushed the animated-gizmos-shader branch from ca84ca8 to aced23b Compare April 28, 2025 17:44
@RobWalt
Copy link
Contributor Author

RobWalt commented Apr 28, 2025

Here's a gif of the current state with a huge speed factor so that the effect is visible. I think generally speaking, the line shader is a bit cursed, since:

  1. The dash length varies. That's also the case in the non-animated case if you look closely
  2. The speed of the dashed line varies (based on length? idk)

@RobWalt
Copy link
Contributor Author

RobWalt commented Apr 28, 2025

Kooha-2025-04-28-19-53-21.webm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Animation Make things move and change over time A-Gizmos Visual editor and debug gizmos C-Feature A new feature, making something new possible S-Needs-Design This issue requires design work to think about how it would best be accomplished X-Contentious There are nontrivial implications that should be thought through
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants