Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Adding textures with gaps in the PLYReader 28.3.3 #2877

Open
luchen666 opened this issue Jul 25, 2023 · 6 comments
Open

[Bug] Adding textures with gaps in the PLYReader 28.3.3 #2877

luchen666 opened this issue Jul 25, 2023 · 6 comments
Labels
module: I/O type: bug 🐞 Errors in functionality

Comments

@luchen666
Copy link

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
@luchen666 luchen666 added the type: bug 🐞 Errors in functionality label Jul 25, 2023
@daker
Copy link
Collaborator

daker commented Jul 25, 2023

Yes, we are missing the DuplicatePointsForFaceTexture logic from VTK
https://github.com/Kitware/VTK/blob/e95816ae906b046c8168d1fa45c77e86b4faac8f/IO/PLY/vtkPLYReader.cxx#L529-L600C14

@daker
Copy link
Collaborator

daker commented Jul 25, 2023

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

@luchen666
Copy link
Author

@daker The ply file is here

@finetjul
Copy link
Member

finetjul commented Aug 7, 2023

@luchen666 didn't DuplicatePointsForFaceTexture work for you ?

@daker
Copy link
Collaborator

daker commented Aug 7, 2023

@finetjul we don't support DuplicatePointsForFaceTexture yet, that's the missing part in the JS version.

@finetjul
Copy link
Member

finetjul commented Aug 7, 2023

It shouldn't be too hard, it was done for the objreader if I remember correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: I/O type: bug 🐞 Errors in functionality
Projects
None yet
Development

No branches or pull requests

3 participants