Obj + Textures

Hi

I posted my problem already in Adding the newdawn loaders to the distribution, but because it’s there pretty OT I’ll post it again here.

I’ve got a scene in Blender3d, which I exported to an .obj file. When I load the file with OBJLoader2 It loads, but it doesn’t load the textures - all objects are plain white. When I try to load it with ObjLoader I simply get null returned.

Now I took the suggestions of Bluesky to heart and tried the Loader he suggested. Then I’m only able to export one Object at a time, but that shouldn’t matter for now. More important: I don’t get the textures there either. The only thing I achieved there, is that I get shading. But even this is not complete, because I can only export the objects one by one, the objects are only exported to be at the origin. The Loader also has support for exporting the geometry at the position in the scene, but then all the normals are inverted.

The most may be bugs of the Blender .OBJ exporter.

Here’s again my output when I try to load the objects I exported with blender:

The standart Wavefront export tool (Sphere.001 could be the name of the object or the material of the object):
org.xith3d.loaders.obj.MaterialLibLoader2: ignoring unknown material tag: “d 1.0”
org.xith3d.loaders.obj.MaterialLibLoader2: ignoring unknown material tag: “illum 2”
org.xith3d.loaders.obj.OBJLoader2: ignoring unknown OBJ tag: “o Sphere_None”
org.xith3d.loaders.obj.OBJLoader2: ignoring unknown OBJ tag: “o Sphere.001_None”
org.xith3d.loaders.obj.OBJLoader2: ignoring unknown OBJ tag: “o Sphere.002_None”
org.xith3d.loaders.obj.OBJLoader2: ignoring unknown OBJ tag: “o Sphere.003_None”
org.xith3d.loaders.obj.OBJLoader2: ignoring unknown OBJ tag: “o Sphere.004_None”
org.xith3d.loaders.obj.OBJLoader2: ignoring unknown OBJ tag: “o Sphere.005_None”
org.xith3d.loaders.obj.OBJLoader2: ignoring unknown OBJ tag: “o Sphere.006_None”
org.xith3d.loaders.obj.OBJLoader2: ignoring unknown OBJ tag: “o Sphere.007_None”
org.xith3d.loaders.obj.OBJLoader2: ignoring unknown OBJ tag: “o Sphere.008_None”
org.xith3d.loaders.obj.OBJLoader2: ignoring unknown OBJ tag: “o Sphere.009_None”
org.xith3d.loaders.obj.OBJLoader2: ignoring unknown OBJ tag: “o Sphere.010_None”
org.xith3d.loaders.obj.OBJLoader2: ignoring unknown OBJ tag: “o Sphere.011_None”

The Object I got with the Exporter Bluesky suggested (Mode = Standart) - this also the one, where I got shading:
org.xith3d.loaders.obj.OBJLoader2: ignoring unknown OBJ tag: “o None”

The Object I got with the Exporter Bluesky suggested (Mode = Default) - this doesn’t got shading:
org.xith3d.loaders.obj.MaterialLibLoader2: ignoring unknown material tag: “illum 1”

It is strange, that it loads shading in the case, where there’s no .mtl file existing.

I hope I’m rather stupid, than that there is an error in the code.
Arne

Ok I now I know why I don’t get my texture - it’s not referenced int the .mtl file. -> So a problem of the exporter.

I’ll look if I can twist that around manually (I’ve looked into the source of OBJLoader, so I know now the keywords - hehe)

This is not optimal, so if somebody knows a good exporter - tell me!!

Arne

Ok I did some research now and I googled this. It describes all these symbols at the beginning of each line.

So this is also solved:

org.xith3d.loaders.obj.OBJLoader2: ignoring unknown OBJ tag: “o Sphere.001_None”

Sphere.001_None is simply the name of the object.

It seems the exporter is able to export an newer version of .obj than we’re able to load.

I also tried now the hack with manually adding the Texture-file. I now get shading (which I didn’t got before with that file), but the texture still doesn’t show up.

Arne

If you are not tied to Blender, I have been hacking “Art of Illusion” aoi.sourceforge.net. I have a modified OBJ exporter that writes one OBJ per shape with texture info Xith3D understands. I additionally generate a manifest of the exported OBJs. Finally I have added extensions to associated object specific data with an Obj. For example I can id a rectangular shape as a “DOOR” and specify a “lock” and a required “Key” etc.

It definitely looks good!!
I’ll try it out now.

At http://home.mindspring.com/~hawkwind/ there is a jar (ao2.jar) Get this and put in the plugins dir of your AOI install

restart aoi

when exporting an OBJ scene there may be two OBJ exporters in the menu use the first

varioius prompts occur and you save to disk.

examine the save dir, there should be N objs, N .ext files, a manifest file and some other stuff I use for my game.

the manifest is a list of the exported objs numbered 1-> N, I renumber them because aoi when copying an obj gives it gives the same name and i wanted unique names. the ext file contains some object specific data, bounds, location,the actual obj name in the scene, and other stuff

when I read the obj files in I read the corresponding ext file which tells me where to translate the target obj to among other things

In the tools menus of aoi there is now also an Entity menu option. If you slect am obj within AOI and then use the entity menu button and ent entry is added to the scene, double click on this and it displays the attribute possibilities i use in my game. I can pass on the source later if thi stuff is something you want to hack

One cool thing about aoi is you can write beanshell scripts and execute them to manipilate the scene Tools-scripts displays a current list. if you look at the script subdir you can see the script source

AOI has some cool texture gen capapbilities I would definately look at the online docs

I can post some of my source that processes the various files if interested