|
![](/i/fill.gif) |
"Mark Weyer" <nomail@nomail> wrote:
> > #declare R=1;//Radius of projected sphere
> > #declare d=2;//distance from center of sphere
> > camera {
> > user_defined
> > location{
> > function{(u-1/2)*2*(R+d)}
> > function{d}
> > function{(v-1/2)*2*(R+d)}
> > }
> > direction{
> > function{-(u-1/2)*2}
> > function{-1}
> > function{-(v-1/2)*2}
> > }
> > }
>
> I don't think this will do. Basically, this doubles the tangent of the angle,
> not the angle itself.
>
> But if that is the syntax for user-defined cameras, the following should work:
>
> #declare Width = ... // corresponds to length of right in other camera types
> #declare Height = ... // corresponds to length of up in other camera types
> camera {
> user_defined
> location {function {0} function {0} function {0}}
> direction {
> function {tan (atan((u-1/2)*Width) * 2)}
> function {1}
> function {tan (atan((v-1/2)*Height) * 2)}
> }
> }
>
> Mark Weyer
What I have should work (and seems to, I tested it with a checkered mapped
hemisphere. Rather than looking from the pole to the sphere, I have placed the
viewing plane at the user-defined distance d from the center. To view the
entire hemisphere, the size of the viewplane is a 2*(R+d) square. The camera
looks back from this viewplane to the opposite pole of the sphere. The camera
viewplane is defined in u,v cordinates from 0-1, these are converted to a
centered coordinate system by subtracting -1/2 so they run from -1/2 to 1/2
with the length still being 1. Hence, each viewpoint is defined by the
modified u,v coordinate multplied by the size of the viewplane (for X & Z): x=
(u-1/2) * 2*(R+d), z= (v-1/2) * 2*(R+d). The y coordinate will always be the
distance from the center: y=d. Given these as the location coordinates, the
look at coordinate is the south pole or <0,-R,0>, the direction is the look at
minus the location: x=-(u-1/2)*2*(R+d), y=-R-d=-(R+d), z=-(v-1/2)*2*(R+d).
This vector can be further simplified by dividing out the common (R+d):
x=-(u-1/2)*2, y=-1, z=-(v-1/2)*2.
If needed I can provide a sketch showing exactly this.
One advantage here, is that the camera can be positioned some distance from the
look_at point to ensure that it is not inside an object.
-tgq
Post a reply to this message
|
![](/i/fill.gif) |