POV-Ray : Newsgroups : povray.general : orthographic projection of game tiles.... : Re: orthographic projection of game tiles.... Server Time
12 Aug 2024 09:26:01 EDT (-0400)
  Re: orthographic projection of game tiles....  
From: Stephen Guentert
Date: 2 Mar 1999 00:27:03
Message: <36db76a7.0@news.povray.org>
John M. Dlugosz wrote in message <36db6771.0@news.povray.org>...
>
>Stephen Guentert wrote in message <36db57d4.0@news.povray.org>...
>>I messed with the up and right vectors and got it to work perfectly.
>>I didn't use all those #declares and #locals though.
>
>Why not?  makes it easier to change, and you don't have magic numbers in
the
>final code but see the reasons for them.
>

I plan to eventually use variables.  this was just to get me up and running.

>> notice also that my right vector is the square root of
>>2 (scaled by 10).  my up vector is 1.63 (scaled again).
>>this gives me exactly what I want - but I'd like to understand the
>>mathematical significance of these numbers.
>
>Well root-two is the diagonal of a square, and 1.618123 (close to what you
>have) is the inverse of the "golden ratio", a way to divide a line so that
>the ratio the small piece to the large is the same as the ratio of the
large
>to the whole.
>

aha! that's what I was looking for.........

>>camera {  //  Camera StdCam
>>orthographic
>>  location  <10 , 10, 10 >
>>  right     <0  , 1.4142135623730950488016887242097 * 10 , 0.0 >
>>  up        <1.63 * 10, 0.0 , 0.0 >
>>  direction <0  , 0 , 1 >
>>  look_at   <0.000, 0.000, 0.000>
>>  scale 10.0
>>}
>>
>
>
>In a ortho camera, the "right" is the number of POV units wide the scene
>will render, and the "up" is the number of POV units tall.  So you're
saying
>you want 14.1 x 16.3 POV units to form your image, outputting in 512x512
>pixels.  Strange that your pixels are not square...
>
>You are located at 10,10,10, but looking down over your left sholder.  The
>angle of this view to the ground probably is the cause of these numbers.
>
>Normally, in an ortho projection, the "look at" should be directly down the
>line of sight, so it has two numbers the same as the location, and the one
>that's different is the one that's not used in the up and right.

512 x 512 was a "test" size.  the tiles will be 64x64 in the end.
I just had to maintain powers of 2 in both directions of the image,
and the corners of the diamonds had to fall in a perfectly tilable fashion.

declare a checkered texture (where I failed to include mine) and you will
see the
perfect math that comes out of it.

 I know this doesn't look like everyday POV, but
I've already plugged a couple tiles into the engine and it's working like a
dream.

thank you much for the mathematical clarification! It had me stumped.


Post a reply to this message

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