[Bug] Adding textures with gaps in the PLYReader 28.3.3
luchen666 opened this issue · 6 comments
Bug description
Load the ply file with vtkPLYReader and add textures with vtkTexture, but the added textures have gaps.
It is normal to load the same file using meshLab software.
Steps to reproduce
const reader = vtkPLYReader.newInstance();
const mapper = vtkMapper.newInstance({ scalarVisibility: false });
const actor = vtkActor.newInstance();
actor.setMapper(mapper);
mapper.setInputConnection(reader.getOutputPort());
reader
.setUrl(lowerFolder)
.then(async (res) => {
const fullScreenRenderer = vtkFullScreenRenderWindow.newInstance();
let renderer = fullScreenRenderer.getRenderer();
let renderWindow = fullScreenRenderer.getRenderWindow();
const text = await reader.getDataAccessHelper().fetchText(null,lowerFolder);
const headText = text.split("end_header")[0];
const TextureFile0 = headText.split("TextureFile")[1];
const textureUrl = TextureFile0.split("\n")[0].trim();
const image = new Image();
image.src = folder + textureUrl;
const texture = vtkTexture.newInstance();
texture.setInterpolate(true);
texture.setImage(image);
actor.addTexture(texture);
renderer.addActor(actor);
setTimeout(() => {
renderWindow.render();
fullScreenRenderer.getInteractor().render();
}, 200);
if (renderer && renderWindow) {
const resetCamera = renderer.resetCamera;
const render = renderWindow.render;
resetCamera();
render();
}
})
Detailed Behavior
No response
Expected Behavior
The PLYReader and class vtkTexture correctly loads.
If the PLYReader class can automatically read the jpg address in the ply file, it would be perfect
Environment
- vtk.js version: 28.3.3 & 25.15.2
- Browsers: chrome 114.0.5735.248
- OS: Windows 11
Yes, we are missing the DuplicatePointsForFaceTexture logic from VTK
https://github.com/Kitware/VTK/blob/e95816ae906b046c8168d1fa45c77e86b4faac8f/IO/PLY/vtkPLYReader.cxx#L529-L600C14
@luchen666 can you provide an example file with the texture?
@luchen666 didn't DuplicatePointsForFaceTexture
work for you ?
@finetjul we don't support DuplicatePointsForFaceTexture yet, that's the missing part in the JS version.
It shouldn't be too hard, it was done for the objreader if I remember correctly.