BabylonJS MeshLine - a port of THREE.MeshLine

Gonna perftest it, thank you!

I’ve read about this, but it should be casted to float I believe and it’s performance penalty, as I read, but perftest will show the results! Many thanks for both suggestions!

EDIT: Did you notice we are talking about shader code? :slight_smile:


Bad luck - switch and the second solution runs at the same speed (approx.) as the if’s. :wink:

EDIT: I think, we could see some different result using different approaches on mobile GPUs, what I’ve learned from reading articles about GPU optimizations.

The easiest (and fastest) way would be to have a single colorMode property in the material plugin and use a define to set the value in the shader, something like:

@Evgeni_Popov thank you!

I was thinking about this solution. I use defines for dealing with the color property:

I didn’t use it because I could imagine a situation where the user wants to implement mouse over highlighting of the line just by changing the colorMode to SET from other modes and as you said previously recompilation of the shader is a heavy task. What’s your opinion?

Indeed, in this case, passing the colorMode as a uniform variable and testing all 3 values is the best solution. Branching when the condition involves only uniform variables is normally not very expensive.

1 Like

Related to drawing lines, I have implemented this paper from Emil Person to draw thin wires:

Maybe it will be useful to some people.

1 Like

Thanks man! I am already past the worst part, still coughing though but I couldn’t resist to smoke and I am just having one :see_no_evil: I am convincing myself that the 70% oxygen I receive will balance it out :joy:

It throws en error:

I don’t know what this error is but it’s not related to the PG (I also get it sometimes)

Pay attention to your body’s signals, Roland. Get well soon! :sunny:

1 Like

After a few times it started without the error but now.

I believe, it is because I am using a Mac.

It must be because uniform buffers are not supported on your system, so you should make sure that the “fragment” section of getUniforms is correct.

For eg, in this PG, it is:

getUniforms() {
    return {
        "ubo": [
            { name: "myColor", size: 3, type: "vec3" },
            `#ifdef COLORIFY
                uniform vec3 myColor;

All uniforms that appear in the “ubo” section should also be defined in the “fragment” section.

1 Like

Guys, @RaananW,
how can I ensure that my tree shakeable single functions from Misc/greasedLineTools.ts are put not directly under the BABYLON namespace, but under BABYLON.GreasedLineTools?

EDIT: I’ve tried namespacing the functions or export * as GreasedLineTools from “./greasedLine” in index.ts but I could get it working in Playground. Actually it was OK, just the intellisense didn’t work :smiley:

EDIT: If i don’t use class methods I don’t get intellisens at all:

1 Like

I think I am ready for the first PR. However the intellisense issue is still a thing. Should I refactor to static class methods?


EDIT: I need to be hospitalized for a few days. I started to feel better, but today suddenly I started to feel much worse, I was at the doctors in the morning and just got a call from the doc that I’ve a bacterial infection of the respiratory system and that sucker seems to ATB resistent + I was COVID possitive… So… Fuck me dead… I’ll hopefully get back alive on Tuesday :smiley: :muscle: Just to be sure, current sources:


Ohhhhh just seen the edit… feel better soon @roland !!!

@RaananW will be able to have a look soon for the API.

1 Like

quit smoking, get some snus or dip, works better anyway


Yep, I’ll check this weekend or beginning of next week

1 Like

Hello, I am back and I feel much better! Thanks guys!

1 Like

I didn’t create a PR yet. Can you please check my previous posts about the intellisense issue?


to ge tthe typing in UMD you will need to export your class and functions from a referenced index.ts. To allow tree-shaking in es6 you just need to be sure to not reference those functions from any other class.
But i’ll really need to see some code (if possible) to recommend the best way to go here.