Skip to content

Conversation

@magnuspri
Copy link

@magnuspri magnuspri commented Dec 19, 2025

The fbx loader did not recognize maya's openPBRsurface shader, instead it defaulted to the phong material.

Changed so it gets converted to MeshStandardMaterial instead.

Also when parsing the image url's, paths that included "/" instead of "\" would not be parsed correctly. The parsing now use regex to account for that use case as well.

Found issue mentioning this: #15927

case 'Maya|baseColor':
parameters.map = scope.getTexture( textureMap, child.ID );
if ( parameters.map !== undefined ) {
parameters.color = ColorManagement.colorSpaceToWorking( new Color("white") ) // MATERIAL COLOR GETS SET TO BLACK BY MAYA WHEN A COLOR MAP IS APPLIED, SO SETTING IT TO WHITE TO RESOLVE THAT PROBLEM

Check notice

Code scanning / CodeQL

Semicolon insertion Note

Avoid automated semicolon insertion (94% of all statements in
the enclosing function
have an explicit semicolon).
case 'Maya|emissionColor':
parameters.emissiveMap = scope.getTexture( textureMap, child.ID );
if ( parameters.emissiveMap !== undefined ) {
parameters.emissive = ColorManagement.colorSpaceToWorking( new Color("white") ) // MATERIAL COLOR GETS SET TO BLACK BY MAYA WHEN A COLOR MAP IS APPLIED, SO SETTING IT TO WHITE TO RESOLVE THAT PROBLEM

Check notice

Code scanning / CodeQL

Semicolon insertion Note

Avoid automated semicolon insertion (94% of all statements in
the enclosing function
have an explicit semicolon).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your PR breaks the formatting and linter rules. Please make sure your editor properly supports ESLint so the file is correctly formatted when you save it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @Mugen87 for the feedback about the PR breaks and linter rules. Will look into that.

@Mugen87
Copy link
Collaborator

Mugen87 commented Dec 27, 2025

Can you please share at least one FBX asset that can be used to test the new code path? It should be added to the collection of webgl_loader_fbx which has a dropdown for selecting different assets.

// the transparency handling is implemented based on Blender/Unity's approach: https://github.com/sobotka/blender-addons/blob/7d80f2f97161fc8e353a657b179b9aa1f8e5280b/io_scene_fbx/import_fbx.py#L1444-L1459

parameters.opacity = 1 - ( materialNode.TransparencyFactor ? parseFloat( materialNode.TransparencyFactor.value ) : 0 );
if(materialNode.TransparencyFactor){
Copy link
Collaborator

@Mugen87 Mugen87 Dec 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parameters.opacity should always be set which is not true anymore with your new code. I suggest you restore the deleted line and just add

if ( materialNode[ 'Maya|transmissionWeight' ] ) {

    parameters.opacity = 1 - materialNode[ 'Maya|transmissionWeight' ].value;

}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. I will look into that.


if ( blobs[ filename ] !== undefined ) images[ id ] = blobs[ filename ];
else images[ id ] = images[ id ].split( '\\' ).pop();
else images[ id ] = images[ id ].replace(/^.*[\\/]|[?#].*$/g, ''); // Split on / or ?# as well as \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this change required?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding this change. I can see that my comment was a bit unclear as to why this is necassary. When I work in maya, forward slashes has to be used for paths. The loader did only account for backslashes, making the path invalid. The regex (shamefully admitting it being AI-generated) takes both and back and forward slash into account. I also noticed it that it would consider ? and #. Which at first seemed uncessary. But then I thought: "if one for some reason would like to read an image from a web-URL, then query parameters may be included... oh now that I think about it again. Maybe that part was unnecssary. Anyway forward slashes is still causing problems.

@Mugen87
Copy link
Collaborator

Mugen87 commented Jan 6, 2026

I'm afraid we can't merge these changes without a FBX asset for testing and verification.

@Mugen87 Mugen87 closed this Jan 6, 2026
@Mugen87 Mugen87 added this to the r183 milestone Jan 6, 2026
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.

2 participants