Appearance of Sphere when position is off center

I’ve been working on the development of a Jme3 application for some time now and I just noticed something that I believe has always been there. If I place a sphere in the center of the screen I see a circle. Good. But If I place it off center, I see an ellipse. Isn’t that wrong? When I look up at the Moon I see a circle no matter where it is in the sky. Are other programmers seeing this elliptical behavior? Is this behavior coming from me, my computer hardware/software or Jme3?

Sounds like you have some funky frustum settings like a wide field of view or something.

Hard to say without seeing code and pictures.

Thanks for your reply and lead. I’m afraid I have no idea what a frustum is, even after reading about it on Wiki. I believe I’m using Jme3 defaults. I trimmed my application to the minimum below and I am still seeing the unwanted behavior. Any further info would be greatly appreciated.

import java.awt.Canvas;
import java.awt.Dimension;

import javax.swing.JFrame;
import javax.swing.SwingUtilities;

import com.jme3.light.AmbientLight;
import com.jme3.light.DirectionalLight;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Sphere;
import com.jme3.system.AppSettings;
import com.jme3.system.JmeCanvasContext;

public final class Jme3 extends SimpleApplication

public Jme3()    
    super( new StatsAppState(), new DebugKeysAppState() );
    AppSettings appSettings = new AppSettings( true );
    appSettings.setFrameRate( 60 );
    setSettings( appSettings );
    JmeCanvasContext ctx = ( JmeCanvasContext )getContext();
    Canvas canvas = ctx.getCanvas();
    ctx.setSystemListener( this );

    JFrame frame = new JFrame( "Simulation Scene" );
    frame.setMinimumSize( new Dimension( 1000, 600 ) );
    frame.setPreferredSize( new Dimension( 1000, 600 ) );       
    frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );    
    frame.add( canvas );
   public static void main( String[] args ) 
       SwingUtilities.invokeLater( new Runnable() { public void run() { new Jme3(); } } );

public void simpleInitApp() 
    /** Must add a light to make an object visible! */
    DirectionalLight sun = new DirectionalLight();
    sun.setDirection(new Vector3f( .4f, -.4f, -.1f ).normalizeLocal());  // over left shoulder?
    rootNode.addLight( sun );
    AmbientLight al = new AmbientLight();
    al.setColor( ColorRGBA.White );
    rootNode.addLight( al );
    // create a blue Sphere at coordinates (0,0,0) 
    Sphere sphere1 = new Sphere( 32,32, 1f );
    Geometry blueSphere = new Geometry( "Sphere1", sphere1 );
    blueSphere.setLocalTranslation( new Vector3f(0,0,0) );
    Material mat1 = new Material( assetManager, "Common/MatDefs/Misc/Unshaded.j3md" );
    mat1.setColor( "Color", ColorRGBA.Blue );
    blueSphere.setMaterial( mat1 );
    // create a red Sphere straight beside the blue one at (6,0,0) 
    Sphere sphere2 = new Sphere( 32,32, 1f );
    Geometry redSphere = new Geometry( "Sphere2", sphere2 );
    redSphere.setLocalTranslation( new Vector3f(6,0,0) );
    Material mat2 = new Material( assetManager, "Common/MatDefs/Misc/Unshaded.j3md" );
    mat2.setColor( "Color", ColorRGBA.Red );
    redSphere.setMaterial( mat2 );
    rootNode.attachChild( blueSphere );
    rootNode.attachChild( redSphere );


public void simpleUpdate( float tpf ) 


Maybe try making an app that doesn’t do it’s own swing stuff and see if you still get the issue. Also, I see nowhere in there that you actually create a sphere.

A camera frustum is the truncated pyramid defined by the camera settings. I’m getting tired of pointing people to javadoc today so suffice it to say JME has a camera and it has frustum settings. But your issue is more likely that the window size is getting set in some funky way that is not conpatible with the default camera settings.

…which means if you create a normal JME app it should look normal. Then you can sort out the difference.

Thanks again for replying.

With regard to the code for creating the spheres, it is there. My post above ended up with a scrollbar window. Don’t know why. You have to scroll down to see all the code.

I did not mention that I did copy/paste/run the code from a Jme3 tutorial that did not use a swing frame and the spheres in that application look fine. I did a lot of experimenting with window sizes, bigger, smaller, square, not square. What I posted only specifies a size for the JFrame. At one point I specified height and width of the canvas too. No success.

I have a JFrame, an awt Canvas and Jme3 graphics engine. Since the canvas is the only thing in the window, I suppose I could experiment with an awt Frame.

Meanwhile I’ll try again to read up on frustums and graphics.

I think I have a solution. Right now my Jme3 app runs in a separate JFrame from the swing buttons and other controls. I made 2 JFrames because I couldn’t get the jme3 canvas to display properly next to a swing panel when running on a Mac. (see other thread)

Now I think I did not go far enough. I don’t think I even need to run jme3 in a JFrame. After all, it is its own application. So I tried just running it that way and I no longer have the frustum problem. Now my “main” looks like the code below. I have not tested the communications between the two applications yet but since they have handles to each other I am not expecting any big problems.

   public static void main( String[] args ) 
       // instantiate standard extension of Jme3 SimpleApplication
       Jme3 app = new Jme3();   
       // instantiate Java application with Swing buttons, controls, etc.
       WindowConsole wc = new WindowConsole( app ); 
       // start jme3

I am having a similar problem.
I tried to change the frustum but had no better results, did you find any good doc about how to setup the camera ?
I will post another thread also, with some code, who knows, I guess its a comum problem.
I remember I had this problem before a long time ago with a diferent engine, in my case it looks like to be problem on the camera “lens”.

Nice to know I’m not alone. I stopped searching for docs on the camera because I thought I had a work around. The workaround did not work.

This is all I know right now:
When the default Jme3 application displays objects everything is OK.
When I put the Jme3 canvas in a JFrame I get the problem.
I’m experimenting to see if I can get the default to show the problem. My thinking is that I could look at camera settings to discoever what is different.