admin管理员组

文章数量:1314488

I am using Three.js's example in the directory:

three.js/examples/webgl_loader_ply.html

And I just swapped their .ply file with mine (made with Blender).

In Blender, I went Vertex Paint > and painted vertices. Before exporting to .ply, I made sure that all checkboxes where checked. And scale is 100.

But the .ply model renders as blue in the three.js's example. (just like the default example). And apparently it is blue because of this code in the example html file:

var geometry = event.content;
var material = new THREE.MeshPhongMaterial( { color: 0x0055ff, specular: 0x111111, shininess: 200 } );
var mesh = new THREE.Mesh( geometry, material );

I was 100% sure that ply files have color values saves as well. But, what am I supposed to do now if that code makes my model blue? Or did I do something wrong in Blender?

I am totally not familiar with Three.js and webGL because I started to learn it just yesterday. Can anyone enlighten me on what is going on and what to do next?

I am using Three.js's example in the directory:

three.js/examples/webgl_loader_ply.html

And I just swapped their .ply file with mine (made with Blender).

In Blender, I went Vertex Paint > and painted vertices. Before exporting to .ply, I made sure that all checkboxes where checked. And scale is 100.

But the .ply model renders as blue in the three.js's example. (just like the default example). And apparently it is blue because of this code in the example html file:

var geometry = event.content;
var material = new THREE.MeshPhongMaterial( { color: 0x0055ff, specular: 0x111111, shininess: 200 } );
var mesh = new THREE.Mesh( geometry, material );

I was 100% sure that ply files have color values saves as well. But, what am I supposed to do now if that code makes my model blue? Or did I do something wrong in Blender?

I am totally not familiar with Three.js and webGL because I started to learn it just yesterday. Can anyone enlighten me on what is going on and what to do next?

Share Improve this question edited Jul 15, 2015 at 14:22 WestLangley 105k11 gold badges287 silver badges283 bronze badges asked Jul 15, 2015 at 8:54 BorissOliSiinBorissOliSiin 3371 gold badge5 silver badges14 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 10

i was missing this property vertexColors: THREE.VertexColors. All was fine with Blender and the code apart from the property. It works as expected now.

Here is how the line of code should look like:

var material = new THREE.MeshPhongMaterial( { color: 0xffffff, specular: 0x111111, shininess: 200, vertexColors: THREE.VertexColors} );

本文标签: javascriptThreejsply fileswhy colorlessStack Overflow