OBJs not loading with texture

About Monkey 2 Forums Monkey 2 Programming Help OBJs not loading with texture

This topic contains 11 replies, has 4 voices, and was last updated by  Hezkore 1 year, 9 months ago.

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #9304

    Cole Chapman
    Participant

    When I use the Turtle test file in mojo3d-loaders/test and swap out the turtle model for my own (OBJ) it will render grey and not have texture on it.  This seems kind of silly but I cannot for the life of me figure out how to load material/texture and then paint it.

     

    Anyone had success with this? OBJs in particular…

    #9317

    Mark Sibly
    Keymaster

    Very likely due to texture paths – can you send/post a zip of the model+media?

    #9344

    Cole Chapman
    Participant

    Perhaps the texture file that it is using isn’t compatible.  I used an app called AssetForge and it exported an OBJ and MTL.  I’ve attached an example.

    Attachments:
    1. StationWagon.zip
    #9369

    Mark Sibly
    Keymaster

    There doesn’t apear to be a texture file there at all! Not quite sure how obj files store textures but I would have at least expected to see a .png file or something.

    #9373

    Cole Chapman
    Participant

    Sorry perhaps texture was the incorrect word?  The MTL file that is with it, from my understanding, contains placements for colors and such.  Assimp Viewer loads both and renders just fine but Mojo3D does not.

    #9374

    Mark Sibly
    Keymaster

    Ok, gotcha now, think I now what’s going on and will have a go at fixing it soon.

    In the meantime, the only fix is really to use a ‘single file’ format. Obj files are split into 2 bits and the assimp loader is failing to load the ‘mtl’ bit so it’s being ignored.

    #9378

    Diffrenzy
    Keymaster

    https://en.wikipedia.org/wiki/Wavefront_.obj_file#Texture_maps and

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

    There needs to be a texture file reference in the mat file, and as Mark says, theres not.

    #9397

    Hezkore
    Participant

    I’m having similar issues with my OBJ files though.
    And I have the PNG the MTL files asks for in the same folder.
    I can’t seem to replace the default material for my loaded OBJ in Mojo3D either, so I can’t load it manually.

    And PLY (Stanford Polygon Library) files doesn’t seem to load at all?
    They’re a single file format.

    #9398

    Mark Sibly
    Keymaster

    This has nothing to do with textures – original post was a bit misleading.

    The problem is that the way I’ve implemented assimp loading means the ‘.mtl’ file is being ignored.

    Will be fixed eventually, but for now I recommend using a different format.

    #9399

    Hezkore
    Participant

    Something weird is going on with the model loading though.
    Almost no model format I want to load seems to be working…
    I’ve put together a little test for you: https://www.dropbox.com/s/z0zbdbo1qwd59tc/loader_test.zip?dl=0

    #9400

    Mark Sibly
    Keymaster

    Not all file formats are currently enabled, see: modules/assimp/makefile.monkey2.

    This was mainly to help preserve my sanity will getting assimp working, it’s a monster lib.

    #9402

    Hezkore
    Participant

    Thanks for adding more formats!
    PLY now loads, but OBJ still doesn’t load its MTL file, and PLY doesn’t use its colours.

    Oh and it’s possible to get MDL files animated? hehe

Viewing 12 posts - 1 through 12 (of 12 total)

You must be logged in to reply to this topic.