Sphere deforming when rotated [SOLVED]


I am just doing some tests with spheres and got some “deformation” on the textures when I rotate it.
I am not sure what is causing it, even the simple code from the sample with default camera have this problem.
It may be the texture ? ( I tried to change the texture with no success )
It may be the face vector direction ? ( I am not sure how to change it, could not find any info yet )
It may be the fustrum from the camera ? ( default camera and this chase camera. even with this commented leads to the same problem )

Code :

    Sphere mesh = new Sphere(32, 32, 10, false, true);
    terra = new Geometry("A shape", mesh);
    Material sphereMat = new Material(assetManager,  "Common/MatDefs/Light/Lighting.j3md");
sphereMat.setTexture("DiffuseMap", assetManager.loadTexture("compilation.png"));
    sphereMat.setFloat("Shininess", 64f);  // [0,128]
    terra.setLocalTranslation(0, 0, -50);

    ChaseCamera chaseCam = new ChaseCamera(cam, inputManager);
    chaseCam.setDefaultDistance(50); //setLocalTranslation(0, 0, -50);        
    //float aspect = (float)cam.getWidth() / (float)cam.getHeight();
    //cam.setFrustumPerspective( 45f, aspect, 0.1f, cam.getFrustumFar() );

Any Help ?


A picture in this case is worth 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 words.

1 Like

Make it a video and it’s worth 30 pictures a second

Note that it seens to be ok arround y axix, but when rotating in the equador ( x axix) it deforms the middle…

I don’t think this is a real texture deformation.This might be an optical effect,use a simpler texture,maybe one made of 3 bars of different colors (like a flag) and see if bars get resized or it’s just an illusion made by the chaotic texture.

Hi aegroto, thanks for your reply.
I already tried other textures, including the one from the tutorial, with the same effect.
I think its related with the Sphere-mapped SkyBox texturing problems.
Since the sintoms are the same : “distortion in the poles”.
I am doing some resources about cubemap, if anyone has a free tool to indicate to convert my texture to odd I will be glad !

Note: your sphere is round the whole time so this doesn’t have anything to do with camera frustum settings like that other thread.

It’s strange though because it’s like you have set this up like an environment map or something but your code isn’t doing that (presuming it’s the same material code).

Its driving me nuts.
I found dosens of threads with the same problem, and no solution, found nothing also in the documentation, maybe I am looking on the wrong docs ??? The javadoc says nothing to me.
There is someone that gets close to the solution Texture Mapping a Sphere, but it was a long time a go, I dont know if this user is active anymore …
Anyone have any clue on how to render a simple sphere using a dds file ??? Obs: I already have the dds, but now I have the same problem from this old topic.

A) I’ve seen no other threads with this issue… so links might be helpful. The other threads I’ve seen were having to do with distorted geometry and not distorted textures.

B) looking at your code again, you are creating an inside out sphere… so you are seeing the inside of the back and not the outside of the front… in which case the texture looks right to me.

What do you mean with inside out ?
Do you have any sugestion to try out on the code ?

This is the complete code :

@Override public void simpleInitApp() {
Sphere mesh = new Sphere(32, 32, 10, true, true);
terra = new Geometry(“A shape”, mesh);
Material sphereMat = new Material(assetManager, “Common/MatDefs/Light/Lighting.j3md”);
sphereMat.setTexture(“DiffuseMap”, assetManager.loadTexture(“compilation.png”));
terra.setLocalTranslation(0, 0, -50);
DirectionalLight sun = new DirectionalLight();
sun.setDirection(new Vector3f(1,0,-2).normalizeLocal());
AmbientLight ambient = new AmbientLight();
ChaseCamera chaseCam = new ChaseCamera(cam, inputManager);
chaseCam.setDefaultDistance(30); //setLocalTranslation(0, 0, -50);

This is the picture :

I tried also the Pond.jpg , Skysphere.jpg , and some bmp I created myself with squeres, all same result.

I get curious about you saying it may be related with double texture sides if I undestood correctly, do you think the camera is currently inside the sphere ???


Inside out: as in, you are rendering only the inner surfaces of the sphere and not the outside surfaces. As in, if you could somehow see through the side of a ball and only see the insides. Not sure how else to explain “inside out” or if it’s a language problem.

You use this constructor:

Note your value of “true” for the last parameter stating that you want to render the inside of the sphere. Like for a sky sphere or other thing that you will be inside of. Interior means inside. (in case it’s a language issue)

Haa understood.
I guess I already tried that, its true on this last peace of code I sent right ?

Yes. true = interior = only draw the inside = exactly what your video shows.

False = not interior = outside = a normal ball/earth/whatever that you want to view with your head outside of the ball.

Ops ! I dont beleave it was something soooo simple !
Its working now ! Lool I love you !
Thanks friend !