# Noise on mesh when moving THREE.MeshLine to BJS

**URL:** <https://forum.babylonjs.com/t/noise-on-mesh-when-moving-three-meshline-to-bjs/24495>\
**Category:** Questions\
**Tags:** material\
**Created:** [October 12, 2021, 2:23am UTC](https://forum.babylonjs.com/t/noise-on-mesh-when-moving-three-meshline-to-bjs/24495 "2021-10-12T02:23:47Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![tanpopo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tanpopo/32/32025_2.png) [@tanpopo](https://forum.babylonjs.com/u/tanpopo)\
**Post date:** [October 12, 2021, 2:23am UTC](https://forum.babylonjs.com/t/noise-on-mesh-when-moving-three-meshline-to-bjs/24495/1 "2021-10-12T02:23:47Z")

</div>

PG: [https://playground.babylonjs.com/#W0NG5F#2](https://playground.babylonjs.com/#W0NG5F#2).  
threejs meshline: [THREE.MeshLine/THREE.MeshLine.js at master · spite/THREE.MeshLine · GitHub](https://github.com/spite/THREE.MeshLine/blob/master/src/THREE.MeshLine.js)  
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.

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [October 12, 2021, 2:31am UTC](https://forum.babylonjs.com/t/noise-on-mesh-when-moving-three-meshline-to-bjs/24495/2 "2021-10-12T02:31:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [October 12, 2021, 2:33am UTC](https://forum.babylonjs.com/t/noise-on-mesh-when-moving-three-meshline-to-bjs/24495/3 "2021-10-12T02:33:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tanpopo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tanpopo/32/32025_2.png) [@tanpopo](https://forum.babylonjs.com/u/tanpopo)\
**Post date:** [October 12, 2021, 3:03am UTC](https://forum.babylonjs.com/t/noise-on-mesh-when-moving-three-meshline-to-bjs/24495/4 "2021-10-12T03:03:43Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![Moriy](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/moriy/32/30563_2.png) [@Moriy](https://forum.babylonjs.com/u/Moriy)\
**Post date:** [October 12, 2021, 3:43am UTC](https://forum.babylonjs.com/t/noise-on-mesh-when-moving-three-meshline-to-bjs/24495/5 "2021-10-12T03:43:36Z")

</div>

Nice work!!!

---

<div class="post-metadata">

**Author:** ![nasimiasl](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/nasimiasl/32/34_2.png) [@nasimiasl](https://forum.babylonjs.com/u/nasimiasl)\
**Post date:** [October 12, 2021, 8:44am UTC](https://forum.babylonjs.com/t/noise-on-mesh-when-moving-three-meshline-to-bjs/24495/6 "2021-10-12T08:44:07Z")

</div>

hey worldViewProjection is exist in PBR Custom Material

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [October 12, 2021, 12:53pm UTC](https://forum.babylonjs.com/t/noise-on-mesh-when-moving-three-meshline-to-bjs/24495/7 "2021-10-12T12:53:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tanpopo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tanpopo/32/32025_2.png) [@tanpopo](https://forum.babylonjs.com/u/tanpopo)\
**Post date:** [October 12, 2021, 1:47pm UTC](https://forum.babylonjs.com/t/noise-on-mesh-when-moving-three-meshline-to-bjs/24495/8 "2021-10-12T13:47:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![tanpopo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tanpopo/32/32025_2.png) [@tanpopo](https://forum.babylonjs.com/u/tanpopo)\
**Post date:** [October 12, 2021, 1:48pm UTC](https://forum.babylonjs.com/t/noise-on-mesh-when-moving-three-meshline-to-bjs/24495/9 "2021-10-12T13:48:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [October 12, 2021, 2:40pm UTC](https://forum.babylonjs.com/t/noise-on-mesh-when-moving-three-meshline-to-bjs/24495/10 "2021-10-12T14:40:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tanpopo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tanpopo/32/32025_2.png) [@tanpopo](https://forum.babylonjs.com/u/tanpopo)\
**Post date:** [October 12, 2021, 3:46pm UTC](https://forum.babylonjs.com/t/noise-on-mesh-when-moving-three-meshline-to-bjs/24495/11 "2021-10-12T15:46:49Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [October 12, 2021, 3:52pm UTC](https://forum.babylonjs.com/t/noise-on-mesh-when-moving-three-meshline-to-bjs/24495/12 "2021-10-12T15:52:00Z")

</div>

no problem we could definitely help and discuss on the PR 🙂

---

<div class="post-metadata">

**Author:** ![tanpopo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tanpopo/32/32025_2.png) [@tanpopo](https://forum.babylonjs.com/u/tanpopo)\
**Post date:** [November 1, 2021, 2:30pm UTC](https://forum.babylonjs.com/t/noise-on-mesh-when-moving-three-meshline-to-bjs/24495/14 "2021-11-01T14:30:12Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [November 2, 2021, 2:57pm UTC](https://forum.babylonjs.com/t/noise-on-mesh-when-moving-three-meshline-to-bjs/24495/15 "2021-11-02T14:57:26Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [November 4, 2021, 12:09pm UTC](https://forum.babylonjs.com/t/noise-on-mesh-when-moving-three-meshline-to-bjs/24495/16 "2021-11-04T12:09:39Z")

</div>

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: 😃

![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/5/6/56793dc6f08424c6c38196503aa733d4a5a73ca6.jpeg)

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [December 3, 2021, 1:25pm UTC](https://forum.babylonjs.com/t/noise-on-mesh-when-moving-three-meshline-to-bjs/24495/17 "2021-12-03T13:25:11Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tanpopo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tanpopo/32/32025_2.png) [@tanpopo](https://forum.babylonjs.com/u/tanpopo)\
**Post date:** [December 6, 2021, 2:26pm UTC](https://forum.babylonjs.com/t/noise-on-mesh-when-moving-three-meshline-to-bjs/24495/18 "2021-12-06T14:26:37Z")

</div>

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