1

I am trying to show a point cloud in Threejs, but the result is always flat (not affected by light), and no shading is rendered, is there a way to make it more realistic with shading and shadows (something like Meshlab for example). or is it a limitation in Threejs?

I am using THREE.Points object, with THREE.PointsMaterial material. I tried to use the option vertexColors: THREE.VertexColors, but only flat colors appear.

points = new THREE.Points(geometry, new THREE.PointsMaterial({
    size: 1.2,
    vertexColors: THREE.VertexColors
}));

Compare threejs rendering to the left, with meshlab rendering to the right

WestLangley
  • 102,557
  • 10
  • 276
  • 276
  • can you show a demo(jsfiddle) – Madhawa Priyashantha Jun 09 '16 at 09:52
  • see the screenshot [here](http://i.stack.imgur.com/VhQO0.png), and compare threejs rendering to the left, with meshlab rendering to the right – Ammar Hattab Jun 09 '16 at 10:13
  • 1
    You need to write a custom `ShaderMaterial` to do that. See [this answer](http://stackoverflow.com/a/12344288/1461008) for a link to an example of a custom shader when using `THREE.Points`. You have to pass a the vertex normal as an attribute to the shader. – WestLangley Jun 09 '16 at 18:26

0 Answers0