stride3d / stride

Stride Game Engine (formerly Xenko)
https://stride3d.net
MIT License
6.34k stars 919 forks source link

glb import #1666

Open anan1213095357 opened 1 year ago

anan1213095357 commented 1 year ago

Release Type: github

Version: 4.1

Platform(s): windows

Describe the bug When I clicked 阿克尚.zip to import the model in GLB format, there was no prompt. The model was not imported either

Ceebox commented 9 months ago

There should be a message saying "Invalid character * found in path [{filePath}]". It is strange that there is no prompt.

I originally assumed that this issue was due to the UTF8 characters in the file name and mentally dismissed this as "eh, just change the name and it will work" but it actually turns out this seems to be an issue with [Stride's current version of?] ASSIMP not supporting .glb files, or Stride doesn't support the output of ASSIMPs glb import.

MeshConverter.ExtractTextureDependencies is an important function in this. It calls assimp.GetMaterialTexture, which references a path variable. The output of this path when you input a GLB file is *{textureNumber}, eg *0,*1,*2*. This is because a .glb file stores the texture inside of that file, and I'm not sure that we have a way to deal with this. I suppose I could work on this in the future but I do not have time at the moment.

Realistically the workaround to this is to convert it to a GLTF (not embedded) or another file format (obj or fbx, unfortunately), until this is fixed. I'll keep looking into this in the morning because it is possible I've not investigated far enough into this.

o7

Edit: There is information stored inside the .GLB file in order to work with this information, I highly recommend checking out this documentation.

lightway82 commented 8 months ago

I have same bug.

ArgumentException: Invalid character [] found in path [I:\0] at Stride.Core.IO.UPath.Decode(String pathToNormalize, Boolean isPathDirectory, StringSpan& drive, StringSpan& directory, StringSpan& fileName, StringSpan& fileExtension) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\core\Stride.Core.Design\IO\UPath.cs:line 791 at Stride.Core.IO.UPath..ctor(String filePath, Boolean isDirectory) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\core\Stride.Core.Design\IO\UPath.cs:line 66 at Stride.Assets.Models.ModelAssetImporter.ImportTextures(IEnumerable1 textureDependencies, List1 assetReferences) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\engine\Stride.Assets.Models\ModelAssetImporter.cs:line 292 at Stride.Assets.Models.ModelAssetImporter.Import(UFile localPath, AssetImporterParameters importParameters) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\engine\Stride.Assets.Models\ModelAssetImporter.cs:line 81 at Stride.Assets.Models.AssimpAssetImporter.Import(UFile localPath, AssetImporterParameters importParameters) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\engine\Stride.Assets.Models\AssimpAssetImporter.cs:line 71 at Stride.Assets.Presentation.Templates.ModelFromFileTemplateGenerator.CreateAssets(AssetTemplateGeneratorParameters parameters) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\editor\Stride.Assets.Presentation\Templates\ModelFromFileTemplateGenerator.cs:line 141 at Stride.Assets.Presentation.Templates.AssetTemplateGenerator.Run(AssetTemplateGeneratorParameters parameters) in C:\BuildAgent\work\b5f46e3c4829a09e\sources\editor\Stride.Assets.Presentation\Templates\AssetTemplateGenerator.cs:line 32 at Stride.Core.Assets.Editor.Components.TemplateDescriptions.TemplateGeneratorHelper.<>c__DisplayClass0_0`1.b__0() in C:\BuildAgent\work\b5f46e3c4829a09e\sources\editor\Stride.Core.Assets.Editor\Components\TemplateDescriptions\TemplateGeneratorHelper.cs:line 56

statue.zip