Jump to content

Merging and array of LineMeshes


Recommended Posts

Is there a way to merge an array of LineMeshes?


I have the following playground sample: http://www.babylonjs-playground.com/#1DSDHD


which renders a grid, but looking at the debug overlay, we can see this creates 11 meshes with 2 vertices each. Is it possible to merge these with BABYLON.Mesh.MergeMeshes?


I tried this here: http://www.babylonjs-playground.com/#EDMD1#1


but clearly this doesn't work as well.


I'd like my line meshes to belong to a single mesh object.

Link to comment
Share on other sites



I don't think there's an easy way to do that: line meshes are drawn as one single stroke. You can have as many points in your stroke as you want though, so if you're looking to do a grid with this you can probably find a way to draw the whole grid without "lifting the pen" :)

Link to comment
Share on other sites

He wants some of his lines to be triple thickness.  :)   http://www.html5gamedevs.com/topic/15733-giving-some-thickness-to-linemesh/


Majors?  Is that what they call thicker-than-normal lines on a grid?  Major grads and minor grads?   *shrug*  (yawn)


LinesGridMaker v1.0  :)  I would say Babylon.Mesh.CreateGrid() but...  it's not quite right for that.  Grid.getVertexData() would flop like a Sammy Girardin ragdoll.


I like to use a PICTURE of a grid... with alpha. That way you can paint pretty vines and flowers...  on the grid lines... some little people entangled in the wires... grass and squirrels, etc.  sigh. 

Link to comment
Share on other sites

  • 1 month later...

Long think.  :)


We got the new edgesRenderer now... thx DK.




I wonder if edges rendering works on Lines mesh. 


Sparkbuzz has a related thread going... http://www.html5gamedevs.com/topic/15733-giving-some-thickness-to-linemesh/


Dad72 and Elkyu pondered this, too, as we can see.


Jahow made a cool PG demo in that thread (I de-zoomed the camera a bit and re-saved the PG, but he is the author.)  He has made certain lines wider... somehow... I haven't really studied it yet.  I think he SCALED certain lines to make them thicker/major.  See?  That's why he gets the big money.  ;)


Deltakosh has done that, too, many times, at least for me.  I'll think-up some huge 40-code-line thing to accomplish something fancy... and then he'll say something like..."Or you COULD just change this value and that value." and he gets my 40 lines done in 2 lines.  *sigh*.


And then worse than all this... I'll forget about that cool trick in about 2 days.  Gettin' old.  Brain fail. 


ANYway... yep, somebody should try the edgeRenderer on Lines mesh.  Jahow's method just doesn't burn enough code lines, it's not complicated enough, and it doesn't reduce performance properly.  :)

Link to comment
Share on other sites


Ok, here is my BJS backlog for now :


- reimplement the cylinder without ribbon

- check tube and lathe caps (low priority)

- implement cuboid as the first extensible mesh type (with param object)

- add regular polyhedrons as new mesh types

- port the SPS into BJS

- add the grid mesh


huu.. and I don't speak about my other backlogs here : work, confs, home, etc


only 24 h per day on this planet, gasp


If someone in this forum could slow down the earth rotation speed please, he would be welcome :P

Link to comment
Share on other sites

Sorry Jerome, I didn't mean to make you feel overloaded.  Thanks for sharing your todo list... that all sounds excellent.  For those who are new to Jerome's magic... he has created MANY geometry-wrangling toys around here, including parametric shapes like ribbons, tubes, and 3DPath, and he did the fantastic Spherical Harmonics thing, he's done morphing, he's made non-physics-engine cannonball shooters that work great, he writes excellent tutorials and forum posts, on and on, all good.  He's a serious hero of mine. I worship the water he walks-on.


Thanks Jerome!


And look at his face... https://avatars0.githubusercontent.com/u/11529 !!  George Clooney, eat your heart out!  If the French film industry doesn't somehow utilize this power-asset, then they're just nuts.  Sure, we might lose him as our local geometry God for a while, but he'll soon be rich enough as a movie star... to fly us all to Paris for the BJS convention (and his latest movie opening)... and that rocks! :)

Link to comment
Share on other sites

:D :D :D

ass kissing as I love !


BJS convention would just be huge.


I wish I can do all this stuff quickly, especially the polyhedron and SPS part what are exciting (to me, at least).


I need to reimplement the cylinder because the cylinder is a fixed mesh, not a parametric one like the tube or the ribbon, and I really want it to have perfect normals everywhere.

Perfect normals ? wadafack ???

Am I suggesting there are somewhere imperfect normals ?


Actually, in some very particular cases that are too complex to explain here, the computeNormals() method, our big magic tool used quite everywhere under the hood, computes some normals that appear weird.

Don't worry, it happens only on some vertices, among many many,  only on mesh edges and you generally can hardly notice them.

It's not a bug (threejs does the same), it's just an exotic case in the initial configuration of the vertices that produces this behavior.

So I suppose we can tolerate these tiny variations on (unpredictable) parametric shape edges but, as we can avoid them because we know the final shape on fixed mesh types, I would prefer to re-implement the cylinder with no underlying ribbon.


Re-doing things is not the fun part, pfffff

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.

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.


  • Recently Browsing   0 members

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