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

Obj's with tga textures don't get their textures displayed #1281

Open
Git-i opened this issue Feb 10, 2024 · 12 comments
Open

Obj's with tga textures don't get their textures displayed #1281

Git-i opened this issue Feb 10, 2024 · 12 comments
Labels
good first issue Good for newcomers help wanted Please help with this issue! source:VTK
Milestone

Comments

@Git-i
Copy link

Git-i commented Feb 10, 2024

Describe the bug
Obj imports don't support .tga textures

To Reproduce
Steps to reproduce the behavior:

  1. Open any obj file with a .tga texture

Expected behavior
The file loads and the texture is displayed

System Information:

  • OS: Windows 11
  • GPU and GPU driver: NVIDIA Geforce RTX 3050M

F3D Information
F3D 2.3.0

F3D - A fast and minimalist 3D viewer
Version: 2.3.0.
Build date: 2024-01-21 19:20:59.
Build system: Windows 64-bits.
Compiler: MSVC 19.37.32826.1.
External rendering module: ON.
Raytracing module: OFF.
VTK version: 9.3.0-1702-geb008dfe7b (date: 20240111).
Copyright (C) 2019-2021 Kitware SAS.
Copyright (C) 2021-2024 Michael Migliore, Mathieu Westphal.
License BSD-3-Clause.
By Michael Migliore, Mathieu Westphal and Joachim Pouderoux.

@mwestphal
Copy link
Contributor

vtkOBJImporter indeed does not support TGA texture for now. It would be nice to add and should not be that hard. wdyt @Meakk ?

@mwestphal mwestphal added the type:enhancement New feature or request label Feb 10, 2024
@mwestphal mwestphal added this to F3D Feb 10, 2024
@Meakk
Copy link
Member

Meakk commented Feb 11, 2024

Isn't it using the image factory?

@mwestphal mwestphal changed the title Obj's with tga textures don't get thier textures displayed Obj's with tga textures don't get their textures displayed Apr 4, 2024
@mwestphal mwestphal moved this to Investigate in F3D Apr 4, 2024
@mwestphal mwestphal added this to the 2.5.0 milestone Apr 4, 2024
@Meakk
Copy link
Member

Meakk commented Apr 26, 2024

The problem is indeed in VTK. In the file IO/Import/vtkOBJImporterInternals.cxx, function bindTexturedPolydataToRenderWindow, a bunch of image formats are tested (TIFF, PNG, JPG, BMP), but it should be changed to use the image reader factory.

e.g.

auto reader = vtkSmartPointer<vtkImageReader2>::Take(
    vtkImageReader2Factory::CreateImageReader2(textureFilename.c_str()));

  if (reader)
  {
    reader->SetFileName(fullPath.c_str());
    reader->Update();
    vtkSmartPointer<vtkTexture> vtk_texture = vtkSmartPointer<vtkTexture>::New();
    vtk_texture->AddInputConnection(reader->GetOutputPort());
    actor->SetTexture(vtk_texture);
    knownTextures[textureFilename] = vtk_texture;
  }

@Meakk Meakk added good first issue Good for newcomers source:VTK labels Apr 26, 2024
@Meakk Meakk moved this from Investigate to To do in F3D Apr 26, 2024
@mwestphal
Copy link
Contributor

Nice find, should be simple indeed.

@mwestphal mwestphal added the help wanted Please help with this issue! label Apr 27, 2024
@mwestphal mwestphal modified the milestones: 2.5.0, 3.0.0 Jul 3, 2024
@mwestphal mwestphal modified the milestones: 3.0.0, 3.1.0 Jul 13, 2024
@gapry
Copy link

gapry commented Oct 7, 2024

I'd like to work on this issue. Could you please assign it to me?

@Meakk
Copy link
Member

Meakk commented Oct 7, 2024

Nice. Thanks!

@mwestphal
Copy link
Contributor

@gapry any news on this ?

@gapry
Copy link

gapry commented Nov 1, 2024

@mwestphal Sorry, I need more time, I anticipate having the first patch ready between the 15th and 17th of this month.

@mwestphal
Copy link
Contributor

No worries!

@gapry
Copy link

gapry commented Nov 17, 2024

I'm sorry, I haven't finished yet.

But I have some process, please see the PR: #1719

@mwestphal
Copy link
Contributor

If you have any question on how to fix this please reachout and ask :)

@mwestphal
Copy link
Contributor

Open to contribution for now :)

@mwestphal mwestphal removed the type:enhancement New feature or request label Jan 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Please help with this issue! source:VTK
Projects
Status: To do
Development

No branches or pull requests

4 participants