Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
3D-object import in Ad4b Engine
#1
Hello,
I am new to this Ab4D and I am now testing this engine for my next project. I am now trying to import a .glb file of a 3D object. 

I have installed Ab4d.SharpEngine.Assimp, Ab4d.Assimp and I am now working with C# so I have downloaded everything the third libary assimp-net-master from https://github.com/assimp/assimp. I also used the sample code from github (Ab4d.SharpEngine.Samples.Common/Importers/AssimpImporterSample.cs). 

The loading function of the Assimp library works fine, and I also created the AssimImporter at

var assimpImporter = new AssimpImporter();
return assimpImporter;

But when I try to import the object file with 

_importedModelNodes = _assimpImporter.Import(fileName);

I always get null back, even though my file path for my .glb file is readable and accessible.

Can anyone help me with this problem?
Thank you very much!
#2
It is recommended to use Ab4d.SharpEngine.glTF library to import .glb files - .glb is a binary glTF file. This way you will not need to use the native Asimp library.

You can try that by starting the  WPF, Avalonia, WinForms or WinUI samples project, then open the "glTF Importer and Exporter" and then drag and drop the glb file to the sample.


However, with the Assimp library you can check if the native Assimp library was able to read the file - check if the _assimpImporter.NativeAssimpScene is not null.

You can also subscribe to logging by using the following:
Code:
_assimpImporter.LoggerCallback = (message, data) => System.Diagnostics.Debug.WriteLine($"Assimp: {message}");
_assimpImporter.IsVerboseLoggingEnabled = true;

Have you tried importing the .glb file into the Assimp importer sample in the WPF, Avalonia, WinForms or WinUI samples project - it also uses logging and should report any errors.
Andrej Benedik
#3
After testing the .glb file that the user sent I found out that the glTF importer did not correctly read the file because it uses the KHR_materials_pbrSpecularGlossiness extension (uses SpecularGlossiness PBR workflow) and does not provide the PbrMetallicRoughness data. I have updated that. The updated version of Ab4d.SharpEngine.glTF was already available with the 3.0.9169-rc1.

The .glb file was also tested by using the Assimp importer and it was correctly imported.

Note that the current version of Ab4d.SharpEngine does not support PBR (Physically Based Rendering materials) so the StandardMaterial is used instead (using DiffuseTexture to show albedo / color texture).
Andrej Benedik
  


Forum Jump:


Users browsing this thread:
1 Guest(s)