SkySphere problem

Hey,



I made a solar system and I would like to display stars as backround. So I would like to know how can I do it so it looks nice without distortions.

Right now as it wraps inside the sphere the point where its edges are looks distorted and not very realistic.



Used:

[java]

Sphere skyMesh = new Sphere(200, 200, 2000, false, true);

Geometry skySphere = new Geometry("Sky", skyMesh);

skySphere.updateModelBound();

skySphere.setQueueBucket(Bucket.Sky);

Material skyMaterial = new Material(assetManager, "Common/MatDefs/Misc/Sky.j3md");

TextureKey key = new TextureKey("Textures/Sky/stars.jpg", false);

key.setGenerateMips(true);

Texture tex = assetManager.loadTexture(key);

skyMaterial.setTexture("m_Texture", tex);

skyMaterial.setVector3("m_NormalScale", Vector3f.UNIT_XYZ);

skyMaterial.setBoolean("m_SphereMap", true);

skySphere.setMaterial(skyMaterial);

rootNode.attachChild(skySphere);

[/java]

As well as:

[java]

rootNode.attachChild(SkyFactory.createSky(

assetManager, "Textures/Sky/stars.jpg", true));

[/java]

Here is the image of the distorted part of the space:

You kidding right.?..this is not an issue…THIS IS HYPERSPACE JUMP!!!

Some people would kill to have an effect like this :stuck_out_tongue:



Have you try to create a cube map from your picture? I don’t think you’ll get what you want with the sphere map flag and a flat texture.

2 Likes

Using a cubemap should fix the issue

I will try out cubemap - haven’t used it before.

P.S. I hope those people won’t come after me :smiley:

I lost a lot of time by trying to use a spheremap , right now i’m using a cubemap and i really don’t like the render , is there anyway to use sphere ?

yeah, you can by passing true to the SkyFactory.createSky method as the last parameter…but your map has to be a sphere map in order to render properly.

You can’t expect it to look good by using any random sky picture.

Yes and i followed the tutorial to do spheres maps and i have the hypespace jump result also ^^ , that’s why i’m curious to see how it can works.



Also i noticed that on some JM examples that some sky are called skysphere where they are just box

Does anyone know any tutorials to skyspheres or skyboxes - step by step tutorials?

The distortion in sphere mapping is inherent and cannot be “fixed”, the data itself is corrupt at this point.

From http://en.wikipedia.org/wiki/Reflection_mapping#Sphere_mapping

The spherical mapping suffers from limitations that detract from the realism of resulting renderings. Because spherical maps are stored as azimuthal projections of the environments they represent, an abrupt point of singularity (a “black hole” effect) is visible in the reflection on the object where texel colors at or near the edge of the map are distorted due to inadequate resolution to represent the points accurately. The spherical mapping also wastes pixels that are in the square but not in the sphere.

The artifacts of the spherical mapping are so severe that it is effective only for viewpoints near that of the virtual orthographic camera.

You need to get the original as a cubemap, there's no other way.