Author Topic: Sky  (Read 4542 times)

Offline Melssj5

  • double
  • *****
  • Posts: 724
    • View Profile
Sky
« on: April 11, 2006, 05:02:27 am »
How to add a sky instead of that black enviroment that jpct has by default?
Nada por ahora

Offline Mr.Marbles

  • int
  • **
  • Posts: 81
    • View Profile
Sky
« Reply #1 on: April 11, 2006, 03:00:54 pm »
I've used the technique described in the following post and it works well. If you just want to use a solid color for the background then you can replace the buffer.clear() with buffer.clear(Color).

Offline pitt

  • byte
  • *
  • Posts: 13
    • View Profile
Sky
« Reply #2 on: April 17, 2006, 02:00:42 pm »
use the technic called 'skybox'.

Some free sky textures.
http://www.octanedigitalstudios.com/page4.html
http://www.scentednectar.com/skyboxes/

Source code

     float size=4000;
     String[] name={"top","front","left","right","back"};
     for (int i=0;i<name.length;i++)
     {
     InputStream in=new FileInputStream(name+".jpg");
     BufferedImage b=null;
     try
     {
      b=ImageIO.read(in);     
     } catch (Exception e) {}
     Texture pic=new Texture(b,false);
     pic.enableGLClamping();
     TextureManager.getInstance().addTexture(name,pic);
     }
     Object3D[] o=new Object3D[name.length];
     //top
     Object3D obj=Primitives.getPlane(1,size*2);
     obj.rotateZ((float)Math.PI/2);
     obj.rotateX((float)Math.PI/2);
     obj.translate(0,size,0);
     o[0]=obj;
      //front
     obj=Primitives.getPlane(1,size*2);
     obj.translate(0,0,size);
     obj.rotateZ((float)Math.PI);
     o[1]=obj;
     //left
     obj=Primitives.getPlane(1,size*2);
     obj.translate(size,0,0);
     obj.rotateZ((float)Math.PI);
     obj.rotateY((float)Math.PI/2);
     o[2]=obj;
     //right
     obj=Primitives.getPlane(1,size*2);
     obj.translate(-size,0,0);
     obj.rotateZ((float)Math.PI);
     obj.rotateY((float)-Math.PI/2);
     o[3]=obj;    
     //back
     obj=Primitives.getPlane(1,size*2);
     obj.translate(0,0,-size);
     obj.rotateZ((float)Math.PI);
     obj.rotateY((float)Math.PI);
     o[4]=obj;    
     
     for (int i=0;i<name.length;i++)
     {
       o.setTexture(name);
       o.setLighting(Object3D.LIGHTING_NO_LIGHTS);
       o.build();
       world.addObject(o);
     }

Offline Remo

  • int
  • **
  • Posts: 64
    • View Profile
    • http://www.opsdirector.com/3dart
Sky
« Reply #3 on: April 18, 2006, 09:13:39 am »
You can also use a more simple method like raft did here :
http://www.jpct.net/forum/viewtopic.php?p=1854#1854

Offline Melssj5

  • double
  • *****
  • Posts: 724
    • View Profile
Sky
« Reply #4 on: April 18, 2006, 06:52:49 pm »
Well, i set my map inside an empty sphere, and I gave the sphere a texture of a sky
Nada por ahora