Extent of OBJ importer (how finished is it) ?

Anonymous 9 years ago updated by anonymous 3 years ago 2
This discussion was imported from CodePlex

Rogad wrote at 2014-02-20 15:52:

Hi Objo !

I'm still playing with the OBJ importer.

Could you please tell me what parts of the material file are working at the momemt ?

For example, what parts of this example actually get used :

newmtl 3_SkinForearm
d 1
Ns 1
Ni 0
Ka 0.858824 0.92549 0.937255
Kd 0.901961 1 0.996078
Ks 0.866667 0.929412 0.945098
Km 0.00252632
map_Kd Maps/RMDelphL.jpg
map_Bump Maps/RMDelphLBp.jpg

So is the bump map used, is Ns and Ni used and so on ?

I don't know what all these do, but I do get some strange results some times and I have to remove things from the material file.

It would be good to remove things that are not implemented yet, I just need to know what they are.

Many thanks :)

objo wrote at 2014-02-20 20:36:

The materials in the 3D model of WPF are quite limited, bump maps are not supported and I have not found a way to include the ambient components easily.
You can see the implementation in the MaterialDefinition.CreateMaterial method in the ObjReader
I agree it would be a good idea to create an overview of what is supported and not.
Note that the importers are also included in the refactoring task

Also consider Assimp.NET for a proven .obj importer. Has anyone found a good WPF adapter for it?

Rogad wrote at 2014-02-20 21:19:

I did look at Assimp.NET but there is no documentation for C#. Since I am still learning C# I can't get into that directly. Maybe in time..

From the ObjReader.cs to me it looks it does parse all the settings but in the end it supports Diffuse, Ambient and Specular and also the texture map.

So really, if you could confirm... this is the current state :

newmtl 3_SkinForearm
d 1 <- used (translated to Opacity)
Ns 1 <- used
Ni 0 <- ignored
Ka 0.858824 0.92549 0.937255 <- ignored
Kd 0.901961 1 0.996078 <- used
Ks 0.866667 0.929412 0.945098 <-used
Km 0.00252632 <- ignored
map_Kd Maps/RMDelphL.jpg <- used
map_Bump Maps/RMDelphLBp.jpg <- ignored
map_D <- ignored

Is that correct ?

Cheers :)

objo wrote at 2014-02-20 22:40:

the following should be corrected
d <- used (translated to Opacity)
Ns <- used
Ka <- ignored
Km <- ignored

full spec at http://paulbourke.net/dataformats/mtl/

Rogad wrote at 2014-02-20 23:35:

OK that's been corrected, I thought I probably did not get that right.

Thanks for the link to the specification.

Rogad wrote at 2014-02-20 23:36:

It goes to show how much work you have done :)

Rogad wrote at 2014-02-21 15:52:

Regarding the bump map - I have found comments that this might be possible with a Pixel Shader. But I have not found any example code as yet.

Rogad wrote at 2014-02-21 18:16:

I added that map_D is also ignored for now.

What about map_Ks ?

Rogad wrote at 2014-02-27 19:33:

I'm a bit confused about Ns too. Wikipedia has this page : http://en.wikipedia.org/wiki/Wavefront_.obj_file#Basic_materials

It says :
Ns 10.000 # ranges between 0 and 1000
My models from Daz have things like : Ns 0.5

Also I tried changing Ns of some of my model parts for example :

Ns 1000

And when viewed in the Helix model viewer there is no difference.

Also this page : http://people.sc.fsu.edu/~jburkardt/data/mtl/mtl.html
Ns s
defines the shininess of the material to be s. The default is 0.0;
So one would have thought that changing Ns to 1000 would make it shiny, but it doesn't.

So I am left wondering...

Rogad wrote at 2014-02-28 17:53:

Rogad wrote:
What about map_Ks ?