[SOLVED] Import Obj issue


photo

Recommended Posts

Hello,
I have tested import Obj file with FbxImporter and I have strange behavior.

After loading, sometimes the model look good sometimes it appear totaly bugged..
You can find the screen about the problem and a zip file containing the model from turbosquid for testing.
Maybe I made somthing wrong...
The code I use for testing:
 

        Unigine::Importer* importe = Unigine::Import::get()->createImporterByFileName("core/obj/immeuble/immeuble.obj");
        importe->init("core/obj/immeuble/immeuble.obj", ~0);
        importe->import("core/obj/immeuble/data/1/");
        Unigine::NodePtr myNode = Unigine::World::getNodeByName("immeuble");
        myNode->setWorldPosition(Unigine::Math::Vec3(-7, -30, 0));
        myNode->setScale(Unigine::Math::Vec3(0.02f));
        myNode->setWorldRotation(Unigine::Math::quat(0, 0, 60.0f), false);

 

screen.png

immeuble.zip

Link to post

Also, you can try to fix triangulation by adding this line to your importer:

importe ->setParameterInt("need_triangulate", 1);

That will triangulate mesh and probably fix some of the issues in the future. We do recommend to always enable this option.

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to post

Hi Silent,


setParameterInt("need_triangulate",1);
Or
addPreProcessor("MergeStaticMeshes");
Appears to correct the problem.


Do you  know where can I Find the parameter or PreProcessor in the doc 2.10 ?
Thanks.

Link to post

These parameters are not documented yet, bu you can get partial list from the FbxImporter plugin sources that available in <SDK>/source/plugins/Import/FbxImporter. Also here is the UnigineEditor internals import:

importer->setParameterInt("need_reset_mesh", 1);
importer->setParameterInt("create_unique_material_names", params.import_materials);
importer->setParameterInt("vertex_cache", params.vertex_cache);
importer->setParameterInt("workflow", params.workflow);
importer->setParameterFloat("scale", params.scale);
importer->setParameterFloat("fps", params.fps);
importer->setParameterInt("import_bones_without_skin", params.import_bones_without_skin);
importer->setParameterInt("import_tangent_space", params.import_tangent_space);
importer->setParameterInt("import_morph_targets", params.import_morph_targets);
importer->setParameterInt("create_transform_bones_for_joints", params.create_transform_bones_for_joints);
importer->setParameterInt("joints_reorientation", params.joints_reorientation);

importer->setParameterInt("use_instances", params.use_instances);
importer->setParameterInt("up_axis", params.up_axis - 1);
importer->setParameterInt("front_axis", params.front_axis - 1);

importer->setParameterInt("need_triangulate", params.need_triagulate);
importer->setParameterInt("skip_empty_nodes", params.skip_empty_nodes);

if (params.merge_similar_materials)
	importer->addPreProcessor("MergeSimilarMaterials");

if (params.combine_by_lods)
{
	String lods_postfixes;
	String lods_distances;
	int num_lods = params.lods.size();
	for (int i = 0; i < num_lods; ++i)
	{
		lods_postfixes += TOCHAR(params.lods[i].first);
		lods_distances += String::ftoa(params.lods[i].second);
		if (num_lods - 1 != i)
		{
			lods_postfixes.append(',');
			lods_distances.append(',');
		}
	}

	importer->setParameterString("lods_postfixes", lods_postfixes);
	importer->setParameterString("lods_distances", lods_distances);
	importer->addPreProcessor("CombineByPostfixes");
}
if (params.merge_static_meshes)
	importer->addPreProcessor("MergeStaticMeshes");

if (params.merge_surfaces_by_materials)
	importer->addPreProcessor("MergeSurfacesByMaterials");

if (params.need_split)
{
	importer->setParameterFloat("bound_size", params.bound_size);
	importer->addPreProcessor("SplitByBound");
}

if (params.need_repivot)
	importer->addPreProcessor("Repivot");

 

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to post
  • silent changed the title to [SOLVED] Import Obj issue