Problems with textures in .obj files

Mar 28, 2012 at 4:05 AM

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)

http://parsaspace.com/files/9680754884/objects.zip.html

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 .

 

Mar 28, 2012 at 11:25 AM

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));
                }
                else

and now everything is goood.

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

var textureBrush = new ImageBrush(img);

with

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

. this solved the problem .

 

I still have the second problem though , tnx

Coordinator
Apr 5, 2012 at 12:28 AM

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

Coordinator
Apr 5, 2012 at 10:14 PM

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

Coordinator
Apr 5, 2012 at 10:17 PM

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

Apr 6, 2012 at 12:17 PM

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.

Coordinator
Apr 8, 2012 at 12:15 PM

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.

Apr 8, 2012 at 1:42 PM
Edited Apr 8, 2012 at 5:43 PM

tnx

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 ..

Apr 8, 2012 at 2:02 PM
Edited Apr 8, 2012 at 5:43 PM

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?