Textures missing from Jit.gl.model in standalone

Jonny's icon

Hi all

I'm trying to make a standalone with a jit.gl.model using a model from Blender, exported as .obj and .mtl and associated jpeg image files. This works fine and looks great in Max, but when I build, a standalone either as an Application of Collective, the textures are missing.

I've tried all the various options on the [standalone] object, but nothing helps, and there are no image or .mtl files in the application Contents/Resources folder.

I'm using Max 8.6.5 (can't upgrade yet), is this possible?

Any suggestions gratefully anticipated!

jonny

TFL's icon

If you build the application from a Max project, make sure the the required files are listed as dependencies in the Project window.

If Max doesn't want to copy them by itself, you can always add them manually. Source Audio should get you covered, like in this thread.

Jonny's icon

Hi TFL, thanks for the reply

No, I was using the "old way" of "Build Collective / Application" from the File menu, I didn't even know Projects existed!

So for completeness I tried it as a Project, adding the image files (which promisingly go in a media section) and the mtl file (in "other"), and built as Application, but sadly the same as the regular way, none of the specified files end up in the app.

I also tried adding the files individually (the old way) and as a whole folder (all the texture files are in the same dir as the patch, by the way), and also tried copying the files manually into the Contents/Resources folder, all without success - hence asking here.

Maybe it's just not possible?

But thanks for the link, interesting thread that, I wonder what other "undocumented" commands there are in the build script?

Rob Ramirez's icon

how are the images referenced in the material file? with an absolute path or a relative path? I just tested a standalone loading an obj into jit.gl.model that references a .mtl that references 3 image files. I copied the entire folder into the .app/Contents/Resources folder and it was able to find all the necessary files for rendering. However the image files are referenced by name only, rather than absolute path.

The jit.gl.model loader uses a few different codepaths to find the textures, so it's hard to say what's not working between the standalone and the Max app version. However manually copying into the app bundle resources folder should do the trick.

Jonny's icon

Hi Rob

Thanks for your reply - and confirming this is just me and it should work!

The images are referenced with relative paths, so just the filename, like this (and everything is in the same dir):

newmtl Rough_scratched_copper_metal
Ka 1.000000 1.000000 1.000000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.500000
d 1.000000
illum 2
map_Kd metal04_copper_diffuse.jpg
map_Ns metal04_roughness.jpg
map_refl metal04_B_metalness.jpg
map_Bump -bm 1.000000 metal04_normal_opengl.jpg

In fact I made a basic test cube object in Blender, without a real texture, just a blue colour and even that doesn't get rendered in the app.

I am using Blender 5.2 and exporting them using the built-in exported, using the default settings (although I've fiddled with some of them without improvement), but also Max 8.6.5, so I can only assume I have some sort of versions incompatibility?

Ah, 1 sec... thought I'd spotted something - when I tried to change the default app of the mtl files the Finder said "no" as it was locked (or something), so I thought maybe Max couldn't open the mtl file to add to the package (although it works in in Max). Anyway, Blender (or Apple) had added attributes to the exported files, like this com.apple.provenance     11 which I thought might be getting in the way. But no, I deleted them with xattr -c but it made no difference.

Back to random experimenting, sigh (but thanks!)

(p.s. Blender files attached, not allowed)

Rob Ramirez's icon

if it's rendering fine in Max, but not in your standalone, then there is no need to investigate your Blender export process, it is likely a file search problem with the standalone. You can try uploading your standalone somewhere and I can investigate.

Jonny's icon

Thanks for the offer Rob, seems that's just what i needed!

I was preparing a "tidy" zip for you with the simple cube.obj demo and tried to recreate the app on my desktop (where previously i'd been working on my laptop), so the path to the mtl file was different, and editing the "build script" to make that relative (i.e. just cube.mtl as opposed to the full path generated by clicking the "include file" button on the build dialog) seems to do the trick, and now it works!

Woo!

Now working on the big app, still some path weirdness i think...

[after some fiddling]

Not sure i have solved the pattern completely, but adding the mtland image files to the build script as relative paths (just filenames), sort of works, however, then the obj files don't get included - i can load them using the read message, and when they load they have their materials, which is nice, but however i include the obj files (relative, absolute to the disc root, fully absolute including the disc name, as you get using the "include file" button) nothing works except copying the files into the Contents/Resuources directory inside the app... but at least i have a complete build now...

Hopefully this is better in Max 9?

Thanks for your help again!