Noise on mesh when moving THREE.MeshLine to BJS

PG: https://playground.babylonjs.com/#W0NG5F#2.
threejs meshline: THREE.MeshLine/THREE.MeshLine.js at master · spite/THREE.MeshLine · GitHub
Sorry that I can’t make the problem clearly. I’m trying to move meshline from threejs to BJS but I find there are lots of noise on mesh, it is even all black at first. You can see the noise by moving the camera.
I recognize that things are better on winding part (by commenting line 191 and uncommenting line 190), so I guess maybe that there is something I didn’t know about rendering.

Adding @nasimiasl as I have no idea about the custom material.

I am pretty sure the normals would be the issue as they are not passed into the fragment.

It should be! Now it works fine. Thank you so much!
https://playground.babylonjs.com/#W0NG5F#3

----- update -----
https://playground.babylonjs.com/#W0NG5F#5
vNormal should be vec3(0, 1, 0);

Nice work!!!

hey worldViewProjection is exist in PBR Custom Material

@tanpopo It is kind of a cool feature, I wonder how we could add this in standard ?

It seems not. I didn’t recognize this until there is nothing without set worldViewProjection. You can try to comment line 168 and the mesh disappear, but there is possibility I did something wrong.

Of course! Is there anything that I need to do?

This would require to not use custom material but being supported in standard but I wonder how hard it could be to pull it ?

I think it can be a class extends PBRMaterial, kind of being like PBRCustomMaterial, but with its own shader? Or do you just mean a material in materialsLibrary?
Anyway I’m willing to have a try though I’m not sure if I’m able to accomplish this.

no problem we could definitely help and discuss on the PR :slight_smile:

Sorry for the late response. I didn’t have much time days before and I was just able to start this thing.

I think it’s kind of weird that we have to make a special mesh(which needs an array fo vectors) to use this material in standard. So actually I think it’s better to make it a external lib just like threejs meshline does.

I have 2 plans if it’s better to put it in standard, first is make it the same with watermaterial, but it will lose most of params of PBR, second is make it a class extends PBRBaseMaterial.

Which one do you think a better solution? I’m not really sure.

This sounds edge case to be placed directly in the PBR material so extending through the Custom one might be more adapted here, also maybe it could be just a node to help ppl achieving it with the Node Material so it won t be limited to pbr only ?

Just wanted to say this is pretty cool! It’s pretty nice to see how well it interacts with the existing PBR materials. I added refraction to it just to see what would be like and it looks very interesting: :smiley:

image

@tanpopo have you had a chance to look into @sebavan 's suggestion? Would you like any more help? :grinning_face_with_smiling_eyes:

Actually I’m working on it slowly. The main problem is time. :upside_down_face: