Three.js - ply文件 - 为什么无色? [英] Three.js - ply files - why colorless?
问题描述
我在目录中使用Three.js的示例:
I am using Three.js's example in the directory:
three.js/examples/webgl_loader_ply.html
我只是将他们的.ply文件换成了我的(用Blender制作)。
And I just swapped their .ply file with mine (made with Blender).
在Blender中,我选择了Vertex Paint>并绘制了顶点。在导出到.ply之前,我确保选中所有复选框。并且比例为100。
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.
但.ply模型在three.js的示例中呈现为蓝色。 (就像默认示例一样)。显然它是蓝色的,因为示例html文件中的代码:
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 );
我100%确定ply文件也保存了颜色值。但是,如果该代码使我的模型变成蓝色,我现在应该怎么做?或者我在Blender做错了什么?
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?
我对Three.js和webGL完全不熟悉,因为我昨天开始学习它。任何人都可以告诉我发生了什么以及接下来该做什么?
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?
推荐答案
我错过了这个属性 vertexColors:THREE.VertexColors
。
一切都很好,Blender和除了酒店的代码。它现在按预期工作。
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.
以下是代码行的样子:
var material = new THREE.MeshPhongMaterial( { color: 0xffffff, specular: 0x111111, shininess: 200, vertexColors: THREE.VertexColors} );
这篇关于Three.js - ply文件 - 为什么无色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!