Gizmos Billboards
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)andgizmos.billboard_2d(position_2d, color)to actually draw gizmos. GizmoConfignow includes two additional properties:.billboard_sizeto 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_biasapplies to billboards aswell.
Showcase
You can draw billboards like this:
gizmos.billboard(Vec3::ZERO, RED);
Which produces results like these...
in 3D:
https://github.com/user-attachments/assets/6643d993-76d4-4acb-99f9-bd4a8b01c0d3
and in 2D:
Very nice: thanks for the polished video!
@lynn-lumen what needs to be done here to take this out of draft?
I don' really understand the ambiguity error🥲 Any help would be much appreciated:)
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.
#15031 should solve your pain here: particularly https://github.com/bevyengine/bevy/pull/15031/commits/5b157e98ac4728074ab0fe24282db973c70aa5b3
Thanks, I will have another try tomorrow :)
#15031 should solve your pain here: particularly 5b157e9
Thanks again, that really was very helpful :D
@alice-i-cecile This is ready for review now :)
@lynn-lumen @tychedelia what is required to move this PR forward?
@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.
@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.
Ahh OK, thank you for clarifying :) If there still is interest, I will take a look at updating this next week.