Main Menu

Sky

Started by Melssj5, April 11, 2006, 05:02:27 AM

Previous topic - Next topic

Melssj5

How to add a sky instead of that black enviroment that jpct has by default?
Nada por ahora

Mr.Marbles

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).

pitt

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);
    }

Remo

You can also use a more simple method like raft did here :
http://www.jpct.net/forum/viewtopic.php?p=1854#1854

Melssj5

Well, i set my map inside an empty sphere, and I gave the sphere a texture of a sky
Nada por ahora