New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Text for Three.js #213
Comments
What is your use case for this? Generally, rendering the text using the Canvas2D API and then using that as a texture on a plane is a simpler and arguably better solution. Nevertheless...
|
Uhm, I know @doug managed to get some dynamic 3d text working on three.js already, I wonder where he left it. As far as I remember I was working on MacOS only. Maybe we could take a look at it again. |
thank you for the responses. being new to computer graphics, i've alot to pick up along the way :) the main use case is allow easy creation of 3d (or 2d) text objects. this would be useful for 3d typography or creating dynamic text easily. it seems such features exists in both pv3d and away3d. i've considered rendering text as a texture, but is it possible to create extrude 3d text objects from it - perhaps as a depth map? in the process attempting my approach (with paths and polygon triangulation), it seems that it would be possible to abstract another feature for three.js - a drawing path. that means that one could have drawing context similar to canvas 2d context, with moveTo, lineTo, quadraticCurveTo, bezierCurveTo etc before extruding the shapes. this feature seems to exist in away3d too.
One last point about dynamic 3d fonts is that users can plugin typeface.js fonts they have to be rendered http://typeface.neocracy.org/fonts.html otherwise, its also possible like pv3d to ship with a default font. (away3d seems to use a font parser instead). |
@pyrotechnick, I've added 3d character generation although there are still having some holes despite creating a complete 3d model (plane plus extrusion). could it be that some vertices are not in the correct clockwise order, causing backface culling to interpret the sides incorrectly? I notice using doubleside solves this problem but I'm not sure if its the correct method to rectify this. see https://gist.github.com/988576 In addition to include js file, you need a font file |
Yes, holes that go away with One thing you could try is to check where face normal is pointing to and if it seems wrong then change the order of vertices. Though it can be tricky to figure out where the normal should point to for sides of the letter. |
thank you @alteredq. i realized that i've mixed up the top and bottom faces, an fixing the order fixed the problems. :) the sides weren't too difficult, since the font paths actually did a good job at ordering the points correctly (CW for outer edges and CCW for holes). Now what's left with is adding UV coordinates are for texture mapping (still figuring this thing out). Just curious, using MeshBasicMaterial with the CanvasRenderer I see the polygon outlines while the WebGLRenderer doesn't show these lines.. (check some screenshots below) Is this something to do with the renderer or something I might have missed out? Wireframe Mode CanvasRenderer WebGLRenderer |
Looking good! The lines thingie is something to do with the renderer. |
thank you @mrdoob! was playing around with that option when i realized i didn't turn that back on :) http://jabtunes.com/labs/3d/canvas_geometry_text.html#hello.mr.doob what's left still's UV mapping... :P |
Nice! :D |
I'm currently trying to add 3d text support for three.js, and while I've made some progress with importing typeface.js fonts using some Polygon Triangulation algorithm, there's a couple of questions I have.
Here's is a sample geometry class for the letter Z
https://gist.github.com/985108
Joshua
The text was updated successfully, but these errors were encountered: