Advertisement

Assimp Model Load (FBX) Help!

Started by March 29, 2018 03:36 PM
5 comments, last by Sung Woo Yeo 6 years, 10 months ago

I have something wrong that loading fbx model using assimp

some meshes are located in unusual place

image.thumb.png.da549b0768c149beb027774629c9b892.png

 

this is result about my renderer. (the face is off)

but other programs (like 3dmax, assimp viewer, and etc...) the face is well attached.

 

image.thumb.png.5255778de79387a938fd3b4a6436a570.png

(this is assimp viewer image)

 

I folloew the reading of vertex while debugging,

and The x-coord of all vertices in the face mesh were added to 200

(this is return value about aiMesh.mVertices)

 

my import setting is that.


m_pScene = aiImportFile(fileName.c_str(), aiProcess_JoinIdenticalVertices |		// join identical vertices/ optimize indexing
		aiProcess_ValidateDataStructure |		// perform a full validation of the loader's output
		aiProcess_ImproveCacheLocality |		// improve the cache locality of the output vertices
		aiProcess_RemoveRedundantMaterials |	// remove redundant materials
		aiProcess_GenUVCoords |					// convert spherical, cylindrical, box and planar mapping to proper UVs
		aiProcess_TransformUVCoords |			// pre-process UV transformations (scaling, translation ...)
		//aiProcess_FindInstances |				// search for instanced meshes and remove them by references to one master
		aiProcess_LimitBoneWeights |			// limit bone weights to 4 per vertex
		aiProcess_OptimizeMeshes |				// join small meshes, if possible;
		//aiProcess_PreTransformVertices |
		aiProcess_GenSmoothNormals |			// generate smooth normal vectors if not existing
		aiProcess_SplitLargeMeshes |			// split large, unrenderable meshes into sub-meshes
		aiProcess_Triangulate |					// triangulate polygons with more than 3 edges
		aiProcess_ConvertToLeftHanded |			// convert everything to D3D left handed space
		aiProcess_SortByPType);					// make 'clean' meshes which consist of a single type of primitives);

Note that if aiProcess_PreThransformVertices flag is used, The model is rendered perfactly!

but this model has animation, so i can't use this flag

 

and There is one thing that takes

This model's face mesh is made up of rect polygons. (not triangle)

Could this be a problem?

 

Please please help me about this problem!

 

If you want other codes, I'll gladly provide all the code

 

Thanks!

I had also a lot of troubles loading FBX with assimp, especially with more complex animations (simple animations, where the root of the object is at the origin, same for the skeleton, nearly always worked). They apparently use some hand written loader, not the official SDK (at least, that was the case when I've used it). 

Sometimes it helped me to build assimp from the source code (yet, sometimes the newer versions had bugs on assets where the old was working). In the end I've made tons of cumbersome workarounds, e.g. exporting some rigid object in separate FBX and attach them to the skeleton within my engine, etc.

 

I was also suprised that 3dsmax could export and load FBX without any flaws, while loading the FBX from 3dsmax into other software caused some issues sometimes. If I recall correctly, they have embedded some binary blobs for 3dsmax with additional data (you can save an text based FBX and check it out in a text editor. Eventually even remove the blob and try to load it in 3dsmax).

Maybe try the official FBX sdk: http://usa.autodesk.com/adsk/servlet/pc/item?siteID=123112&id=10775847

(Sadly they only support old VS versions :(

Advertisement

Lateral thinking here, but is there any reason why you need to use FBX format directly in your program? If you are writing a game rather than a tool or engine to be used by third parties, it is usually a better idea to use your own custom format, for a number of reasons.

Most pressing reason here, is that if there are any inconsistencies in the difference flavours of FBX, you shouldn't be dealing with this, let some poor sod deal with it for you, then just export exactly what you need for your game. Unless you *are* writing a tool, in which case you are the poor sod, and I pity you. :)

To put it another way, if you needed to display some text in a game, would you load a microsoft word file, or would you convert it to a text file and load the text file instead?

Sorry... There was a problem with the model;;;
I got a new model from the modeler and this is not a problem.

 

Thanks for all Reply!

 

ps. I'm making a game using DirectX12 and etc... as a collage graduation research project

I don't have a lot time, so i'm using the assimp to process fbx

image.jpeg.6e84d65c0d60905a8aa5b8b748b44552.jpeg

 

I don't have a lot time, so i'm using the assimp to process fbx

that's ok, for a small scope. note everything needs a sophisticated tool/build pipeline. Good luck with your DirectX12 project :)

19 hours ago, Krypt0n said:

 

that's ok, for a small scope. note everything needs a sophisticated tool/build pipeline. Good luck with your DirectX12 project :)

thanks for your comment!

This topic is closed to new replies.

Advertisement