FBX SDK 2020.1 issue while importing a 3DS

Anonymous

FBX SDK 2020.1 issue while importing a 3DS

Anonymous
Not applicable

Hello, i've integrated the FBX SDK inside my Unity3D project to be able to import/export models in runtime, it already works really good and i already tested with thousands of 3d model files and the importing is always correct.

The current sdk version that im using is 2020.1, and i've already tested with 2019.0 but same issue.

 

So recently i got an issue with a 3ds model, pratically the 3d model looks like is missing some objects, but actually the objects are imported but they have the wrong mesh and all the objects name are not fully visible.

For example, in the attached picture as you can see there is a kitchen, the object name of the top of the kictchen is "Object_layer 83", and the floor object name is "Object_layer 84", they both are visible in the hierarchy but they both have the same mesh, so there are 2 chitcken tops instead of 1, i will attach pictures to make you understand better.

Anyway, i even tried to using Autodesk FBX Converter using the FBX Viewer tool and the FBX Converter tool and the result is exactly like in my FBX SDK Unity3D integration. But using other softwares like Cinema4D or Blender the model is loaded correctly.

 

Test with Autodesk FBX Converter (Wrong import):

errorecaricamento.PNG

My Unity3D Integration of FBX SDK 2020.1 (Wrong import):

uni.PNG

Test with Cinema4D (Correct import):

cin.PNG

Test with Blender (Correct import):

ble.PNG

 

 

About the issue that i was saying above about 2 objects that should have different meshes but actually they have the same (selected objects are the same selected objects in Cinema4D):

unidoppioni.PNG

Instead on Cinema 4D they have different meshes as they should (selected objects are same selected objects in unity3D):

cindoppioni.PNG

 

I attach the 3ds 3D Model too so you will be able to do your tests.

 

These are my importing settings, probably is here the issue?

 

FbxManager *manager = FbxManager::Create();

FbxIOSettings *ioSettings = FbxIOSettings::Create(manager, IOSROOT);

ioSettings->SetBoolProp(IMP_FBX_MATERIAL, true);
ioSettings->SetBoolProp(IMP_FBX_TEXTURE, true);
ioSettings->SetBoolProp(IMP_FBX_LINK, false);
ioSettings->SetBoolProp(IMP_FBX_SHAPE, false);
ioSettings->SetBoolProp(IMP_FBX_GOBO, false);
ioSettings->SetBoolProp(IMP_FBX_ANIMATION, false);
ioSettings->SetBoolProp(IMP_FBX_GLOBAL_SETTINGS, true);

manager->SetIOSettings(ioSettings);

FbxImporter *importer = FbxImporter::Create(manager, "");
if (importer->Initialize(path, -1, manager->GetIOSettings())) {

	scene = FbxScene::Create(manager, "tempName");

	importer->Import(scene);

	// convert to meters
	if (scene->GetGlobalSettings().GetSystemUnit() != FbxSystemUnit::m)
		FbxSystemUnit::m.ConvertScene(scene);

	// rotate axis
	FbxAxisSystem axisSystem(FbxAxisSystem::eOpenGL);
	axisSystem.ConvertScene(scene);

	FbxGeometryConverter lGeomConverter(manager);
	lGeomConverter.Triangulate(scene, true);

	rootNode = scene->GetRootNode();
	
	//...
	//Process rootNode
	//...
}

 

 

 

 

 

Thanks in advance for helping me, i hope to give you enough info about the issue as long as you can fix this.

Regards,

 

 

0 Likes
Reply
1,038 Views
4 Replies
Replies (4)

regalir
Autodesk
Autodesk

 

it looks like the issues you are experiencing are caused by the truncation of the object names. In the 3DS standard, mesh names are limited to 10 character. In your scene, several object have more than 10 character and, once truncated, the reader associate the transform to the first occurrence. For example:

"Divisione 1 [1] 8" and "Divisione 1 [2] 9" both result in "Divisione ".

 

This explains why some of the meshes are overlapping. I don't know which application generated the file but I suspect that Cinema4D and Blender have implemented their own 3DS support and removed the limitation on the number of allowed characters. To be honest,  when I try to load your file in 3dsMax, I get the error: Improper File Format

 

0 Likes

Anonymous
Not applicable

Hello @regalir thank you for your response, i understood the issue as you explained, this model was generated with a software called PolyBoard, since i cannot rename the objects name inside this software i would love to found another solution.

It is not possible to fix it directly through FBXSDK? if it is, how can i do?

Anyway its really weird to know that 3dsMax cannot load a 3ds file like this just because of the objects name lenght.

 

Thank you anyway for your support.

0 Likes

regalir
Autodesk
Autodesk

It is not weird that 3dsMax fails to read the file (it may have implemented much more strict policies to validate the integrity of the file). As I wrote earlier, this file does not conform to the .3ds standard. Any search I've done, internally and on the internet (even Wikipedia), clearly states that this format is a very old (back in the days of the DOS program version) format so it limits the number of characters to remain compatible with the DOS naming scheme (8+3 characters).  I have found what looks like a private project that got posted (https://code.google.com/archive/p/lib3ds/downloads) where the authors have increased the buffers that hold the object names but at the same time, they put the comment saying that you should not exceed 8.

 

struct Lib3dsMesh {
    Lib3dsUserData user;    	/*< Arbitrary user data */
    Lib3dsMesh *next;
    char name[64];		        /*< Mesh name. Don't use more than 8 characters  */

 

Maybe PolyBoard, Cinema4D and Blender are all using this library? I can't say for sure. Unfortunately, I cannot offer a viable solution. If you have programming skill, you can consider writing a 3DS to 3DS converter using this library (I did not looked at it more than necessary so I can't say for sure that it would work). Bear in mind that you will have to resolve all the naming inconsistencies which may result in a lot of code.

 

If PolyBoard can export to a different 3D format, maybe you can use that format and convert it to 3DS using 3dsMax (DXF may sound like an acceptable format). Ideally, Collads (DAE) and FBX would be the best ones for the FBX SDK. I cannot suggest to use the FBX SDK to repair the names because at the time you have access to the FBX objects it is too late. The "damage" 😉 has already occurred during the reading of the 3DS file.

 

I wish I could be of more help but this is pretty much as far as I can go. You may get some luck by asking questions on the other programs (PolyBoard, Cinema4D, Blender) forums.

 

Best regards

 

0 Likes

m_latz
Advisor
Advisor

The definition of the "Data Chunks" in the  3DS file format supports only 10 characters (+ NULL) for named object, as @regalir said.

 

I appended just 2 pages from the original "3D Studio Release 3 File Toolkit Reference Manual".

 

What you can do is, write a program that reads your 3DS file and shorten all object names that are longer then 10 characters.

 

regards

 

Markus

 

 

0 Likes

Type a product name