Skybox does not work poperly

Started by jackjia, October 11, 2011, 01:35:52 PM

Previous topic - Next topic

jackjia

Thanks a lot for providing JPCT such a great game engine. It makes my dream easier to touch. :)
I am using JPCT's skybox but it doesn't work properly for me and I couldn't figure out what I have done wrong. Please see the following video:
http://www.youtube.com/watch?v=LemMurebTuw

I set the textures as required and have the following related code:
skyBox = new SkyBox(10000);
....
skyBox.render(world, fb);

Here is the camera:
   private void moveCamera() {
      SimpleVector oldCamPos = camera.getPosition();
      oldCamPos.scalarMul(9f);
      SimpleVector carCenter = car.getTransformedCenter();
      SimpleVector zOffset = car.getZAxis();
      zOffset.scalarMul(-250f);
      SimpleVector camPos = new SimpleVector(carCenter);
      camPos.add(camYOffset);
      camPos.add(zOffset);
      camPos.add(oldCamPos);
      camPos.scalarMul(0.1f);
      camera.setPosition(camPos);
      camera.lookAt(carCenter);
   }

Any ideas about what is wrong? Is it because the camera is not in the right place? Your help is highly appreciated.

Regards,
Jack

EgonOlsen

Don't use the emulator...it has all kinds of bugs and problems in it's software renderer. Try it on a real device instead.

jackjia

I just got an android and tested on it. The skybox crashed for some reason while the other stuff worked fine. Yes you are right the device rendering is different from the emulator, so I need to recheck all the textures and rendering etc.
In general I feel hard to handle the background. I've tried the followings but all of them have some problems:
1. A terrain with/without a sky dome. Because of the device limitation, an efficient enough terrain is usually too small for a jet and even the sky dome is easily flied through by the jet. I tried your advanced sample application but found the land is very small. I also came up with a "skyball" idea but there is always some dark area.
2. Blit an image. Feels like a blit image too so it is not good.
3. Skybox - so far crashing as mentioned above. Will try a couple more.
4. No land, no sky, just some floating objects. Maybe go with this.
I am still not sure which way to go. I've seen some games using cloud and wind as background, but I am not sure how to do 3d cloud in JPCT. If you have any suggestions on this please let me know. Really appreciate.

EgonOlsen

"The skybox crashed" is very vague. There's no reason why it should crash unless you are using large textures for it. For example 6*1024*1024*4bytes=25mb of VM memory alone=OutOfMemory. If this causes your problem, please read here: http://www.jpct.net/wiki/index.php/Reducing_memory_usage#Reduce_texture_memory_usage

EgonOlsen

Also consider to move the skybox with the scene, if the scene is very large.