TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

It’s 2015 and drawing text is still hard

37 pointsby parrisalmost 10 years ago

7 comments

mattdeslalmost 10 years ago
I have been working a lot with WebGL text in the past several months. Our current solution uses SDF with standard derivatives (crisp anti-aliasing regardless of zoom level) and supports kerning (depending on the font), batched glyphs, and word wrapping. It&#x27;s not perfect, but it&#x27;s pretty good for common use cases.<p>Since the OP is using modules already, they might enjoy some of the libraries and tools here:<p><a href="https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;text-modules" rel="nofollow">https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;text-modules</a><p>Or a ThreeJS specific implementation of bitmap &#x2F; SDF:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;Jam3&#x2F;three-bmfont-text" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Jam3&#x2F;three-bmfont-text</a><p>And lots more reading on the subject:<p><a href="http:&#x2F;&#x2F;mattdesl.svbtle.com&#x2F;material-design-on-the-gpu" rel="nofollow">http:&#x2F;&#x2F;mattdesl.svbtle.com&#x2F;material-design-on-the-gpu</a><p>Some practical implementations of it:<p>- npm dataviz: <a href="http:&#x2F;&#x2F;mattdesl.github.io&#x2F;npm-names&#x2F;" rel="nofollow">http:&#x2F;&#x2F;mattdesl.github.io&#x2F;npm-names&#x2F;</a> (over 40k glyphs, could go higher)<p>- physical text: <a href="http:&#x2F;&#x2F;mattdesl.github.io&#x2F;physical-text&#x2F;index.html" rel="nofollow">http:&#x2F;&#x2F;mattdesl.github.io&#x2F;physical-text&#x2F;index.html</a>
评论 #10006183 未加载
AndyKelleyalmost 10 years ago
Drawing text <i>is</i> hard, and not something that should be solved at the OpenGL level. It involves coordinating with the window manager and user settings.<p>But I&#x27;m just responding to the gimmicky title. It looks like the article has some interesting technical content to it.
评论 #10004886 未加载
评论 #10005089 未加载
评论 #10004857 未加载
tehansenalmost 10 years ago
Google &quot;loop blinn&quot;. There are a few papers by those guys on the topic of rendering smooth anti aliased cubic bezier paths, which is really what you want.<p>You can read font data directly from ttf e.g. And render text nicely with few polygons and shaders taking care of very nice accurate edge rendering.<p>I wrote a half finished c implementation a couple of years ago that might be useful as a reference if you want to look into this more : <a href="https:&#x2F;&#x2F;github.com&#x2F;hansent&#x2F;lbfont" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;hansent&#x2F;lbfont</a><p>It&#x27;s mainly based on the paper&#x2F;article inter book GPU gems 3.<p>Accelerated 2D Vector graphics are hard, when I was working on this nvidia was announcing the nv_path_rendering extension; don&#x27;t know how widely this is supported these days. But I doubt it&#x27;s available in webgl.<p>Edit: few typos...writing on mobile
mrdoob2almost 10 years ago
Feel free to do a PR with your solution, just so no one has to write a &quot;It&#x27;s 2016 and drawing text is still hard&quot; blog post next year ;)
评论 #10005135 未加载
hyperion2010almost 10 years ago
I have been building a tool for interactive data visualization using panda3d. Running absurd amounts hideously complex static geometry? No problem. Want to render short labels on a couple thousand objects? Draw calls aside, renderer slows to a crawl because it also uses the text geometry approach. Does anyone know if there are other approaches that work aside from the the SDF described in the article?
评论 #10005158 未加载
评论 #10004914 未加载
sdafsdfafasdfsdalmost 10 years ago
This site looks terrible in chrome.<p><a href="https:&#x2F;&#x2F;i.imgur.com&#x2F;39warVl.png" rel="nofollow">https:&#x2F;&#x2F;i.imgur.com&#x2F;39warVl.png</a>
评论 #10004729 未加载
评论 #10004599 未加载
评论 #10004913 未加载
评论 #10004579 未加载
andrewmcwattersalmost 10 years ago
Who or what says it should easy?