It’s no secret I have a bit of a fetish for playing with text and making text effects in flash. Back in May I decided to create dynamic 3d TriangleMeshes from BitmapData captures of text in textfields. Like the majority of my experiments, I never finished it.
I’m now posting this for three reasons:
- Aral Balkans Grab the low hanging fruit Presentation which I saw last month in Ghent. I didn’t agree with everything he said, but what stuck with me was : “Talk about stuff you’re working on”. The idea is, if you wait forever for your “perfect finalized grand hobby project” release, it’ll never happen. You need peers to egg you on. So, I’ve been doing this on and off for a while and this post is an experiment to see if I’ll actually get a finished product out someday
- I saw a post about 3d text with Away3d a few weeks back.
- Just the other day, Mark Barcinski posted this on the Papervision3d mailing list which is pretty much exactly the process I had come up with. Doh. Somebody always does it before you… I’m just waiting for some Zupko or Ralph to see this and say : “oh, I typed that with my toes back when the beta of player8 came out…”
I won’t post any code for now as it’s in an embarrassing state… just getting shit to work eh. The current state of the algorithm only handles Pixel fonts with no diagonals or curves… The flow is:
- Take a BitmapData snapshot of a textfield with one character.
- Create “monochrome” bitmaps of the character, and any “holes” or shapes within it (That would be the black bitmaps at the bottom right of the screenshot above).
- “Scan” these monochrome images for a list of all the “shape edge” pixels.
- Optimize the “shape edge” points into lines, diagonals and curves. These are the “outlines” at the top left of the screenshot.
- “Triangulate” those points (this is not quite perfect yet, just punch in “B” into the input field for a fix of teh fail). This will generate the bluish patchwork letter to the right of the outlines.
- Use the triangles and the outline points to generate faces and vertices, UVMap them, pass a material and render.
- Feel intimidated by the bugs
Next steps are obviously to create some code that’s actually usable. Get the diagonals and curves to work. Try this out with some shaders, the 3d render is crap now. Get full words out. Animate the individual letters. I’ll need some help with optimizing some of the “mathier” parts, but that’s what the mailing list and friends like David are for
Damn you Aral… I’m never gonna get this done