AC3D and jME

Hello all.



I am wondering if there are any loaders for AC3D files to jME?



New to the 3D world, I’m looking for the best combination to use with LWJGL. jME appears to be the best option so far … though not very compatable with my Java3D books. :wink: All I need is a way to load my ground maps now, made in AC3D.



Thanks for any info! (general newbie tips also appreciated) :wink:

Currently, no, there is no AC3D exporter. There are exporters for 3DS, OBJ, ASE, MD2, MD3, and Milkshape. So, if you can export your AC3D to one of these formats in your 3D tool, you can then export them to .jme using our exporters.

Thanks! I do have both of the New Dawn loaders (Java3D and Xith), guess I’ll have a look at them and see how the jME format works.



P.S.

I am still looking around the site, but since I’m here I might as well ask. :wink: Are there any examples on how to load a geometry file? I just converted my AC3D file to a MD2 and am now picking through the docs looking for the right way to load them.



Thanks again!

Are there any examples on how to load a geometry file?


your best bet right now is to take a look at:

jmetest.renderer.loader.TestMd2JmeWrite

This example, takes a MD2 file, converts it to jme and then loads it. For your real project, you'll just want to have .jme files (rather than converting each time the app starts), but it should show you how the process works.

An update to the AC3D loader issue – I’ve started to port the New Dawn Software loader for Xith3D. I am done with the code to read in the .ac file, I think, and am now trying to piece together the Node sent into the JmeBinaryWriter().



If anyone would like to take a whack at finishing up the class before I can (probably not a hard thing to do), please snag the code I have so far:

http://www.rightstep.org/snipets/java/ac3dloader/



… I actually might be able to figure everything out before the end of weekend too. But I’ve thought I could do something “by the end of the weekend” many time before. :slight_smile:

As I’m sitting here, banging my head against the wall, a thought suddenly came to me (I must have hit a stud). AC3D provides plugin support for exporting file types – it would seem silly to go through the trouble of writing a AC3D loader, when the program could (theoretically) just spit out a .JME to begin with.



Are the complete .JME file specs avalable anywhere? As with a loader I don’t have enough 3D knowledge to write a plugin for AC3D myself, but I’d love to take the specs over the forums there and try to get a few folks to help me write a direct exporter!

are you sure AC3d does not have just an OBJ export plugin?

Yes it does, but the same issue still comes up. Why export-and-convert, when one could just export and be ready to go?



Another problem with the OBJ exporter is that it does not appear to properly carry texture file names over to the OBJ/MTL file. After exporting my model 3 times, I’ve never once gotten references to my texture images in the MTL file. So, at least at the moment, exporting to OBJ file puts you even further behind a AC3D file in getting the information in.

I have made a .xml file be exported from Max so that it can be converted to binary by a very small program. Im currently in the process of recreating it to make it better and after that, il send you the code via PM soon so you can (if you want) make one available for AC3D.



Thx, DP

Sure, that would be great. Thanks!

I may be wrong, but I personally doubt the .jme format is defined in a finalized state yet… writing an exporter to .jme might be an exercise in frustration as thing change over the next few releases.

It would at least be a step in the right direction. I’m so ready to start tinkering with things, including this new map I finally finished, but I can’t… because I can’t get it loaded into jME! :’(



I gave the ObjToJme converter a try, on one of my exported OBJ files, only to get the following:


~/tmp $ sh load.sh geffen.obj geffen.jme
Converting file /home/nick/tmp/geffen.obj to /home/nick/tmp/geffen.jme
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 4, Size: 4
        at java.util.ArrayList.RangeCheck(ArrayList.java:547)
        at java.util.ArrayList.get(ArrayList.java:322)
        at com.jme.scene.model.XMLparser.Converters.ObjToJme$IndexSet.parseStringArray(Unknown Source)
        at com.jme.scene.model.XMLparser.Converters.ObjToJme.addFaces(Unknown Source)
        at com.jme.scene.model.XMLparser.Converters.ObjToJme.processLine(Unknown Source)
        at com.jme.scene.model.XMLparser.Converters.ObjToJme.convert(Unknown Source)
        at com.jme.scene.model.XMLparser.Converters.FormatConverter.attemptFileConvert(Unknown Source)
        at com.jme.scene.model.XMLparser.Converters.ObjToJme.main(Unknown Source)



The load.sh script looks is as follows:

#!/bin/sh

export JMEHOME="/home/nick/IdeaProjects/jMEBuild/jMECVS"

export CLASSPATH=$JMEHOME/lib/jogg-0.0.5.jar:$JMEHOME/lib/jorbis-0.0.12.jar:$JMEHOME/lib/lwjgl.jar:$JMEHOME/target/jme.jar:$CLASSPATH

export LD_LIBRARY_PATH=.:$JMEHOME/lib:$CLASSPATH

/opt/jdk1.5.0/bin/java -cp $CLASSPATH com.jme.scene.model.XMLparser.Converters.ObjToJme $1 $2



I have an open thread over at AC3D trying to figure this out too. Before Friday, I thought AC3D was the greatest... now I want to burn it alive. :)

From your stack trace, I can’t tell what line is giving the error. Does anyone know an “easy” way to get rid of the “(Unknown Source)” message? I try recompiling and sometimes I get that message too.



If you can, email me the .obj file and I’ll look and see what line is giving you the error and try to fix it.



cep221ATgmailDOTcom

Thanks Cep. I can attach it to a IM if you’d like, but I’m actually make some progress on a AC3D loader. Hopefully I can get that working and I will not have to worry about OBJs anymore. :slight_smile:



I have a question about my current loader status. I am reading in my .AC (AC3D file ext.) file and outputting a .JME. I am then attempting to load the .jme file into the a SimpleGame. Here are the guts to my app.


  protected void simpleInitGame() {
    JmeBinaryReader jbr = new JmeBinaryReader();

    /** use a bounding box instead of a bounding sphere */
    jbr.setProperty("bound", "box");

    try {
      FileInputStream in = new FileInputStream("/home/nick/tmp/test_pattern.jme");
      Node ground = jbr.loadBinaryFormat(in);
      rootNode.attachChild(ground);
    } catch (FileNotFoundException e) {
      e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
    } catch (IOException e) {
    }
  }



When the program loads, all I see is a little gray square that moves around when I move the mouse. The information at the bottom does show the correct number of verticies (12) and triangles (6).

All my scene is, at the moment, are 3 rectangles; each lies on a different plane and is a different color. No textures (yet).

Am I missing something to get my scene to show up properly? Is there any way I can verify that everything converted to the .JME file correctly?

Thanks for all the help everyone!

That looks like it should load. To verify, you can convert the .jme to XML and print that out and look at it.

try hitting ‘L’ to toggle lighting. Vertex coloring (if you are using that) will show up when lights are off.