Beginner Questions - II

Me again! This time I have two questions. First, I understand that jME has its own model format, and you export whatever format you are using to that format. However, which is the best format to start from? Several programs give you a choice of the export format, which one converts the best into the native jME format. I am using Blender right now (I know, but I don’t have any money for software :wink: ) and I was just curious which format I should export to for the best export to jME. Secondly, I have a question about volumetric fog. I know that it is not currently supported by jME (though it is planned,) but I have been doing some research into how it is done and it seems really interesting! How would it be implemented by jME? Do you directly use the OpenGL functions? Anyway, I am just curious… when I saw that there was actually a “fog equation” I knew it would be fun to think about. Thanks! :slight_smile:

the most one I use is the 3ds one. Second comes the XML, third comes the Md2. Those I use the most often. Heck, ive even written a little application to convert to .jme from the above three formats because I use them so often. :slight_smile:



I suspect the volumetric fog plans are like the current fog, it would be a rendering state of some sort. And no, you will most definetly not have to call any OpenGL methods.



Oh yeah, ive made a little MaxScript that exports to .xml from max. If you become proficient at blender and hence python, it would be cool to port it over. Maybe one day il give blender a second try :wink:



DP

Volumetric fog is going to be a little more difficult than just a state, simply because of the way Volumetric Fog works (Vertices have fog attributes assigned, similar to texture coordinates, using glFogCoord function). So, some thought and care will have to be done while building the feature. Anyways, whatever the solution, it will be at a higher level than the OpenGL function calls (just like the other parts of the engine), so you will not have to call OpenGL to use it.

ARGGGGGGGGGGGG }:-@ I keep forgetting to log in!!

Its nothing spectacular, but here it is:



import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URL;
import java.util.logging.Level;

import com.jme.app.SimpleGame;
import com.jme.scene.model.XMLparser.XMLtoBinary;
import com.jme.scene.model.XMLparser.Converters.MaxToJme;
import com.jme.scene.model.XMLparser.Converters.Md2ToJme;
import com.jme.util.LoggingSystem;

/**
 * @author Ahmed
 * TODO remove this class when game is complete
 */
public class ConvertToJme extends SimpleGame {

    private final String modelname = "com/data/models/bus/bus.3ds";

    private final String exitFileName = "bus.jme";

    private String type = "3ds";

    protected void simpleInitGame() {
        if ("Md2".equalsIgnoreCase(type)) {
           Md2ToJme convertor = new Md2ToJme();
            FileOutputStream BO = null;
            try {
                File f = new File(exitFileName);
                BO = new FileOutputStream(f);
            } catch (FileNotFoundException ex) {
            }
            URL modelFileName = ConvertToJme.class.getClassLoader()
                    .getResource(modelname);

            try {
               convertor.convert(modelFileName.openStream(), BO);
               BO.close();
            } catch (IOException ioe) {
                LoggingSystem.getLogger().log(Level.SEVERE,
                        ioe.getCause() + ": " + ioe.getMessage());
            }           
        } else if ("xml".equalsIgnoreCase(type)) {
            XMLtoBinary convertor = new XMLtoBinary();
            FileOutputStream BO = null;
            try {
                File f= new File(exitFileName);
                BO = new FileOutputStream(f);
            }catch (FileNotFoundException ex) {
            }
            URL modelFileName = ConvertToJme.class.getClassLoader().getResource(modelname);
           
            try {
                convertor.sendXMLtoBinary(modelFileName.openStream(), BO);
                BO.close();
            }catch (IOException ioe) {
                LoggingSystem.getLogger().log(Level.SEVERE,
                        ioe.getCause() + ": " + ioe.getMessage());
            }
        }else if ("3ds".equalsIgnoreCase(type)) {
           MaxToJme convertor = new MaxToJme();
           FileOutputStream fio = null;
           
           try {
              File f = new File(exitFileName);
              fio = new FileOutputStream(f);
           }catch (FileNotFoundException fnfe) {
           }
           URL modelFileName = ConvertToJme.class.getClassLoader().getResource(modelname);
           
            try {
                convertor.convert(modelFileName.openStream(), fio);
                fio.close();
            }catch (IOException ioe) {
                LoggingSystem.getLogger().log(Level.SEVERE,
                        ioe.getCause() + ": " + ioe.getMessage());
            }
        }
    }

    public static void main(String[] args) {
        ConvertToJme app = new ConvertToJme();
        app.setDialogBehaviour(ALWAYS_SHOW_PROPS_DIALOG);
        app.start();
    }
}



Usage: Change modelname, exitFileName and type and run

DP

Of all the formats jME supports, the ms3d format is the best to use for animation and .obj for models that don’t move. It’s the most defined so you’re very unlikely to run into “problems” loading a model.



Every model creation tool on the market can save to .obj format. Milkshape3D is like, what, 25$? Not much at all considering what it gives.



Outside of that, md2

I just wanted to thank everyone for all the help, my new computer is set up and jME works great! I think there may be a problem with the lwjgl in the CVS, though, because ant kept telling me that it could not find the “Display” methods in lwjgl. I ended up just going to the lwjgl website and copied that lwjgl over the one in the jME CVS and it compiled successfully after that (I don’t have the specific errors here but if you want I can try to get them again.) Also, Cep21, thanks for the info about Milkshape, I had it confused with another program I was looking at that was $299! So, $25 is much more reasonable. Anyway, thanks again!

You just happened to catch us between uploading the LWJGL 0.92 support and uploading the LWJGL 0.92 files into the library. New libs are up so should be straight from CVS now.