Mon, Nov 25, 10:34 PM CST

Renderosity Forums / 3D Modeling



Welcome to the 3D Modeling Forum

Forum Moderators: Lobo3433

3D Modeling F.A.Q (Last Updated: 2024 Nov 24 8:50 pm)

Freeware 3D Modeling Software Links:
Blender | Trimble Sketchup | Wings 3D | Anim8or | Metasequoia | Clara IO (Browser-based 3d modeler)

Check out the
MarketPlace Wishing Well, as a content creator's resource for your next project.

"What 3D Program Should I buy?" Not one person here can really tell you what's best for you, as everyone has their own taste in workflow. Try the demo or learning edition of the program you're interested in, this is the only way to find out which programs you like.



Checkout the Renderosity MarketPlace - Your source for digital art content!



Subject: Making a .mtl file.?


jedswindells ( ) posted Sun, 09 August 2009 at 6:44 AM · edited Mon, 25 November 2024 at 7:53 PM

Hi,I am using Lightwave mainly as a modelling tool.I export the models as .obj so I they can be used in other apps.
These models are plain grey,is there a way to give a colour to the different parts?,a .mtl file has been mentioned to me but I dont know how to make one!.

  http://www.sharecg.com/pf/full_uploads.php?pf_user_name=jedswindells

Here are some free models ...

  Cheers! Jed.

(also posted at Lightwave forum)


pjz99 ( ) posted Sun, 09 August 2009 at 8:50 AM

I don't know Lightwave, but normally the OBJ exporter should write a .MTL file when you export the model, that contains material information the OBJ format is capable of expressing (things like color, specular, image maps, bump maps etc).  If it's not doing that, then you probably should check with some Lightwave help to see how to get it to do write MTL files whenever you export to OBJ format.

My Freebies


nruddock ( ) posted Sun, 09 August 2009 at 8:54 AM

Given that most apps into which people are going to import OBJ files allow for much more sophisticated material settings than are conveyed by an MTL file, the important thing is to have enough appropriately define material zones on the model.

For those apps that can reproduce LW material settings properly when inporting LWOs (not many), then it depends how much effort you want to setting those up.


manoloz ( ) posted Sun, 09 August 2009 at 9:52 PM

lightwave 9.6 does make an mtl file when exporting as obj, but any material node attribute will not export, and some "standard" material attribute will export, but will not look exactly the same. You should stick to pretty simple material settings in your modelling app, and tweak your materials in your "final" app.
One other thing. You need to have a bitmap texture in the diffuse channel for lightwave to export uvmaps when exporting to obj

still hooked to real life and enjoying the siesta!
Visit my blog! :D
Visit my portfolio! :D


CaptainJack1 ( ) posted Mon, 10 August 2009 at 8:38 AM

If you want to make a material file for your OBJ, it's pretty simple. Both the OBJ and MTL files are plain text, and you can edit them with any good text editor. There's some good information on the OBJ and MTL file formats at www.wotsit.org, but here's the basics:

In your OBJ file, you need to add a line that looks like this:

mtllib FileName.mtl

Most export programs that create the file for you use the same name for the OBJ file and the MTL file. You'll put your materials in the MTL file. Still in your OBJ file, you need to add a line that looks like this:

usemtl MaterialName

above the faces that use that material. it's pretty common to have one material per group, and the "usemtl" line usually appears right after the group identifier, which is a line that starts with just the letter "g".

Your MTL file might look like this:

newmtl MaterialName
Ns 100.0
d 1.0
illum 2
Kd 1.0 1.0 1.0
Ka 1.0 1.0 1.0
Ks 1.0 1.0 1.0

The "newmtl" command identifies the material, and any program that can read the MTL file will mathc the name identified on that line with the name used in the OBJ file on the usemtl line.

In this example, "Ns" is the specular highlight percentage, "d" is a dissolve ratio designed to fade materials from one to the other across a polygon, "illum" refers to the illumination model, which I don't think any current program actually uses, "Kd" is the diffuse color (color is RGB, spearated by spaces, with values from zero to one), "Ka"  is the ambient color, and "Ks" is the specular color.

You can specify a texture map for the colors with the command map_Kd (and map_Ka, map_Ks, and so on) and a file name. There are lots of other commands to, but you can find them in the MTL spec at the web site above, if you're interested.

Note that there may be features in the MTL spec that your rendering program doesn't use, so you may have to experiment. As mentioned before, it's usually best to lay your materials down in the rendering program, and not try to export them from the modeler.


Privacy Notice

This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.