Kitware/vtk-js

[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

ply01

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
daker commented

@luchen666 can you provide an example file with the texture?

@daker The ply file is here

@luchen666 didn't DuplicatePointsForFaceTexture work for you ?

daker commented

@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.