Jump to content
  • 0

F3DZEX UV -> .MTL


SanguinettiMods
 Share

Question

6 answers to this question

Recommended Posts

  • 0

Alright.

 

I have control over the texture coordinates in the .obj file itself, but it won't show up textured unless a .mtl file is included.

As far as I know, it's like this in the .obj file.

 

 

v = vertex

vt = vertex texture

 

v ex:

 

v X Y Z

 

vt ex:

 

vt U V

 

 

So, My obj file is like this. (Excluding the header, I added the usemtl and things, in preperation for a .mtl file)

 

 

 

mtllib test.mtl

 

g Mesh1 Model

 

usemtl mat1

v -50 -30 0

vt -683 2048

v 50 -30 0

vt 2731 2048

v 0 70 0

vt 1024 -1365

f 1/1/1 2/2/1 3/3/1

f 4/4/1 5/5/1 6/6/1

f 7/7/1 8/8/1 9/9/1

 

 

Now, I have it all set up like I want it, unless it's missing something. But all I need is a .mtl file, and I'm not sure how to go about doing that.

Link to comment
Share on other sites

  • 0

Aha. The 'mtllib' command loads the file associated with it - 'test.mtl' in this case. The 'usemtl' command specifies to use a material named 'mat1', which should be defined in the file 'test.mtl' as so:

 

newmtl mat1

map_Kd texture_file_name.png

Tr <transparency, 0.0 - 1.0>

(Other mtl commands)

Link to comment
Share on other sites

  • 0

What do you mean by "Other mtl commands" ?

 

There are other things located withing an MTL, and I'm not completely sure what they mean...

 

(This MTL is for some random Triangle that I exported from Google Sketchup)

 

newmtl Material1

Ka 0.000000 0.000000 0.000000

Kd 0.000000 0.000000 0.000000

Ks 0.330000 0.330000 0.330000

mapKd Material1.bmp

 

and edited to work with model_convert.py

Link to comment
Share on other sites

  • 0

libobj maps MTL files to a structure like this - the names (with their comments) should explain it:

[tt]

char *name; //newmtl <name>

char *diffuse_tex; //mapKd / map_Kd (texture in white light)

char *specular_tex; // mapKs / map_Ks (texture when "shiny")

char *ambient_tex; // mapKa / map_Ka (texture in shadow)

 

objrgb ambient; //color in shadow ("ka")

objrgb diffuse; //color in white light ("kd")

objrgb specular;//color when shining ("ks")

float alpha; //"Tr" or "a"

float shinyness; //"ns"

int is_shiny; //"illum"

[/tt]

 

It should be noted that the illum value has very specific values.

Link to comment
Share on other sites

 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.