Jump to content

3D Text in Babylonjs using Vectorize-text


vinhpt
 Share

Recommended Posts

It is to do with the the order (clockwise or counter-clockwise) the points making the holes are put into the array. Currently the way they are ordered (probably the same way as the outer edges) means that the normals polygonBuilder creates are pointed towards the inside of the letters rather than away from them.

Simplest way to correct is to reverse the hole array

for (var j = 1; j < letter.length; j++) {
  var hole = [];
  for (var k = 0; k < letter[j].length; k++) {
      hole[k] = new BABYLON.Vector2(scale * letter[j][k][1], scale * letter[j][k][0]);
  }
  hole.reverse(); // ADD THIS HERE
  polyBuilder.addHole(hole);
}

A depth option would be good.

Link to comment
Share on other sites

I like this :) really good job !

Too bad this relies on an external library. I wish we could one day use directly the data from the font design (I mean the character paths in TrueType, google fonts, etc, what are mainly Bezier curves) from JS and generate the meshes with those data. 

Link to comment
Share on other sites

Thanks JohnK!

I added your magic line of code

hole.reverse(); // ADD THIS HERE

and it work like a charm.

I also add the thickness option. Thanks again!

Hi jerome!

It seem hard work to  use directly the data from the font design file because javascript not render the text it self but the host OS do this (not for sure). But I know the good source to dig is Cairo.

The download button has added so please play the result with Babylonjs Sandbox. Thanks for your download feature suggestion!

 

demo.png

Link to comment
Share on other sites

Hi Deltakosh!

I am so glad to hearing that 3d text can be a official extension.  But I a newbie so do not know how to make this as extension have you got any guild lines?

By the way It is funny but true that Browerify not bundle .js files as the library (I mean other js code can call function from bundled) . So I will find out the way.

Thanks.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...