POV-Ray : Newsgroups : povray.general : Skybox problem Server Time
2 Nov 2024 13:17:28 EDT (-0400)
  Skybox problem (Message 1 to 7 of 7)  
From: JS
Subject: Skybox problem
Date: 2 May 2009 20:10:00
Message: <web.49fce08dada293029cb8530@news.povray.org>
I have been using Pov-ray to generate textures for my Direct3D game and thought
it would be perfect for creating the 6 textures to be mapped to the skybox in
my game. Using a sky_sphere, I have the camera with a FOV of 90 degrees and
rotated the camera as needed and can line up all by the top and bottom textures
to the front texture.

This is how each texture generated by Pov-Ray with the camera rotated are lined
up:

      top
        |
left-front-right-back
        |
     bottom

The left texture lines up perfectly with the front, the front with the right and
the right with the back. But the top and bottom do not line up with the front
texture of the sky sphere.

These are the camera rotation angles I have used:

front=(0,180,0)
left=(0,-90,0)
back=(0,0,0)
right=(0,90,0)
up=(-90,90,0)
down=(90,90,0)

The camera setup I have is this:

camera {
    location <0,0,0>
    direction 0.5*z right x up 0.75*y
    look_at <0,0,1>
    rotate <0,0,0>}

Which is meant to give a FOV of 90 degrees.

Please help.


Post a reply to this message

From: StephenS
Subject: Re: Skybox problem
Date: 2 May 2009 21:15:00
Message: <web.49fcef6227a5a292cdcbe4680@news.povray.org>
"JS" <bos### [at] yahoocouk> wrote:
....
> camera {
>     location <0,0,0>
>     direction 0.5*z right x up 0.75*y
>     look_at <0,0,1>
>     rotate <0,0,0>}
>
> Which is meant to give a FOV of 90 degrees.
>
> Please help.

I think you are having problems with the default setting for the sky vector
sky <0,1,0>
Transforming parallel to this vector can be a problem. You may need to declare
your camera for each view, taking this into acount.

Stephen S


Post a reply to this message

From: JS
Subject: Re: Skybox problem
Date: 2 May 2009 23:05:00
Message: <web.49fd08d327a5a29229cb8530@news.povray.org>
Thanks but could you go into more detail?


Post a reply to this message

From: "Jérôme M. Berger"
Subject: Re: Skybox problem
Date: 3 May 2009 02:28:33
Message: <49fd3991$1@news.povray.org>
JS wrote:
> I have been using Pov-ray to generate textures for my Direct3D game and thought
> it would be perfect for creating the 6 textures to be mapped to the skybox in
> my game. Using a sky_sphere, I have the camera with a FOV of 90 degrees and
> rotated the camera as needed and can line up all by the top and bottom textures
> to the front texture.
> 
> This is how each texture generated by Pov-Ray with the camera rotated are lined
> up:
> 
>       top
>         |
> left-front-right-back
>         |
>      bottom
> 
> The left texture lines up perfectly with the front, the front with the right and
> the right with the back. But the top and bottom do not line up with the front
> texture of the sky sphere.
> 
> These are the camera rotation angles I have used:
> 
> front=(0,180,0)
> left=(0,-90,0)
> back=(0,0,0)
> right=(0,90,0)
> up=(-90,90,0)
> down=(90,90,0)
> 
> The camera setup I have is this:
> 
> camera {
>     location <0,0,0>
>     direction 0.5*z right x up 0.75*y
>     look_at <0,0,1>
>     rotate <0,0,0>}
> 
> Which is meant to give a FOV of 90 degrees.
> 
	You have an horizontal FOV of 90 degrees, but a smaller vertical 
FOV. You should use "up y" instead of "up 0.75*y".

		Jerome
-- 
mailto:jeb### [at] freefr
http://jeberger.free.fr
Jabber: jeb### [at] jabberfr


Post a reply to this message

From: John VanSickle
Subject: Re: Skybox problem
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

From: JS
Subject: Re: Skybox problem
Date: 3 May 2009 10:20:00
Message: <web.49fda7af27a5a29229cb8530@news.povray.org>
Thanks but the bottom shows when you look down:

http://img238.imageshack.us/my.php?image=mydreamskyboxproblem.png

(Those couple of grey lines are rain.)

This is strange as the bottom does line up with the forward image. Also, my
fault, z should be positive for forward, not negative.


Post a reply to this message

From: JS
Subject: Re: Skybox problem
Date: 3 May 2009 12:40:00
Message: <web.49fdc84b27a5a29229cb8530@news.povray.org>
I hope I got this right, so that forward is Z positive:

#declare camForward=
camera {
   right x
   up y
   direction z*.5
   location 0
}
#declare camBehind=
camera {
   right -x
   up y
   direction -z*.5
   location 0
}
#declare camBottom=
camera {
   right x
   up z
   direction -y*.5
   location 0
}
#declare camTop=
camera {
   right x
   up -z
   direction y*.5
   location 0
}
#declare camLeft=
camera {
   right z
   up y
   direction -x*.5
   location 0
}
#declare camRight=
camera {
   right -z
   up y
   direction x*.5
   location 0
}

And I found that the bottom texture has to be rotated 270 degrees, I'm not sure
why, maybe something to do with the polygons in the skybox.


Post a reply to this message

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