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

FBXLoader: Fbx Models containing .tif-format textures do not work #24416

Closed
0xLiang233 opened this issue Aug 2, 2022 · 7 comments
Closed

FBXLoader: Fbx Models containing .tif-format textures do not work #24416

0xLiang233 opened this issue Aug 2, 2022 · 7 comments

Comments

@0xLiang233
Copy link

hey
When I use an fbx model with a .tif-format texture, I find that the texture is not displayed on the browser. This raises some questions, and I hope to find answers.

  1. Why wasn't support for .tif-format textures considered?
    After consulting some information and related issues(Problems with .tif-textures in obj-models. #436), I learned that many browsers do not natively support .tif-format textures. By observing the source code of ImageLoader, I found that three.js works by displaying images through img tags.
    Is it possible to make three.js support .tif-format by extending ImageLoader? In fact, I made the image display by modifying the ImageLoader component, using tiff.js to load the tiff resource, and using canvas to convert it to png.

  2. Another problem is derived from the above problem. FBXLoader does not seem to provide any extensibility. Each subcomponent is directly new in the method. When I want to modify or extend the logic of some subcomponents, I have to put the entire FBXLoader Taking it out for modification alone makes the modification cost very large and is not conducive to subsequent maintenance. May I ask if this is the original intention of the original design (do not want others to modify the source code) or other reasons?

@Mugen87
Copy link
Collaborator

Mugen87 commented Aug 2, 2022

Is it possible to make three.js support .tif-format by extending ImageLoader?

No, I don't think that's a good idea. You really should not use tif in FBX assets but switch to something the browser can understand like JPG or PNG. It's even better to convert the FBX asset to glTF and compress textures with the respective tools.

May I ask if this is the original intention of the original design (do not want others to modify the source code) or other reasons?

Adding extensibility and flexibility means modules tend to become more complex. The project favored simplicity in the past for various reasons. So the idea is that you copy FBXLoader to your project and add you custom modifications.

@Mugen87 Mugen87 closed this as completed Aug 2, 2022
@0xLiang233
Copy link
Author

@Mugen87
Thank you for your answer.

There are many scenes using .tif-format textures in the game field, and my project is only for previewing character modeling made by game modelers, and their models are all .tif-format textures.

Of course, extra things can be done for a better preview (such as converting the texture format of the model), here is to find a simpler method, so there are the above problems.

@mrdoob
Copy link
Owner

mrdoob commented Aug 2, 2022

If there's some open source code for loading tiff we could do a TIFFLoader like the TGALoader... 🤔

@0xLiang233
Copy link
Author

If there's some open source code for loading tiff we could do a TIFFLoader like the TGALoader... 🤔

You can learn about the tiff.js project, but this is a compromise solution found on the Internet. I am not sure whether there are bugs or whether there is any performance impact.
Just a suggestion. 😁

@Mugen87
Copy link
Collaborator

Mugen87 commented Aug 2, 2022

@mrdoob We use a modified version of UTIF.js to load LogLuv HDR textures. I guess we could use the unmodified UTIF.js for TIFFLoader.

@Mugen87
Copy link
Collaborator

Mugen87 commented Aug 2, 2022

If you okay with UTIF.js, I'll file a PR 👍 .

@mrdoob
Copy link
Owner

mrdoob commented Aug 2, 2022

Let's do it 👌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants