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.
-
AuthorPosts
-
July 13, 2017 at 10:57 pm #9304
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…
July 14, 2017 at 11:06 am #9317Very likely due to texture paths – can you send/post a zip of the model+media?
July 15, 2017 at 1:56 pm #9344Perhaps 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:
July 16, 2017 at 10:10 pm #9369There 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.
July 17, 2017 at 2:40 am #9373Sorry 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.
July 17, 2017 at 3:30 am #9374Ok, 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.
July 17, 2017 at 10:38 am #9378https://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.
July 18, 2017 at 2:00 am #9397I’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.July 18, 2017 at 2:22 am #9398This 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.
July 18, 2017 at 3:21 am #9399Something 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=0July 18, 2017 at 3:41 am #9400Not 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.
July 18, 2017 at 5:19 am #9402Thanks 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
-
AuthorPosts
You must be logged in to reply to this topic.