Skip to content

Gizmos Billboards #14995

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

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

Gizmos Billboards #14995

wants to merge 13 commits into from

Conversation

lynn-lumen
Copy link
Contributor

Objective

  • Most game engines like Unity and Unreal Engine have the ability to draw sprites as gizmos. This may be useful for drawing "nodes" for paths, lights and much more.
  • This PR adds flat coloured billboards for bevy. Since this PR already is pretty big, I would like to add drawing textures on the billboards in a future PR.

Solution

  • Moved the rendering code of line gizmos into its own module.
  • Added rendering code for billboard gizmos.
  • Added gizmos.billboard(position_3d, color) and gizmos.billboard_2d(position_2d, color) to actually draw gizmos.
  • GizmoConfignow includes two additional properties:
    • .billboard_size to configure the visual size (length along the edge) of billboards. This behaves very similar to .line_width
    • .billboard_perspectiveto apply perspective scaling to billboards.
  • The GizmoConfig.depth_bias applies to billboards aswell.

Showcase

You can draw billboards like this:

gizmos.billboard(Vec3::ZERO, RED);

Which produces results like these...

in 3D:

Screen.Recording.2024-08-31.at.19.31.14-2.mov

and in 2D:

Screenshot 2024-08-31 at 18 24 46

@alice-i-cecile alice-i-cecile added C-Feature A new feature, making something new possible A-Gizmos Visual editor and debug gizmos A-Rendering Drawing game state to the screen M-Needs-Release-Note Work that should be called out in the blog due to impact S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Aug 31, 2024
@alice-i-cecile
Copy link
Member

Very nice: thanks for the polished video!

@lynn-lumen lynn-lumen marked this pull request as draft August 31, 2024 23:23
@alice-i-cecile alice-i-cecile added S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Sep 3, 2024
@alice-i-cecile
Copy link
Member

@lynn-lumen what needs to be done here to take this out of draft?

@lynn-lumen
Copy link
Contributor Author

I don' really understand the ambiguity error🥲
Any help would be much appreciated:)

@alice-i-cecile
Copy link
Member

It looks like you've added some ambiguous systems. The diff of "what new systems are conflicting" is frustratingly annoying to get at though: I'm going to be spending some time today driving the count down to zero, which should make this much clearer.

@alice-i-cecile
Copy link
Member

#15031 should solve your pain here: particularly 5b157e9

@lynn-lumen
Copy link
Contributor Author

Thanks, I will have another try tomorrow :)

@lynn-lumen
Copy link
Contributor Author

#15031 should solve your pain here: particularly 5b157e9

Thanks again, that really was very helpful :D

@lynn-lumen lynn-lumen marked this pull request as ready for review September 4, 2024 20:03
@lynn-lumen
Copy link
Contributor Author

@alice-i-cecile This is ready for review now :)

@alice-i-cecile alice-i-cecile added S-Needs-Review Needs reviewer attention (from anyone!) to move forward and removed S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged labels Sep 9, 2024
@tychedelia tychedelia self-requested a review September 9, 2024 20:11

@vertex
fn vertex(vertex: VertexInput) -> VertexOutput {
var positions = array<vec2<f32>, 6>(
Copy link
Member

Choose a reason for hiding this comment

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

please format this shader fn

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not really sure what you mean. In terms of formatting it looks like the lines.wgsl shader to me.

@tim-blackbird tim-blackbird mentioned this pull request Oct 10, 2024
@pablo-lua pablo-lua self-requested a review October 13, 2024 01:23
@BenjaminBrienen BenjaminBrienen added D-Complex Quite challenging from either a design or technical perspective. Ask for help! S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Oct 28, 2024
@TimJentzsch
Copy link
Contributor

@lynn-lumen @tychedelia what is required to move this PR forward?

@lynn-lumen
Copy link
Contributor Author

@lynn-lumen @tychedelia what is required to move this PR forward?

This PR probably needs updating to the current version. Apart from that, I am not aware of anything blocking this PR. I believe @tychedelia requested format changes to some of the shader code though, but I was unable to determine what exactly they meant.

@tychedelia
Copy link
Member

@lynn-lumen @tychedelia what is required to move this PR forward?

This PR probably needs updating to the current version. Apart from that, I am not aware of anything blocking this PR. I believe @tychedelia requested format changes to some of the shader code though, but I was unable to determine what exactly they meant.

Line 43 and 76-79 aren't formatted. The conflicts might be complex to resolve. We've moved towards retaining gizmos which may be worth evaluating if you want to revive this.

@lynn-lumen
Copy link
Contributor Author

Ahh OK, thank you for clarifying :) If there still is interest, I will take a look at updating this next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Gizmos Visual editor and debug gizmos A-Rendering Drawing game state to the screen C-Feature A new feature, making something new possible D-Complex Quite challenging from either a design or technical perspective. Ask for help! M-Needs-Release-Note Work that should be called out in the blog due to impact S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

5 participants