关于 lettra
Lettra 是面向 Three.js 项目的场景文字排版技能,指导编码 Agent 配置 MSDF 字体、TSL 材质并检查渲染;场景、相机与动画由应用负责。
主要功能
- 01MSDF 字体排版与字形几何
- 02可组合的 TSL 材质
- 03Three.js 场景集成指导
- 04字体资源加载与预热
- 05渲染及生命周期检查
适用场景
- 01在 3D 场景中添加透视文字
- 02让文字与场景物体叠层
- 03制作着色器文字效果
- 04检查文字动画过渡
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ joyco-studio/ lettra --skill lettra安装后在 Claude Code 中输入/lettra确认已加载。
包含的文件
除 SKILL.md 外,安装时一起下载的参考资料和脚本。
agents/openai.yamlreferences/effects-and-interaction.mdfont-workflow.mdscene-integration.mdREADME 原文English
来自项目 READMEREADME 暂无中文译文,以下为英文原文;中文介绍见上方。
Lettra
Turn a font, words, and a visual direction into typography that lives inside a scene. Lettra supplies MSDF font layout, glyph geometry, and composable TSL materials; the application supplies the scene, camera, interaction, and animation timing.
Choose the right boundary
Use Lettra for text that needs perspective, object occlusion, shader effects, or interaction inside a Three.js scene. Prefer HTML for ordinary reading copy and navigation. When scene-integrated text is part of the experience, preserve an appropriate semantic equivalent for meaningful content and keyboard/touch access to important actions.
- Use
WebGPURendererfromthree/webgpu, including its WebGL2 fallback. A classicWebGLRenderercannot render these TSL materials. Preserve the existing renderer unless changing it is part of the task. - Lettra lays out baked glyphs; it does not shape Arabic/Indic text, bidirectional paragraphs, contextual ligatures, or color emoji. Check the actual copy and glyph coverage before choosing it.
- Glyphs are atlas-backed quads, not extruded font outlines. If the brief needs physical letter thickness, explain that a separate geometry solution is needed.
- Do not replace an existing typography stack just because this skill is available.
Establish the version and inputs
Inspect the installed lettra version, its exports/type declarations, and the project’s renderer setup before implementing. These examples were checked against Lettra 0.3.0 and Three.js 0.186.1; match the installed release rather than assuming every API is present.
Use the supplied font and copy. If either is essential and missing, ask for it while preparing the scene integration. For an expressly provisional prototype, an existing project font is a reasonable stated default. Do not silently substitute a font or imply permission to redistribute it.
Official references:
- Documentation index: discover current API pages; documentation supports
Accept: text/markdown. - Source: implementation and examples.
- Installed
lettra/dist/three.d.tsandlettra/dist/index.d.ts: signatures for the version being used.
Build the smallest useful scene integration
- Prepare assets. Reuse a matching metrics JSON and atlas PNG if available. Otherwise bake the font at development time; runtime text does not consume a TTF directly. Read Font workflow for filenames, charset coverage, variable fonts, and families.
- Load together.
loadFontloads metrics;loadFontTextureloads and configures the atlas. Use the application’s existing asset owner/cache if appropriate. The atlas is linear distance data, not an sRGB image. - Create and place. Start with
createText, attachtext.meshto the existing scene or a group, and compose it with the camera and objects. Read Scene integration for a typed example, units, depth, and lifecycle. - Warm before showing. Await
text.warmup(renderer, camera, scene)or the existing scene-level texture-upload/pipeline-compile pass. Avoid warming the same scene redundantly. - Add behavior. Change uniform
.valuefields in the existing animation loop. UsesetTextwhen the string/layout changes, not as a per-frame animation mechanism. Read Effects and interaction when adding reveals, scrambles, or custom fields.
Prefer shared font assets and small scene/effect modules over duplicating complete renderers or asset loaders. This is an integration choice, not a requirement to introduce React, a UI kit, an animation library, or a JOYCO loader dependency.
Check the result where it matters
Use the project’s focused typecheck and inspect the rendered scene. Verify the requested copy at the intended scale/angle, punctuation and accents, and overlaps with foreground/background objects. Check the WebGL2 fallback when fallback support is part of the feature.
For animated work, inspect the start, middle, end, and interruption/reversal of the transition. Reset all participating effect uniforms on replay. Keep reduced-motion output readable and provide a keyboard/touch route to important interactions.
For mount/unmount or font changes, check resource ownership: no disposed shared atlas, stale geometry paired with a new atlas, duplicate render loop, or lingering input listener. Preserve a semantic description or fallback for meaningful canvas content.
A successful typecheck does not establish visual correctness. Report what was actually inspected, the asset paths produced, and any renderer/font limitations still affecting the requested result.