-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
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
TransparencyFactor not fully handled by FBXLoader #29439
Comments
Would you be willing to file a PR with the suggested change? |
I have tested your proposed change and it unfortunately breaks the bot asset in webgl_loader_fbx. It renders completely transparent now which is obviously incorrect. |
Does this hint still work? |
Tried it in the editor but it has no effect. |
This code appears to work, not sure if it's universal but seems to be functional for FBX models I tried (can be tested in my FBX Viewer): if ( materialNode.TransparencyFactor && ( materialNode.TransparencyFactor.value < 1 || ! materialNode.Opacity ) ) {
parameters.opacity = 1 - parseFloat( materialNode.TransparencyFactor.value );
} else if ( materialNode.Opacity ) {
parameters.opacity = parseFloat( materialNode.Opacity.value );
}
if ( parameters.opacity < 1.0 ) {
parameters.transparent = true;
} |
I remember @looeee recommended to use the Blender source code as a reference in such cases. If you have the possibility, it would be great if you could check the transparency handling there. |
@Mugen87 if your suggestion was intended for me then just to say that I'm not much of a Blender user in any way. I did log the |
Below should be the relevant section. I actually like the initial comment 😁 . |
@GitHubDragonFly Would this new transparency handling work for you? parameters.opacity = 1 - ( materialNode.TransparencyFactor ? parseFloat( materialNode.TransparencyFactor.value ) : 0 );
if ( parameters.opacity === 1 || parameters.opacity === 0 ) {
parameters.opacity = ( materialNode.Opacity ? parseFloat( materialNode.Opacity.value ) : null );
if ( parameters.opacity === null ) {
parameters.opacity = 1 - ( materialNode.TransparentColor ? parseFloat( materialNode.TransparentColor.value[ 0 ] ) : 0 );
}
}
if ( parameters.opacity < 1.0 ) {
parameters.transparent = true;
} The code would replace the previous |
@Mugen87 if I just plug your code in there is no difference in the output that I could see. That seems to be the way to go, since it matches Blender and Unity better. |
Description
When importing a FBX object with a material using transparency factor as a value with FBXLoader, the model stay fully opaque.
We added a correspondance for transparency factor/Opacity wich solved the issues.
Example object attached
exampleWindow.zip
Reproduction steps
Code
Live example
Screenshots
Version
168
Device
Desktop
Browser
Firefox
OS
Windows
The text was updated successfully, but these errors were encountered: