OBJLoader

Recently I wrote an bvh-importer for j3me (actually only the skeleton) and I noticed, that the J3ME-obj-loader isvery choosy which obj-files it loads.

I.e. like written here:

http://en.wikipedia.org/wiki/Wavefront_.obj_file#Material_template_library

Materials can be transparent. This is referred to as being dissolved. Unlike real transparency, the result does not depend upon the thickness of the object.
d 0.9 # some implementations use 'd'
Tr 0.9 # others use 'Tr'

the j3me obj-importer only supports the 'd' and not the 'Tr' versions.
Also the importer doesn't support the 'o'-tag to open a new object, so my model consists of only one Geometry and so I cant apply the skeleton.
Also the importer throws NullPointerExceptions and NumberFomatExceptions on models, which work for me in various other programs.
Are there any plans or free time to overhaul this importer to make it accepting more different, but allowed, tags?
Or is this it's purpose to support only specific tags?
Cheers,
doe300

Yes there are a lot of features that are not supported.

Generally jME3 has better support for OgreXML models and soon we will have the ability to directly import Blender models.

Of course if you’re willing to contribute to the OBJ Loader thats always welcome :slight_smile:

So here are my first attempts of changes:

In com.jme3.scene.plugins.MTLLoader:

line 114:

[java]}else if (cmd.equals(“d”)){[/java]

to

[java]}else if (cmd.equals(“d”)||cmd.equals(“Tr”)){[/java]

And the support for the ‘o’-tag is uploaded here:

http://code.google.com/p/jmonkeyengine/issues/detail?id=352

Should be reviewed and tested with various models!

Please post patch files for changes. New files or manual collections of changed lines are not very usable.

how to create patch files?

When you are using jMP right-click the file in the project explorer and select “Subversion->Diff”, then in the opening window right-click the file again and select “Export Diff Path”. You can paste the file content here in the Contributions group using the “patch” tags.

I fixed some issues with the MTL loading. Still didn’t start doing the “o” directives yet … So please post a patch for that

Yeah I uploaded a diff file to the previous link

http://code.google.com/p/jmonkeyengine/issues/detail?id=352

So the last fix should be ok.

To your fix in MTLLoader:

shouldn’t this(line 135):

[java]color.a = scan.nextFloat();[/java]

be this?:

[java]color.a = alpha;[/java]