Jump to content

Problem with enableEdgesRendering


Recommended Posts

Hello :)

I have a problem with "enableEdgesRendering" from "createLines".

When I activate the function several imaginary line connects to the middle of my ground.

When this function is not activate lines are displayed correctly.

See attached files, I have print screen.


Have a nice day.




Link to comment
Share on other sites


First off, I am not really experienced with uhm...  mesh.enableEdgesRendering();

What I think about it though, I think mesh.enableEdgesRendering() is commonly used with objects with "faces" specifically, with cubes for example or even planes (they all have faces!). Here in docs it explains itself very well: BABYLON.EdgesRenderer is a tool used to render edges on top of a mesh. Edges are rendered between two faces if the dot product of their normals is less than epsilon.  So I think you need "faces" to have edges in the first place, and since lines don't have faces at all, using enableEdgesRendering() on them is not really uhh... productive? 

Correct me if I'm wrong


Edit: Maybe you can create a little Playground Demo to demonstrate your problem?

Link to comment
Share on other sites

no PG ?

ok, let's assume you've got mesh1 and mesh2

you could, say, set a first array with  var path1 = [mesh1.position, mesh2.position]

you could then set another array path2, with some vector3 shifted from the mesh positions of the thickness you want

example : shift +2 on x

var v1 = mesh1.position.add(new BABYLON.Vector3(2, 0, 0));
var v2 = mesh2.position.add(new BABYLON.Vector3(2, 0, 0));

var path2 = [v1, v2];

this will give you the needed pathArray for your ribbon

var pathArray = [ path1, path2 ];

then maybe you should display this ribbon in BILLBOARD mode so it ever faces the camera


[EDIT] : http://www.babylonjs-playground.com/#1OLKMJ#2

line 74, change the thickness value

you can obviously center the ribbon better than I, say, by shifting its first path by -thickness / 2 and its second one by +thickness / 2

Link to comment
Share on other sites

Hi Gerde/DK/Jerome/all!

    @GERDE - there is a topic on the forum named "cylinder between two points" that would likely be helpful.

Will your lines always we STRAIGHT lines?  Or do you need some curves in the lines?

There was a friendly chap named Alby here on the forum for some time.  (You might want to read his posts.)  He needed text written on the sides of his "thing between two points"... and we did lots of work on his project.... trying to get that text to be long and thin, and trying to get it 'billboarded' (text always faces camera).  It may be worthwhile to read his threads and see his playgrounds.

To save yourself from possible high vertex counts with tubes and cylinders, maybe a square line (made from a box).  But tubes can be square, too, and with minimum path points, they can be low-vertex count.

As a quick addition to what Jerome has said...  ribbons and tubes are built using similar methods.  They both use "path".  Jerome might need to verify this, but I think a ribbon is just one "side" of a 3-or-more-sided tube.  Using the tube, you won't need to concern yourself with billboarding (making the "face" of the ribbon always face the camera, no matter the viewing angle).  Using a scaled cylinder, scaled box, or 3+ sided tube, your connecting line will always have thickness, no matter the viewing angle.

Did I say all this correctly, experts?  I hope so.  Be well!

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...