The font is not secret, but I just cannot share because it is what my employer owns. But there are several fonts that are very similar, such as this one.
In ideal world, I would like to have only one or two sample fonts included in the meshwriter package to present the way how they are converted. And I would like to convert my font following your documentation, because this will not be a one-time job. In the future, I will probably want to convert different fonts to use in Babylon.
I am amused and amazed so share that I have been solved many of the problems for automatic 3D font generation. There is a new font family used in this playground. See if you can spot it: https://www.babylonjs-playground.com/#NLG6KE#2 (Hint: Not the anchor.)
The new glyph was automatically generated from a font file in Javascript. No tuning by me.
There are many steps from this to a useful utility but I believe the technical risk is negligible.
There appears to be more than one version of Cinderblock, but this is the one I like best. Lots of face surface area to see reflected pictures upon. There may be other fonts with this same surface-area goodness. Any “bold’n’block” at least “leans-toward” high-surface.
(Wingy digs-into Deltakosh’s wallet to see if he has a Microsoft-comped Gold or Black credit card.)
Sorry, TL. That’s a darned nice offer from ya, thanks!
If I had an easily-found $89.00 to drop on this, I might. I wonder if pathetic begging to its author… would work. I would need a sob-story… something about an injured puppy that can only be saved… by a FREE copy/license of Stefan’s Cinderblock webfonts.
He might not believe the hurt puppy story… but he might think our attempt was worth $89 in entertainment.
Would you kindly try to make your own custom MeshWriter package using the instructions provided in the repos? I would like to know that one person (other than me) has succeeded once. The key repos are MeshWriter and MeshWriter-Font.
Just tried it, and was able to successfully created meshwriter.js. However, when I added it into the sample code, it produced an error. Can you tell what I did wrong? The entire code is here: https://www.babylonjs-playground.com/#PL752W#33
In the playground there was no default font specified; so MeshWriter went to Helvetica Neue. This was no longer there. Hence the error. I added a reference to your font as the default font on line 1761 and it worked as intended. https://www.babylonjs-playground.com/#PL752W#34
Samba, thanks for trying this out so promptly. The results worked better than anything I could have hoped for.
I would suggest leaving Helvetica Neue in future builds. That will keep that mysterious user error from happening.
With minification, the resulting module is pleasingly small. I recommend ‘terser’, per the instructions. You will need several fonts to drive the size over 100K.
I will call this mission complete. Thanks for the inspiration to figure out the next steps.
@TheLeftover, thank you so much for your hard work on this. It was super easy to make it up and run. I will definitely try terser as well. Thanks again, this is an awesome magic!
hey there @TheLeftover. i’m so psyked about your font package. just what i was looking for. couple questions. I just ran through all the steps… and successfully generated a new meshwriter.js file. Included it as per instructions, but looks like i’ve still got only the default fonts.
Output from node script was:
convertFontFile({suffix:“otf”,name:“StargazeRegular”,compress:true})
undefined
Wrote MeshWriter font file to ‘…/meshwriter/fonts/stargazeregular.js’
convertFontFile({suffix:“otf”,name:“StargazeStencil”,compress:true})
undefined
Wrote MeshWriter font file to ‘…/meshwriter/fonts/stargazestencil.js’
I don’t see it picking up those fonts in the build though…even though i can see them there in the same Dir as with all of the default fonts.
I think you are about halfway there. It looks like you put the font files in the correct directory. The next step is creating the pointers to those files for your build. For that you need to edit index.js. Please view the instructions at the link below for further guidance.
What those instructions tell you is that you must take three wee, tiny steps in index.js for each font file. You can remove existing files, EXCEPT helvetica. It is the default font and removing it might cause errors.
Aha! Was just about to write to say that I discovered the missing steps. Did that and the build went off fine. No luck on the front end though. Just see what looks like a play button. My “stargazer” font on left - and Jura on the right in screenshot below. Using the same BJS code (just changing the font font-family). Any suggestions?
Well, I will first say that you did everything perfectly in index.js. That’s good.
I also think I know what the problem is. Also good.
Thanks for sending all the detailed information. I noticed that the new fonts were both 4.62K. This tells me that they did not build correctly. You can see the others are about ten times as large.
The obvious suspect is MeshWriter-Font in combination with stargazer. I tested on five or six different types of font files but it doesn’t have a long history. Font files have different major formats and variations within formats.
I am probably gonna hafta pop the hood now. If you could tell me where to find the original .ttf or .otf stargazer font files, I can take a look myself.
bigrig, your comment – that only numbers are built by meshwriter-font – indicates to me that perhaps there is something wrong with the config file.
The config file specifies default glyphs. But if it isn’t there, then meshwriter-font just builds the digits. I did run a build just now on StarGaze and the output files looked OK. I didn’t try to render them but I am sending them to you.
The only thing I did was to replace the space in the file name with a dash.
Anyway try out the font files I sent you. Check whether your config file is loading properly. Lemme know.
Before I dash off to other stuff, let me do some drive-by troubleshooting. It looks like the side textures are facing inward, not outward.
There are two flags at the top of each font file, reverseShapes and reverseHoles. Play with changing one or the other or both. If something interesting emerges, lemme know.
.otf fonts are wound a particular way. Maybe these don’t follow a convention that I thought was universal.
Looks like that did something For the letters that it does render, they are looking better. https://www.babylonjs-playground.com/#PL752W#61
On Regular (bottom one in screenshot), i’ve got: var font={reverseHoles:false,reverseShapes:false}
On Stencil, I’ve got: var font={reverseHoles:true,reverseShapes:true}