The basic wavefront object file can omit or include many things. I am wondering if that is also true for the wavefront material file (.mtl). Available to me are:
- Ambient color
- Diffuse color
- Specular (Ks), weighted using the specular exponent (Ns)
- Transparency (d) and its inverse (Tr)
However, I think all I need in my use case is the diffuse color. Is it possible to just specify this, and nothing else?
If not, what of those fields are required, and what are not?
It looks like when viewing the .OBJ and .MTL files in this tool: https://www.creators3d.com/online-viewer
That just having the diffuse color does indeed work. Nothing else is required.
IE, the following works:
As a sidenote for anyone who may have trouble with .mtl files in the future, if you want tools to read in the .mtl file correctly, you need to link it in by using something like this at the very top of the OBJ file:
Otherwise, tools will not know where to look for the MTL file, even if it is in the same directory.
And in order to apply it, the keyword
usemtlmust be used. Any faces followingusemtlwill use that material, regardless of other divisions. If you want every face to have a different material, you would need to putusemtl [material number]likeusemtl 5before each quad, tri, etc written out.