Jump to content

Giving some thickness to LineMesh


sparkbuzz
 Share

Recommended Posts

I'm currently faking line thickness by creating lines as slim planes. The problem is however, that as the view changes, and the plane is viewed from the side, it eventually disappears, as it has no volume.

 

To counter this, I was thinking about creating two planes between the lines start and end point, at right angles of each other, alternatively I was thinking about creating a line as a long cylinder, but this seems to be a bad way to approach as drawing lines as cylinders isn't the most resource friendly approach.

 

Is there a better way to give thickness to a line in BabylonJS, perhaps by using a shader of some kind?

 

 

Link to comment
Share on other sites

Giving thickness > 1px to a line is not possible in OpenGL ES 2.0, which is the version used by BabylonJS.

 

What you could do is rotate the planes that act as grid lines along their axis, depending on the camera's position. I've setup an example with grid lines on one axis only:

http://www.babylonjs-playground.com/#HV9RU#2

 

Not great performance wise though...

Link to comment
Share on other sites

Thanks jahow, love the overlay effect, definitely going to look at your code sample after work today. I was thinking about rotating the planes towards the camera but my lack in mathematical skills lead me to rather not take this approach. You'r post helps a lot!

 

Thanks so much for posting!

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