Jump to content

Line width similar to LineRenderer in Unity


rgalindox
 Share

Recommended Posts

Hello guys,

I'm investigating BabylonJS for our next project at the company, we have our current application built in Unity and exported to WebGL, it is working pretty well however BabylonJS seems a great alternative in terms of portability to other platforms specially mobiles. We relay a lot on line renderers into the application as we crate many items on the fly, but I see the line function in BabylonJS doesn't support width. Someone has a workaround to have lines wider on scenes? I've tried tubes but they don't look very well compared to a line drawn on the fly as I have a function that smoothes the lines using interpolation.

Thanks in advance

Link to comment
Share on other sites

7 hours ago, Kesshi said:

Lines with a custom width are not possible with WebGL (at least not on windows plattforms).
You have to simulate it with triangles. You can have a look here: https://mattdesl.svbtle.com/drawing-lines-is-hard
In my project i created a basic implementation of that technique by creating a custom BabylonJS mesh and a shader.

Thanks Kesshi, I'm wondering how Unity implemented this when exporting to WebGL as it looks exactly as exporting to other platforms.

Link to comment
Share on other sites

10 hours ago, jerome said:

A workaround could be to use Ribbons in billboard mode.

I'm playing around ribbons and they are awesome, as I can to my lines in parallel and then apply the ribbon, looks great! Do you know if the resulting ribbon is a mesh that can be clicked on? I'll test this shortly but wondering if you already tested this.

Thanks

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