The Leftover

Members
  • Content Count

    98
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by The Leftover

  1. So I did a quick mod. New method: getLetterCenter() is called with a number, the index of the letter you want. It will return a Babylon.Vector2 with the center of that letter, compared to the 'x' and 'y' position of the instance. If you haven't rotated the mesh, it should be a useful value.
  2. I figured I would put in something to that effect eventually after I did V1.0 and figured out what Jerome was saying. Writing a function to return a center in two dimensions (relative to the anchor point) is probably easier than describing it right now. There are multiple levels of scales and offsets. I can take a look at that some time today. BTW, I don't really do kerning. The font itself gives me width of each letter and I add this (with appropriate scaling) every time I finish one. Look at 'xTra' in index.js. (Small possibility a better variable name is called for.)
  3. Servants. I need servants for font files. I would say the font files were 90% of the work to-date. It probably takes 10 minutes for an easy symbol (one shape, no holes, like 'F'). The percent symbol was pretty challenging - 30 minutes. (Three shapes and two holes) One can extract the paths from https://opentype.js.org/glyph-inspector.html Take it straight from the .ttf file. Which means we can support any font. There is one path per hole and one path per shape but they might be in any order -- and paths/holes are undifferentiated. It is one long string of shape-paths/hole-paths. And, for Babylon, I need to have the holes lines up with the shape they subtract from. So some organization is needed on many symbols. (I had to rewrite stuff when I hit the 'B', two holes from the same shape.) ==> I have not tried to automate this The good news is that this takes less time than the original creator did. 😎 I reside in beautiful Palo Alto where - apparently - we won't have summer this year.
  4. You betcha! BTW, sorry to put you thru the trouble of maximizing. You can check out the fully beautified (and sortof documented) code here: https://github.com/briantbutton/BabylonType The stuff there is the same thing as in type.min.js
  5. For the record, my deadpool entry on you bringing up "kerning" was today. I win!
  6. Need. More. Coffee. Jerome, I get the bit about using particle position to position each letter - in broad terms. I am supportive of the notion that polygon strings are constructed so that programmers can use SPS features easily. (The details of the previous sentence probably need more definition, yeah?) But not yet . FIrst I should finish 1.0. But not yet. I need coffee.
  7. Pretty funny illustration of the principle, Wingnut! You and Jerome keep wanting to play with individual letters despite my insistence it is all one SPS. Not much for coloring inside the lines, eh? 😎 Interestingly, the original font data has a bounding box which I have faithfully put into the Babylon format. This example brought to you by the letter A. hnm["A"] = { /* done */ shapeCmds : [[[122,0],[-7,0],[267,714],[400,714],[675,0],[541,0],[474,189],[189,189],[122,0]]], holeCmds : [[[[334,591],[331,591],[223,284],[441,284]]]], xMin : -7, xMax : 675, yMin : 0, yMax : 714, width : 667 }; The only thing I use right now, other than the shape, is the width. I suppose V1.1 could have some support for individual letters.
  8. Deltakosh, you will have one late next week. What do I need to know in terms of form, convention and ceremony? The current repo is here: https://github.com/briantbutton/BabylonType
  9. Quick comment on the data. There are significant differences but I have set it up to be configurable. It takes a day or two (or three) to adjust to a specific city. See https://boston.ma.illuminated.city I also sortof have Chicago and LA running. For example, the crime categories are universal but the crime types are specific to the city data. Targeting any sort of civic organizations means you are in for a grind. Lots of bureacracy. The people in it are not usually technology adept - or even completely awake. Nonetheless I have enjoyed my time so far . . .
  10. JBatUN, hello! We are both working on data visualization, as you noticed. I have focused on public web-based application of civic data. The target is community, leaders and so on. Good luck to you!
  11. Jerome, thank you. Short answer: each string results in one SPS, one material, one mesh. Each letter is its own mesh, initially. In the very last step, Type merges all of the letter meshes into one SPS with its own mesh and disposes of the ingredients. That's only needed if you want to rotate or move the string in the scene. I assumed that is a likely use case, (lookin' at you, Wingnut) so I built it that way. I just realized there are other ways to merge meshes . . . but when I built this, I was most familiar with SPS. Wingnut, I see you figured it out. Cool! That was the kinda stuff I wanted to do for a demo . . . but am not familiar enuf with Babylon . . . . The issue with loading is presumably specific to the way I spliced this onto the playground. The handy thing is to have everything triggered by writer(). https://www.babylonjs-playground.com/#XWVXN9#21
  12. Sorry. "letter-thickness" https://www.babylonjs-playground.com/#XWVXN9#8
  13. Yes. I think some animation would be cool. "dangling participle" comes to mind when I am least expecting it. I see the playground and understand your direction. I should also mention that I took your approach of changing camera focus. A different channel but I will show you when it is done.
  14. Also, blanket advisory: I completely changed the parameter structure going into the new Type() constructor. Better now than later. In the unlikely case that someone is experimenting based on the first playground, please update by reviewing the playground link above.
  15. Deltakosh, glad to hear that. That was what I was aiming for. Give back, you know. The repository is here but is very fluid right now. https://github.com/briantbutton/BabylonType I will commit to keeping the min (https://sanfrancisco.ca.illuminated.city/js/type.min.js) file hosted and current in case anyone wants to do playground stuff in the interim. Wingnut, this might astonish you but I did not follow what you were saying about fonts being vert-heavy. This might relate: The number of faces in a curve is settable but is hard-coded in the Type function. (After extensive consultation with numerology, I picked 6. 6 points per curve.) Some font-families (like Helvetica Neue) have fewer curves than others. I think a letter, like an 'S' is gonna have something like 100 points going into the PolygonMeshBuilder. If the letters are small, or more distant, then that is more vertices than visible to the eye. I don't know how to use LOD. However, I could expose the points-per-curve setting and recommend simpler fonts. Did you crash your browser?
  16. I built this as a side-project too, of course. Looking back, I honestly cannot believe I embarked on it. What possessed me? As Wingnut says, there was preceding work and there were other approaches available. I was not at all sure that Babylon needed a fonts module. The nods I got on the first post on this page and some gesticulations by Wingnut in another area (Wingnut rarely just nods) gave me the necessary impetus.
  17. https://www.babylonjs-playground.com/#XWVXN9#5 Preview version. Comments welcome. Thanks to Gijs and JohnK for technical advice. The impoverished version is here with some glyphs in two fonts. Because of some finickiness in polygons, I am still hand building them. IF YOU SPECIFY A CHARACTER WITHOUT A SHAPE, IT WILL RENDER NOTHING. Hiruko-Pro has most of the alphabet. I probably don't do colors or orientation the way you want but there are easy methods to get the mesh and material and change them as you see fit. Reminder: new Type() returns an object and inserts an SPS into the scene. Interim meshes are disposed. This means that material, position and orientation may be changed with one action. The whole string is turned into a mesh which will have uniform qualities. I am open to bug reports and suggestions but promising *nothing*. Next week, I will have a more complete version.
  18. JohnK, dang! That's an eye-opener. I didn't know we could do that. I have a longstanding tendency to do things the hard way but my little adventure with text this week takes the cake.
  19. Actually, without CSG, I would be very stuck. So JohnK, thank you for suggesting it and showing the way. 😅 I think I have figured out how to handle all of the corner cases and get where I want. As a gesture of appreciation, I will publish a utility which will take: ~ a short string ~ letter height ~ optional: font-name / level-of-detail And will return with an SPS in the form of the text. Orientation, position and material may be managed by manipulating the SPS's mesh as per normal.
  20. Quadear, most excellent! Thanks for posting that code. Made my day.
  21. OK. I take it back. I can use meshes created by CSG to go into an SPS. This means I can assemble multiple glyphs into one mesh, rotate them or move them. Given the other things I was experiencing, it seemed doubtful that would work. But it does! I will leave this open for a few more hours, in case someone would like to comment. Then I will close it again. Thank you for your support and indulgence.
  22. Yes. Thank you. I need a utility that will generate a controllable (rotate/move/color/alpha) mesh from an arbitrary text string on the fly. I viewed that post and visited the demo page. It doesn't meet that description and seems to use other software modules. It seems like a good utility would only be about 200 lines of code, not including the font file. If I am willing to sacrifice rotation and movement, I can use the work-around with CSG. That will work for the immediate future - for me - but won't make for a good utility.
  23. I should probably mention that I also tried to use MeshBuilder.CreatePolygon. In that case, I could see nothing at all. http://playground.babylonjs.com/#4G18GY#35 I tried the usual stuff of reversing the vectors and so on.
  24. Uh. So I am going to say this is unsolved again. The work-around of using CSG led to other weird problems as I pushed it further. The age of that module, the inconsistency between github version and the version embedded in my BABYLON and the fact that it uses "legacy" constructors made me uncomfortable about basing a new module on it. I would prefer to take another path, if possible. (I can describe the problems more if that turns out to be important.) So I went back to the original phenomenon. https://www.babylonjs-playground.com/#PTTMVI#68 Eyeballing it, it looks like there is one rogue triangle, right? Maybe two. So I wrote a little routine to take a look for it. (BTW, I made good use of the CSG code to turn vertices and whatnot into polygons. If at all possible, I would like to make it through this life without actually understanding vertices and indices.) My sifting code found an outlying polygon at number 493 in the 'g' in the playground. See below. Is there a way to solve the original problem? Alternatively, can someone give me instructions on how to excise that poly? Wisdom or contrary points-of-view encouraged.