POV-Ray : Newsgroups : povray.general : Skybox problem : Re: Skybox problem Server Time
30 Jul 2024 08:18:57 EDT (-0400)
  Re: Skybox problem  
From: John VanSickle
Date: 3 May 2009 04:53:34
Message: <49fd5b8e$1@news.povray.org>
JS wrote:
> Thanks but could you go into more detail?

For the camera declaration for each texture, you need to set the sky 
vector so that it points in the direction that is "up" for each given 
texture.

This is not a problem for the left, right, front, and back textures, 
because up is the same direction, and the default value works.

Another thing:  Unless your skybox is shorter in the y-dimension than in 
the x and z dimensions (that is, not a cube, but a flattish 
paralleliped), you need to use square textures, and set the up and right 
vectors in the cameras to the same lengths.

On the other hand, if you already know the directions that everything 
should face (right goes this way, up goes this way, direction goes this 
way), then using look_at and rotate will only make opportunity for 
confusing code.  It's better to spell out the camera vectors explicitly.

It appears that in your game, y is up and forward is in the negative z 
direction, so your six camera declarations should look like this:

// forward
camera {
   right -x
   up y
   direction -z*.5
   location 0
}

// behind
camera {
   right x
   up y
   direction z*.5
   location 0
}

// left
camera {
   right -z
   up y
   direction x*.5
   location 0
}

// right
camera {
   right z
   up y
   direction -x*.5
   location 0

// top
camera {
   right -x
   up z
   direction y*.5
   location 0
}

// bottom
camera {
   right -x
   up -z
   direction -y*.5
   location 0
}

Render these to square images, and it should work.

Hope this helps,
John


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.