Jump to content
3DCoat Forums

Understanding importing of the OBJ file format


Recommended Posts

  • Reputable Contributor

I am putting this under the tutorial section even though it is not a real tutorial but the information here will help users who come across the:

 

"Why is my obj material groups being imported as uv sets instead of materials."

-----------------------------------------------------------------------------------------------------------

I've been studying this and the problem is not 3DCoat but how the obj file is written by the software that created it...

 

If the obj file (not talking about the mtl file here) itself does not contain... this heading "mtllib"  in other words a material library heading, 3DCoat cannot load the materials but will load them as uv sets. When 3DCoat creates a obj file that has materials it adds the "mtllib" heading to the obj file. Some programs when creating the obj file do not add the mtllib heading for material groups.

 

mtllib

It's definition:

This cube has a different material
 "applied to each of its faces."

 

Example" using a obj file with one uv set and 3 materials. (Model file is from Malo)

In the first part of the obj file is the below heading" (Remember I am not talking about the obj's mtl file.)

mtllib 3dcoat.mtl  ( 3dcoat.mtl is the name of the material file associated with the obj file. It will always be the same name as the obj file.)

 

Now further down in the obj file (not the mtl file) the materials groups are broken down and used by these headings.

usemtl pant

usemtl shirt

usemtl skin

 

The obj model loads correctly into 3DCoat with one uv set and 3 materials.

 

Now when I export an obj file ( no uv set ) from Wings3D that has materials Wings3D does not include the "mtllib" heading... 3DCoat sees the materials but can only import them as uv sets and not material groups with one auto uv set...

 

If you are having problems loading obj materials into 3DC, Check your obj file (not the mtl file) in question by opening it up in a text editor to see how it is written.

 

Here is a link on understanding the obj file format.

 

http://people.cs.cle...ile-format.html

 

and where they got their infomation from:

 

http://www.fileformat.info/format/wavefrontobj/egff.htm

 

You can google more information as well...  :D

Edited by digman
  • Like 2
Link to comment
Share on other sites

  • Reputable Contributor

Another piece of information that you will need to complete the loading of obj materials groups instead of uv sets into 3D Coat when your obj model has no uv set.

 

You will need to add the below to the obj's mtl file under each material group.

 

map_Kd default   (The name can be any name you so desire and it will become the name of your uv set.) Normally there is an image file named here, like

default.png but 3DC just needs a name and no extension.

 

Map_Kd  in the mtl file is saying these faces get this texture.

 

3DC needs this even though there is really not a texture associated with the material but 3DC sees this and will only create one auto uv set and 3 materials.

3DC also will create separate objects for each material. I am not sure why 3DC does this....

 

I am going to contact Andrew concerning some questions that I have and might rewrite both post so it will be more complete... The above information is correct but I found that 3DC also needs the Map_Kd heading in the mtl file when your obj file does not have a uv set...

 

In the image below you can see how 3DC exports an obj file that has no uv sets, only material groups. It adds the map_Kd heading even though there is no texture associated with the model and it only default is used with no image file extension.

post-518-0-63066800-1396626924_thumb.png

Edited by digman
  • Like 3
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...