Skip to content

Examples: Add textured assets to webgl_loader_fbx. #31057

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

Merged
merged 3 commits into from
May 8, 2025

Conversation

tatsuya-ogawa
Copy link
Contributor

@tatsuya-ogawa tatsuya-ogawa commented May 6, 2025

Related issue: #31032

Description

  • add fbx example model for checking FbxLoader with texture.
  • the model file is created by blender(suzanne model),and exported fbx with COPY path mode.

@tatsuya-ogawa tatsuya-ogawa marked this pull request as ready for review May 8, 2025 00:22
@tatsuya-ogawa tatsuya-ogawa changed the title add fbx with texture sample add fbx with texture model sample May 8, 2025
@tatsuya-ogawa tatsuya-ogawa changed the title add fbx with texture model sample Add fbx with texture model sample May 8, 2025
@Mugen87 Mugen87 changed the title Add fbx with texture model sample Examples: Add textured assets to webgl_loader_fbx. May 8, 2025
@Mugen87 Mugen87 added this to the r177 milestone May 8, 2025
@Mugen87 Mugen87 merged commit a1224db into mrdoob:dev May 8, 2025
11 checks passed
@tatsuya-ogawa tatsuya-ogawa deleted the add_fbx_model_sample branch May 8, 2025 08:52
@WestLangley
Copy link
Collaborator

The textures are not being disposed of properly when the models are changed.

@Mugen87
Copy link
Collaborator

Mugen87 commented May 8, 2025

The example already has this code:

if ( child.material ) {
const materials = Array.isArray( child.material ) ? child.material : [ child.material ];
materials.forEach( material => {
if ( material.map ) material.map.dispose();
material.dispose();
} );
}

Isn't that sufficient?

@WestLangley
Copy link
Collaborator

The number of textures keeps increasing...

console.log( renderer.info.memory );

Mugen87 added a commit that referenced this pull request May 8, 2025
Mugen87 added a commit that referenced this pull request May 8, 2025
@Mugen87 Mugen87 removed this from the r177 milestone May 8, 2025
@Mugen87
Copy link
Collaborator

Mugen87 commented May 8, 2025

I have reverted the PR because the assets are not optimal, see #31067 (comment).

However, the issue still exists since the skinned mesh does not call dispose() on its skeleton when removed from the scene. So the memory leak was present even before this PR was merged.

@WestLangley
Copy link
Collaborator

@Mugen87 Is there a way for the user to see a clue as to what, exactly, the textures are? renderer.info.memory provides the count.

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

Successfully merging this pull request may close these issues.

3 participants