rdeits / MeshCat.jl

WebGL-based 3D visualizer in Julia
MIT License
232 stars 42 forks source link

Displaying billboarded text #29

Open GearsAD opened 6 years ago

GearsAD commented 6 years ago

Any chance for supporting billboarded text (2D text that always faces the camera)?

Great library by the way! Similar to Drake without all the deps, nice.

rdeits commented 6 years ago

Yeah, I agree that would be nice. It's not currently supported in the underlying meshcat javascript library, though, so there'd have to be some work done. I can see a couple of options:

1) Add an set_text() (or perhaps just set_html()) command to the meshcat javascript library and then bind that method from julia 2) Just compose the text you want with the meshcat window directly using WebIO.jl.

The second option likely requires fewer changes (once #28 comes in), but might be less flexible.

Can you tell me more about what you'd want to do with billboarded text?

GearsAD commented 6 years ago

Sure, I'm not sure about the differences between the two options, but I think it's between rendering in the 3D world or on a separate canvas? Ideally the text would exist in the 3D world (not an overlaid canvas), so that we don't have to worry about culling etc. I'd like to annotate objects in the 3D world, show their names and some brief information that would always face the camera.

My PoC: https://github.com/GearsAD/SynchronySDK.jl/blob/MeshCat_PoC/examples/MeshCat_VisPoC.jl

In this scenario I'd like to draw the node label+ID and details.

I see there's a lot of talk about this at threejs :https://github.com/mrdoob/three.js/issues/1321, but not sure if it ended in consensus (I'm new to three.js).

rdeits commented 6 years ago

Ah, ok. Yes, if you want the text to live in the 3D world (but be rendered facing the camera), then that's definitely option (1). I'm not sure how to do that in threejs either, but I think the link you posted is the right place to start.

ThatcherC commented 3 years ago

Any chance adding some sort of text display will be easier now that #28 is merged? I'd love to be able to add some text tags to parts of my scenes but haven't found a good way to do it yet.