bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Text Gizmos

Open Sigma-dev opened this issue 1 year ago • 6 comments

What problem does this solve or what need does it fill?

Gizmos are mainly used (atleast from my experience) to quickly add information vizualization without much effort They fill this work great, but sometimes we want to gizmo more complex data visible than shapes can handle. Things like names, lengths, values etc...

What solution would you like

gizmos.text(position, size, "text");
gizmos.text_2d(position, size, "text");

Would draw text always upright always facing the camera. The size given would be in world space, so the text would be sized according to distance like any other object. The 3d/2d variants simply change the position to be Vec2 vs Vec3

What alternative(s) have you considered?

Logging is not as indicative, I can't thing of any thing that could get the diversity of information like a text gizmo would.

Additional context

The simplest way to get something like it working would be to encode every alpha-numeric character as a shape (a-z A-Z 0.9 and maybe some symbols). Then only allow these characters to be displayed.

Fonts are kind of a pain to implement, though bevy already has abstractions around them but I don't know enough to know if it's a viable approach.

If the manual symbol approach is chosen then I could probably implement it and open a PR for it.

Sigma-dev avatar Nov 23 '24 21:11 Sigma-dev

I'd like to try and integrate this with Bevy's existing text rendering if possible. This is doubly useful with weird symbol fonts. I share the desire for quick-and-dirty worldspace text for debugging though!

alice-i-cecile avatar Nov 25 '24 12:11 alice-i-cecile

Was just googling for this feature and found this issue. I would really love this!

Preston-Harrison avatar Nov 27 '24 02:11 Preston-Harrison

Bump! I'd really like this feature.

colleen05 avatar Feb 03 '25 13:02 colleen05

Not sure if people will find this useful, but if you need a janky solution for right now, it's pretty quick to do with bevy_egui: https://gist.github.com/jakkos-net/7f1d2806fae0288a11f3eb0840a11b04

jakkos-net avatar Feb 04 '25 14:02 jakkos-net

  • In case you're not aware, This is listed in https://github.com/bevyengine/bevy/issues/9400 ; but a dedicated issue makes sense to discuss this in particular :)

ThierryBerger avatar Mar 27 '25 08:03 ThierryBerger

I thinking it can be very useful. For my debugging tools on some Boid algorithm implementation, I'd love to have some easy gizmos ability to put a text label on each of the forces which I show with arrows. At the end you end up having some color pallets for each force but it becomes hard to keep track of the color for each of the arrows / forces. A text label for each of the many arrows would be very nice to have in my opinion.

olegomon avatar May 31 '25 21:05 olegomon

I'm currently trying to render an axis in a 3d scene and the lack of a way to render text in that scene is an absolute headache so big thumbs up from me.

Adam-Ladd avatar Jul 09 '25 08:07 Adam-Ladd

I've never looked into the gizmos internals, I know it's immediate mode but is there any hidden implicit caching of the geometry? To have anything approaching reasonable performance, it will need to retain the text layouts between frames. Unless we restrict ourselves to a single monospaced font and a trivial one-line layout.

I think a very simple initial PR with no caching that just uses the default font would be okay though, and then we can iterate on it.

ickshonpe avatar Nov 18 '25 13:11 ickshonpe