Home Coding, Scripting, Shaders

Wavefront obj (.mtl) with PBR ?

AFsoft
polycounter lvl 8
Offline / Send Message
Pinned
AFsoft polycounter lvl 8

Hi everyone.

I have a personal project that i must export obj format with .mtl file.

The models must be in PBR standard Metal/Roughness. is it possible ?

i found out some articles on the internet that i could address diffuse/base color and Bump maps. but i dont know if it supports

Metalic and roughness or not. any help is much appreciated !

example .mtl code :

map_Kd shoe09_attachment_part_BaseColor.png

map_Bump shoe09_attachment_part_Normal.png

Replies

  • Eric Chadwick

    Exporting from which software, and importing into what? There's probably a better format for this, like glTF (nice support in Blender).

    I think I have a resource on the mtl format, I'll see if I can find it. It depends on the exporter, but I suppose you could tweak the file post-export.

  • Eric Chadwick

    http://www.paulbourke.net/dataformats/mtl/

    I guess you could shoehorn metal-rough textures into the existing slots, and make your own importer to read those.

  • Klunk
    Offline / Send Message
    Klunk ngon master

    the "standard" obj format is quite limiting, eg no support for vertex colour though if you have "control" on both export and import side of the equation then it's relatively easy to extend it to cover any possibility otherwise you're limited to your default apps importer.

    I think what i'm trying to say badly (beer brain as it's nye) you'll need to write both an exporter and an importer .

  • myclay
    Offline / Send Message
    myclay polycounter lvl 11

    It is possible;

    here is how Blenders new much faster obj exporter seems to handle PBR Textures in its mtl file.

    struct MTLMaterial {
      MTLMaterial()
      {
        texture_maps.add(eMTLSyntaxElement::map_Kd, tex_map_XX("Base Color"));
        texture_maps.add(eMTLSyntaxElement::map_Ks, tex_map_XX("Specular"));
        texture_maps.add(eMTLSyntaxElement::map_Ns, tex_map_XX("Roughness"));
        texture_maps.add(eMTLSyntaxElement::map_d, tex_map_XX("Alpha"));
        texture_maps.add(eMTLSyntaxElement::map_refl, tex_map_XX("Metallic"));
        texture_maps.add(eMTLSyntaxElement::map_Ke, tex_map_XX("Emission"));
        texture_maps.add(eMTLSyntaxElement::map_Bump, tex_map_XX("Normal"));
      }
    

    https://developer.blender.org/D11019

Sign In or Register to comment.