Closed chriscarex closed 8 years ago
Hi Chris, sorry for the delay we were away on vacation.
The CTM loader doesn't support vertex colors right now. Assuming the third party library we use to parse the CTM file (js-openctm) handles the colors they should be easy to add to the loader. Just add the following lines to the createXflowDataNode
function:
if (file.attrMaps[0].name == "color") //Not sure what this check will be exactly but you get the idea
xflowDataNode.appendChild(createInputNode("color", "float3", file.attrMaps[0].attr));
And in this case the colors should be 3 component vectors between [0,1], so you may have to convert them to that range before you use the data in createInputNode
.
Thank you very much for your reply - I'll try and let you know if that works! Christian
If it does feel free to open a pull request and I'll merge it in.
Also don't forget to enable vertex colors in the material you're using to render the mesh:
<material model="urn:xml3d:material:phong">
<bool name="useVertexColor">true</bool>
</material>
Hi all, I am currently using the openctm plugin which works very well. I am having problems with vertex colors though. Is vertex color implemented in the openctm plugin? Is yes, I am trying to make a ply file format and convert it to openctm for visualisation.
Is this a good format? or should I keep for colors property uchar red and then for example on vertex 0 0 0 100 200 255 ?
ply format ascii 1.0 element vertex 8 property float x property float y property float z property float red property float green property float blue element face 7 property list uchar int vertex_index end_header 0 0 0 0.1 0.2 0.3 0 0 1 0.2 0.3 0.4 0 1 1 0.5 0.6 0.7 0 1 0 0.8 0.9 1 1 0 0 0.2 1 0.5 1 0 1 1 1 1 1 1 1 0 0 0 1 1 0 0 0.5 0.4 3 0 1 2 3 0 2 3 3 7 6 5 3 6 5 4 3 0 4 5 3 4 5 1 3 1 5 6 3 5 6 2 3 2 6 7 3 6 7 3 3 3 7 4 3 7 4 0
It's strange that the shape in the code appears in the viewer but it's just black - wondering if I just need normals or it's a color format problem! Thanks in advance, Christian