Skip to content

Add TextPlane workaround for billboarded text via Luxor PNG generatio… - #276

Open
rainerrodrigues wants to merge 1 commit into
rdeits:masterfrom
rainerrodrigues:feature-text-sprite
Open

Add TextPlane workaround for billboarded text via Luxor PNG generatio…#276
rainerrodrigues wants to merge 1 commit into
rdeits:masterfrom
rainerrodrigues:feature-text-sprite

Conversation

@rainerrodrigues

Copy link
Copy Markdown

Description

This Draft PR is a Julia-side proof-of-concept to address Issue #29 (Displaying billboarded text).

Since sending custom "type" => "_text" dictionaries to the Three.js frontend silently fails without custom JS loaders, this approach bypasses the frontend entirely. It uses Luxor.jl to physically render the text onto an invisible, temporary 2D canvas, extracts the raw PNG bytes, and sends it to the browser as a standard image texture applied to an infinitely thin HyperRectangle ("Cardboard Hack").

Changes Made:

  • Added Luxor, Colors, and GeometryBasics to dependencies.
  • Implemented make_text_material to generate transparent PNG textures in memory.
  • Added a TextPlane helper function to easily generate the scaled geometry and material.

Example Usage:

using MeshCat
vis = Visualizer()
geom, mat = TextPlane("Hello World!")
setobject!(vis[:my_label], geom, mat)

Note to Maintainers
Because Luxor.jl is a heavy dependency, I opened this as a Draft. I would love your feedback on whether this is a viable workaround for native Julia text rendering, and if so, whether you'd prefer this isolated into a Package Extension (e.g., LuxorExt.jl) to keep the base package lightweight!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant