stride icon indicating copy to clipboard operation
stride copied to clipboard

Model importer regression in master

Open Doprez opened this issue 1 year ago • 14 comments

Release Type: master

Version: Github

Describe the bug After doing some testing with the model importer changes I was testing different models online to see if they all imported correctly and found one that imports correctly in the old version but shows up blank in the new version.

To Reproduce Steps to reproduce the behavior:

  1. open game studio
  2. try importing this model as FBX
  3. and the materials show but the textures and model are blank or missing

Expected behavior it should work as it currently does where the model, materials and textures import properly.

Screenshots old: image

new: image

Log and callstacks

Error: Texture with name Emily_Lower_Teeth_Diffuse not found
Error: Texture with name Emily_Skin_Arm_Diffuse not found
Error: Texture with name Emily_Eyelash_Diffuse-Emily_Eyelash_Opacity not found
Error: Texture with name Emily_Eyelash_Diffuse-Emily_Eyelash_Opacity not found
Error: Texture with name Emily_Skin_Body_Diffuse not found
Error: Texture with name Emily_Skin_Head_Diffuse not found
Error: Texture with name Emily_Skin_Leg_Diffuse not found
Error: Texture with name Emily_Lower_Teeth_Diffuse not found
Error: Texture with name Emily_Upper_Teeth_Diffuse not found
Error: Texture with name Emily_Nails_Diffuse not found
Error: Texture with name Emily_Cornea_L_Diffuse not found
Error: Texture with name Emily_Eye_L_Diffuse not found
Error: Texture with name Emily_Eye_R_Diffuse not found
Error: Texture with name EmilyHairs not found
Error: Texture with name EmilyHairs not found
Error: Texture with name PantsLeather-DX-Back not found
Error: Texture with name yellow leather not found
Error: Texture with name Leather Element not found
Error: Texture with name PantsLeather-DX-Front not found
Error: Texture with name PantsLeather-SX-Front not found
Error: Texture with name RightArm-JacketLeather not found
Error: Texture with name JacketLeather not found
Error: Texture with name LeftArm-JacketLeather not found
Info: Computing hashes of 3 source files...
Verbose: Computed hash of C:/dev/GitControlledProjects/TR.Stride/TR.Stride/Resources/Test/Emily_Jumping.fbx for asset Test/Emily_Jumping Skeleton. 2 files remaining...
Verbose: Computed hash of C:/dev/GitControlledProjects/TR.Stride/TR.Stride/Resources/Test/Emily_Jumping.fbx for asset Test/Emily_Jumping_mixamo.com. 1 files remaining...
Verbose: Computed hash of C:/dev/GitControlledProjects/TR.Stride/TR.Stride/Resources/Test/Emily_Jumping.fbx for asset Test/Emily_Jumping. 0 files remaining...

Doprez avatar Apr 05 '24 00:04 Doprez

Seems like it may be a path issue based on the image below: image

and this check here cant find the textures causing the above error.

        private static void ImportTextures(IEnumerable<string> textureDependencies, List<AssetItem> assetReferences, Logger logger)
        {
            if (textureDependencies == null)
                return;

            foreach (var textureFullPath in textureDependencies.Distinct(x => x))
            {
                if (!File.Exists(textureFullPath))
                {
                    string texName = Path.GetFileNameWithoutExtension(textureFullPath)??"<unknown>";
                    logger.Error($"Texture with name {texName} not found");
                    continue; 
                }
                var texturePath = new UFile(textureFullPath);

                var source = texturePath;
                var texture = new TextureAsset { Source = source, Type = new ColorTextureType { PremultiplyAlpha = false } };

                // Create asset reference
                assetReferences.Add(new AssetItem(texturePath.GetFileNameWithoutExtension(), texture));
            }
        }

Doprez avatar Apr 05 '24 00:04 Doprez

Ah ok, seems like the new importer is missing a step of extracting textures from the FBX file. I dont think that would be part of the model not appearing correctly but at that may at least explain the textures not getting imported in the current version. image

https://github.com/stride3d/stride/blob/4a263c4faa1e5ed3a94f1f8900bce342c230f28a/sources/tools/Stride.Importer.FBX/MeshConverter.cpp#L1921

Doprez avatar Apr 05 '24 00:04 Doprez

@Noah7071 is this just missing or a special case for this model file?

tebjan avatar Apr 05 '24 11:04 tebjan

Thanks for sharing this @Doprez. Wheres this particular model Emily_jumpinng! ? The link you shared isn't opening for me.

Noah7071 avatar Apr 05 '24 13:04 Noah7071

Oh weird, try this https://www.turbosquid.com/3d-models/emily-blender-2157992

Doprez avatar Apr 05 '24 13:04 Doprez

Oh lol sorry I apparently added the hyperlink without adding the actual link

Doprez avatar Apr 05 '24 13:04 Doprez

@Noah7071 is this just missing or a special case for this model file?

Oh yes for the case texture embedded, unlike FBX sdk there isnt auto setting in Assimp to rip embedded files. Have to generate texture image file traversing pixel by pixel. Checking in the fix shortly!

Noah7071 avatar Apr 05 '24 16:04 Noah7071

@Doprez Committed the update for embedded texture! Screenshot 2024-04-06 140515

Noah7071 avatar Apr 06 '24 12:04 Noah7071

You're a legend! I can either mark this as closed now or we can wait for the PR to close it.

Doprez avatar Apr 06 '24 16:04 Doprez

Thanks @Doprez , best mark it closed and open new if somethin else!

Noah7071 avatar Apr 06 '24 17:04 Noah7071

Did you already make the PR?

Doprez avatar Apr 06 '24 17:04 Doprez

Yes, there's PR of this https://github.com/stride3d/stride/pull/2163

Noah7071 avatar Apr 06 '24 17:04 Noah7071

Ah but that was already merged, I think it will need a new one for your commit to take effect.

Doprez avatar Apr 06 '24 17:04 Doprez

Im going to reopen for now so we can track it once it gets merged. It does seem fixed from Noahs example but just needs to be in master.

Doprez avatar Apr 27 '24 16:04 Doprez

Should be fixed from @Noah7071 repo, I pulled it in this PR https://github.com/stride3d/stride/pull/2246

Doprez avatar May 19 '24 22:05 Doprez