Migration from Java3D to JMonkey


I’ve got the order to migrate a Java3d project to a newer graphic engine and i decided to use jmonkey. But, my big problem is, I have never develop a 3D program before and I have less basic knowledge about it. The program is not very complex, it shows a model where you can move around with the camera and zooming. It runs in a eclipse RCP application. Some classes from j3d are contained in jme3 but even not all. My hope is there are some corresponding classes to the classes are listed below. I know not for each class it will exists one.

The following classes are from Java3D:

Color3f → com.jme3.terrain.noise.Color (I think it would be the right replacement)

For example the Cylinder are existing in both Projects with the same constructor parameters.

Help me please to find corresponding classes in JME3 to the aboved listed classes from J3D.

Thanks in advance

I don’t think the idea is to just add JME as a library and continue using J3D (if I understood correctly).
Just look at the tutorials https://docs.jmonkeyengine.org/index.html here.
You’ll find everything you need to display a model and have a simple camera.

Correct I don’t want use continuosly Java3D, I have to repalce it completly. Both framework use a scenegraph, thereforce I hoped for a easy replacement without a huge learning curve. I know it will not be work in all cases, but may be in some one. I know there is not a one to one counterpart.

For example PlatformGeometry from Java3D. Which class would you use in JMonkey?
Or what is equivalent to javax.media.j3d.Canvas3D. Or what makes the same like the RotationInterpolator.
With this information I think I must only concentrate on this parts.
I’m not interessted in to become a 3D programmer, it’s a very difficult matter. I just need as much to solve this task.

Thanks for your fast reply.

No problem.
The thing is, I don’t know J3D, and there probably aren’t equivalent classes for many.
Go ahead and read through all the beginner tutorials (you can also skip stuff that you don’t think you’ll need, e.g. physics), and you’ll know everything you have to for what you described.

For that you would create a quad/plane-geometry in jme.

For the canvas, this introduction might help you to get in:

For rotations jme uses Quaternions. There is a function to interpolate between two rotations, it is called slerp()

But to know better how things work in jmonkeyengine I highly recommend to have a look in the wiki and go through some tutorials.

1 Like

Really cool. That is what I meant. I have no idea about Java3D. You give me an approach where I have to looking for.
I kown I have to learn jmonkey, just even the parts I need.

I used to use Java3D and had done a few basic projects with it. Then I moved to jMonkeyEngine and I found it A LOT easier to use. First you don’t have to pack() [is that the method? I can’t remember now] your scene graph before you run it. You just run it. You can add 3D objects and remove them from the scene graph just by running the appropriate method (i.e. addChild(), removeChild()). Transforms are done on the 3D objects directly, you don’t need to use transform objects to do that. There are a lot of things that are made easier, including importing geometry etc. I think you’ll like it a lot and wonder to yourself “How did I ever get on with Java3D?” The materials are easy to use and include all kinds of shader objects that give your scene a nice look without any trouble.

Work through the initial tutorials and you’ll soon see how easy things are. I have gotten a lot further with jMonkey than I ever got with Java3D. And a lot quicker too. It’s really nice to work with.


I have to convert IndexedTriangleArray from java 3d to comparable class in JME and show it.
I think a Mesh is the right choise.
Anybody an idea how I can transform a IndexedTriangleArray(Java3D) to a Mesh(JME) programmatically?


I tried to read the IndexedTriangleArray from Java3D and fill the mesh with the following code:

Mesh mesh=new Mesh();
System.out.println("VertexCount: "+ita.getVertexCount());
Vector3f[] vertices = new Vector3f[ita.getVertexCount()];
for(int i=0;i<vertices.length;i++) {
float[] c = new float[3];
ita.getCoordinate(i, c);
vertices[i] = new Vector3f(c[0], c[1], c[2]);

    int[] indexes = new int[ita.getIndexCount()];
    for(int i=0;i< ita.getIndexCount();i++){
    mesh.setBuffer(Type.Index,    3, BufferUtils.createIntBuffer(indexes));
    mesh.setBuffer(Type.Position, 3, BufferUtils.createFloatBuffer(vertices));
    Geometry geo = new Geometry("OurMesh", mesh); // using our custom mesh object
    Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    mat.setColor("Color", ColorRGBA.Blue);

But my model is very huge. The original code written in Java3D is:
Shape3D shape3D = new Shape3D();
shape3D.setAppearance(createAppearance(new Color3f(1.0f, 1.0f, 1.0f)));

This works. Maybe I use the wrong vertices?

Try geo.setScale(0.125f); and see if the Model looks correct.

Also: the size on the screen depends on the camera. Move it back

Thanks for your fast reply and very good hint.
A method setScale doesn’t exists but one named setLocalScale.
I tried befiore the scale Method but that has no effect.

I guess your camera is just too close to the object :slight_smile:
I personally mostly use the ChaseCamera, you can orbit your object, zoom in/out, a perfect tool to inspect an object. Just take your geo as target of the ChaseCamera.