The THREE.js FBXLoader mistakenly identifies .png files as .psd files, causing issues with loading materials

While using the THREE.js FBXLoader to import a .fbx file, I noticed that the model is only partially loaded, and the alpha textured parts are not loading at all.

An error message I encountered is:

FBXLoader: PSD textures are not supported, creating empty placeholder texture for pinebranchColor.psd

Oddly, there are no .psd files in the materials folder. But the error seems to refer to the texture name pinebranchColor.psd in the material alphaMap, as shown in the screenshot below:

https://i.sstatic.net/s6mk2.png

Here is how the FBX model is currently rendering:

https://i.sstatic.net/ckwxc.png

The GLTF version of the same model displays transparent parts incorrectly, as seen in the image below:

https://i.sstatic.net/1GgIo.png

The correct appearance of the model can be seen on sketchfab :

https://i.sstatic.net/lu6NG.jpg

Why is the alpha material being identified as .psd? Is this encoded in the .fbx file itself? My initial issue was regarding how to render the alpha/transparency for the leaves correctly, rather than as solid color. Perhaps adjusting a property in the THREE.js material of the GLTF version could resolve this?

This is my first time importing a model into THREE.js, as I am still learning. Please provide an explanation in simple terms.

EDIT: Upon inspecting the dev tools, I discovered a material for the leaves and set transparent to true, which partially solved the issue. However, there are still some rendering problems, so I believe more adjustments are needed in this direction.

Answer №1

After encountering difficulties with loading the FBX alpha material, I managed to resolve the transparency issue in the GLTF version using the THREE.js scene.traverse function. By setting the material transparent property to true for all leaf materials in the scene, the core problem was successfully addressed.

Although the core issue was fixed, there were still some noticeable artifacts, such as blacked-out leaves. To address this, I also adjusted the alphaTest value to

0.5</code</p>

<p>You can see the difference in the before and after pictures below:</p>

<p><a href="https://i.sstatic.net/25twH.png" rel="nofollow noreferrer"></a></p>
<p><a href="https://i.sstatic.net/thFmD.png" rel="nofollow noreferrer"></a></p>

<p>For those interested, here is the code snippet used to implement the solution:</p>

<pre><code>gltf.scene.traverse(child => {
  if (child.isMesh && child.name.includes('leaf')) {
    child.material.alphaTest = 0.5;
    child.material.transparent = true;
  }
});

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Ways to dynamically incorporate media queries into an HTML element

Looking to make some elements on a website more flexible with media rules. I want a toolbar to open when clicking an element, allowing me to change CSS styles for specific media rules. Initially thought about using inline style, but it turns out media rul ...

In client.js, learn how to retrieve the value of an input tag (Name) from a login form

Let me explain the situation at hand: I'm currently in the process of developing a chat application using socket.io and NodeJS (Express). Initially, I had a simple prompt that asked for the user's name, easily accessible through const name = pro ...

Transforming a PHP cURL call to node.js

Currently exploring the possibility of utilizing the Smmry API, however, it seems that they only provide PHP API connection examples. Is there anyone who could assist me in adapting it into a JS request? My requirement is simple - I just need it to analyz ...

Activate the function for items that are overlapping

Here is a scenario I am working on: HTML <body> <div> <p>Text</p> </div> <body> JQuery $('div').click(function(){ $(this).find('p').fadeToggle('fast'); }); $('bo ...

Analyzing the list of paths that are passed to the function

I am looking for assistance in creating an asynchronous "getTypes" function that can analyze a list of paths and return an array describing the type of content in each path. The function should handle all cases efficiently and in case of any errors during ...

Evaluating Vue.js Watchers using Jasmine

I want to write a test for a VueJS watcher method, in order to verify if it's being called. The watcher method in my component is structured like this: watch: { value: (newValue, oldValue) => { if (newValue.Status === 'Completed') ...

Guide on inserting a new user to the db.json

My database file, db.json, has the following structure: { "users": [ { "id": 0, "isActive": true, "balance": "$2,309.20", "picture": "http://placehold.it/128x128", "age": 26, "accessLevel": "guest", "firstNa ...

Retrieve a file from an AWS S3 bucket using AngularJS

Currently utilizing angularjs. I am in need of incorporating a download feature. <button class="btn btn-labeled btn-info" title="download"> <a href="link provided by s3" download="downloaded">Download</a> </button> I have ...

Can you elaborate on the contrast between React Server Components (RSC) and Server Side Rendering (SSR)?

I'm curious about the differences between RSC in React 18 and SSR in NextJS. Can anyone explain? ...

Exploring the Wonder of MVC with Ajax Calls Handling Multiple Parameters

I've been struggling to send 2 parameters from the View to the controller using an ajax call. Everything was working fine when I had only one parameter, but as soon as I added another, the function stopped working. Below is the Javascript code with a ...

What is the best way to hide only the rows in a table when it is clicked using JavaScript?

Is there a way to hide rows in these tables by clicking on the table head? I'm currently using bootstrap 5 so JQuery is not an option. <table class="table table-info table-bordered"> <thead id="tablea"> ...

Eliminate elements from an array using a specific key for filtering

My Array is called MainArray MainArray=[{ {First Name: "First Name"}, {Last Name: "Contact"}, {Last Name: "Contact"} ] I am trying to trim the key-value pair from this array like this: if (key == 'First Name') { del ...

Unable to change the name of the file using ngx-awesome-uploader

Currently, I am utilizing https://www.npmjs.com/package/@sleiss/ngx-awesome-uploader and facing an issue regarding renaming files before uploading them. Upon reviewing the available methods, it appears that there is no option for file renaming. While I c ...

Unlocking the power of RXJS by de-nesting subscriptions

Trying to resolve the nested subscription issue has become a time-consuming puzzle. I've experimented with mergeMap, flatMap, and switchMap without success. Unfortunately, the examples I've come across don't quite fit my needs, leaving me wi ...

Tips on moving a square along the z axis in three.js

Can anyone provide assistance with translating a square on the z axis in three.js? I would appreciate any examples or guidance on the best approach to achieve this. ...

Explore the feature of toggling visibility of components in Vue.js 3

I am facing an issue with showing/hiding my sidebar using a button in the navbar component. I have a navbar and a side bar as two separate components. Unfortunately, none of the methods I tried such as v-show, v-if, or using a localStorage value seem to wo ...

What strategies are effective for handling state reactively in Vuex?

Currently, I am facing an issue with my vuex store. I have implemented two different actions in my store, one being reactive and the other not. However, I specifically need the loadSlidesEach() action to be reactive so that the data gets updated accordingl ...

What adjustments can I make to my smooth-scrolling JavaScript code in order to exclude my Bootstrap Carousel from the scrolling

On my website, I have incorporated JavaScript to create a smooth-scrolling effect when a user clicks on a hyperlink. This feature is essential as the landing page includes a chevron-down icon that prompts the user to navigate to the next section of the pag ...

Does React have an event component that detects when a user is actively viewing a specific component, such as a post?

Is there a special React event that fires when the user's gaze is focused on a component? Something like ComponentEnteredShowArea? For instance, videos in Facebook posts play automatically when I direct my attention towards them. It would be ideal i ...

Ways to showcase hierarchical list information in tabulator

I have set up a search and listing panel on my screen. To display nested data on the listing page, I decided to use tabulator. Here is the code in my js file : function onCheckClick() { var url = "/SomeController/SomeAction/"; $.ajax({ url: ...