tentone / potree-core

Potree point cloud viewer library core components for easier integration in a three.js project.
https://tentone.github.io/potree-core/
Other
171 stars 53 forks source link

Pointcloud doesn't play nice with transparent meshes #13

Open leefsmp opened 4 years ago

leefsmp commented 4 years ago

Hi, not sure if this is an issue with potree-core, a side effect, or something to handle differently with my code: We are mixing a large pointcloud with some meshes in the same scene, when selecting a mesh we want to affect it a semi-transparent material.

Here is the selected material, which works fine in a scene with only meshes:

 this.selectedMaterial = 
    new THREE.MeshStandardMaterial({
      transparent: true,
      color: "#2194ce",
      opacity: 0.8
    })

But when loading also a pointcloud, I have to set selectedMaterial.depthTest = false otherwise the selected mesh will mostly be invisible. Looks like there is an object in front which occlude it.

No selection:

Screen Shot 2019-11-05 at 15 14 02

Selection with depthTest = false:

Screen Shot 2019-11-05 at 15 13 29

Selection with depthTest = true:

Screen Shot 2019-11-05 at 15 14 23
tentone commented 4 years ago

Hello

Seems kinda of weird aside from ordering transparent materials are rendered in the same way as other non-transparent ones in three.js.

Are you using logarithmic depth here?, Ensure that youre using LessEqualDepth for the depth function of your object. You can also turn renderer.sortObjects to false and try to ensure that the transparent object if renderer last.

I will try to replicate this soon.

leefsmp commented 4 years ago

Thanks for the feedback, not using logarithmic depth and set explicitly depthFunc: THREE.LessEqualDepth on the selected material, same result unfortunately.

I didn't test sortObjects: false, the meshes and the PC are being loaded in parallel, so I can't test that easily without doing some refactoring and we are ok for now to use depthTest: false. I just wanted to make sure I was not missing something obvious...