Problems with textures in .obj files

Anonymous 9 years ago 0
This discussion was imported from CodePlex

soheilvb wrote at 2012-03-28 05:05:

Hey guys ,

tnx for this toolkit , that's really great .

I'm having problems with texture of some object files that i extracted using a script from unity ..

these are two sample of object files : (Direct link)


3ds max open these files perfectly . but Meshlab can't load the texture .

i also, loaded these files in 3ds max and exported them to .3ds format and loaded them with toolkit. there was the same problem !

i'm using the the last version of your component . (Compiled from last source code)

i have another question :

I want to load for example 2000 object files into one scene. I loaded them from object files into one Helixviewport . that takes about 20 second and 820 meg of memory and that's slow and not smooth ... ( in my quad core 3.4 imac).

anyway to optimize this ?

tnx for your time .

sorry for poor english .


soheilvb wrote at 2012-03-28 12:25:

for the texture problem. i was using the previous version . then i use the new version and i see everything is white !!!

then comment out these :

  if (this.AmbientMap == null)
              //      var ambientBrush = new SolidColorBrush(this.Ambient) { Opacity = this.Dissolved };
               //     mg.Children.Add(new EmissiveMaterial(ambientBrush));

and now everything is goood.

also for 3ds format, i think you forgot that change

var textureBrush = new ImageBrush(img);


var textureBrush = new ImageBrush(img) { ViewportUnits = BrushMappingMode.Absolute, TileMode = TileMode.Tile };

. this solved the problem .


I still have the second problem though , tnx

objo wrote at 2012-04-05 01:28:

thanks for the files and the bug report, I will look into this soon!

objo wrote at 2012-04-05 23:14:

I applied the two bug fixes! Thanks! Your example .obj files look ok now.

objo wrote at 2012-04-05 23:17:

are you loading 2000 different models? If not, you should freeze and share the geometry for all models that should look the same.

soheilvb wrote at 2012-04-06 13:17:

yes. 2000 different models. i guess WPF 3D can't manage this amount of objects. i should probably go to Directx and slimdx.

tnx for your response.

objo wrote at 2012-04-08 13:15:

Try the latest version of the obj reader, it should have better performance when using smoothing groups. I also profiled the code and found that the most expensive operation was splitting the input string by a regular expression. I changed it into a compiled expression, but maybe there are faster ways to solve this..

See also http://msdn.microsoft.com/en-us/library/bb613553.aspx

Did you try adding all models into a Model3DGroup? That should be more efficient than adding 2000 Visual3Ds.

soheilvb wrote at 2012-04-08 14:42:


i read that msdn article multiple times .

I used single Model3DGroup method before. there was no improvement in performance at all.

i have about 40 textures  and many meshes use the same material. i'm thinking about merging the meshes that have the same material into larger meshes but there is two problem:

1. i don't know how to merge them and does it really effect the performance?

2. i need every model clickable .

i used Simplify method in Meshgeometryhelper too. but there was some errors ...

there is ultimately about 900,000 vertices in all the models.

tnx a lot ..

soheilvb wrote at 2012-04-08 15:02:

Ohhhhhh myyyyy gooooood !!

i just tried your last version ...

the ram decreased from 800 meg to 300 meg.

time of importing objects decreased to half ...

i'm really grateful .

i think the problem was with the meshbuilder that you fixed. am i right?

now if i share material, that's gonna effect the performance?