POV-Ray : Newsgroups : povray.general : Oblique projection Server Time
3 Dec 2026 10:09:40 EST (-0500)
  Oblique projection (Message 1 to 43 of 43)  
From: SharkD
Subject: Oblique projection
Date: 2 Jan 2008 01:15:00
Message: <web.477b2ad4a3477974ea6fcf450@news.povray.org>
How do I achieve oblique projection using POV-Ray? I've tried messing around
with the up and right vectors, but have achieved mixed results. Compare the
following two blocks of code:

camera
{
 location -z*(CameraDistance)
 look_at 0
 direction z*(CameraDistance)
 up y*5/2
 right x*5/2
 rotate <asind(tand(30)),45,0>
}

camera
{
 location -z*(CameraDistance)
 look_at 0
 direction z*(CameraDistance)
 up vnormalize(y-z)*5/2
 right x*5/2
 rotate <asind(tand(30)),45,0>
}

The latter results in no difference. Am I on the right track by messing with the
up and right vectors?

-Mike


Post a reply to this message

From: Tim Attwood
Subject: Re: Oblique projection
Date: 2 Jan 2008 05:22:40
Message: <477b65f0$1@news.povray.org>
> How do I achieve oblique projection using POV-Ray? I've tried messing 
> around
> with the up and right vectors, but have achieved mixed results.

POV 3.6 doesn't support an oblique camera, as close as you will come
is the orthographic camera. However, you can deform your scene
by skewing it with Shear_Trans from transforms.inc, this should
get the same look if used in conjunction with an orthographic camera.

MegaPOV has a user defined camera, you might be able to
define an oblique camera there, but I haven't tested it.

#version 3.6;

#include "colors.inc"
#include "transforms.inc"

camera {
   orthographic
   location  <0.0, 0.3, -2.0>
   direction z
   right     x*image_width/image_height
   up y
   look_at   <0.0, 0.1,  0.0>
}

background {White}

light_source {
  <-10, 30, -30>
  color rgb <1, 1, 1>
}

light_source {
  <20, 30, -30>
  color rgb <0.2, 0.2, 0.4>
  shadowless
}

#declare blgs = union {
 box {<0,0,0>,<0.2,0.2,0.2>}
 box {<0,0,0.3>,<0.2,0.3,0.5>}
 box {<0,0,0.6>,<0.2,0.2,0.8>}
 pigment {White}
};

#declare scene = union {
 plane {y,-0.001
    pigment{hexagon Yellow*0.5 LimeGreen ForestGreen scale 0.05}
 }
 object {blgs translate <-0.5,0,0>}
 object {blgs translate <-0.2,0,0>}
 object {blgs translate <0.1,0,0>}
}

object {
   scene
   Shear_Trans(<1,0,0>,<0,1,0>,vnormalize(<0.1,0.1,1>))
}


Post a reply to this message

From: Chris B
Subject: Re: Oblique projection
Date: 2 Jan 2008 05:34:10
Message: <477b68a2$1@news.povray.org>
"SharkD" <nomail@nomail> wrote in message 
news:web.477b2ad4a3477974ea6fcf450@news.povray.org...
> How do I achieve oblique projection using POV-Ray? I've tried messing 
> around
> with the up and right vectors, but have achieved mixed results. Compare 
> the
> following two blocks of code:
>
> camera
> {
> location -z*(CameraDistance)
> look_at 0
> direction z*(CameraDistance)
> up y*5/2
> right x*5/2
> rotate <asind(tand(30)),45,0>
> }
>
> camera
> {
> location -z*(CameraDistance)
> look_at 0
> direction z*(CameraDistance)
> up vnormalize(y-z)*5/2
> right x*5/2
> rotate <asind(tand(30)),45,0>
> }
>
> The latter results in no difference. Am I on the right track by messing 
> with the
> up and right vectors?
>
> -Mike
>

Hi Mike,

No, I don't think you're quite on the right track. Glancing at Wikipedia, it 
seems to me as though oblique projection is just orthographic projection but 
with the screen not being at right angles to the line between the camera and 
the look_at point.

If that's what you're after, then I would have thought you'd want to start 
off by using the POV-Ray orthographic camera (see Orthographic Projection in 
the help file) rather than the default perspective camera and then adjusting 
the sizes of the up and right vectors.

Regards,
Chris B.


Post a reply to this message

From: Slime
Subject: Re: Oblique projection
Date: 2 Jan 2008 06:16:04
Message: <477b7274@news.povray.org>
I'm not sure whether this is the problem, but if I were you I'd remove the
"look_at" from your cameras. Look_at is applied after direction, up, right,
and location even if it's specified before them. It might be affecting the
up and right vectors in some way.

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

From: Slime
Subject: Re: Oblique projection
Date: 2 Jan 2008 06:20:32
Message: <477b7380@news.povray.org>
Also, if I understand the oblique projection, I think you may be going for
something more like this:

camera
{
    direction < .5, .5, 1 >
    right x*1.3333
    up y
}

This uses the regular right and up vectors but a diagonal direction vector
so that more distant objects are displayed with a horizonal and vertical
offset.

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

From: SharkD
Subject: Re: Oblique projection
Date: 2 Jan 2008 14:45:00
Message: <web.477be8d5443d65d78fa1930b0@news.povray.org>
Sorry I wasn't clear, but I am using immensely distant camera positions, so the
view is essentially the same as when using the orthographic keyword. According
to Wikipedia, all I should need to do is change the up or right vector, but
this isn't working. I'll try some of your solutions.

"SharkD" <nomail@nomail> wrote:
> How do I achieve oblique projection using POV-Ray? I've tried messing around
> with the up and right vectors, but have achieved mixed results. Compare the
> following two blocks of code:
>
> camera
> {
>  location -z*(CameraDistance)
>  look_at 0
>  direction z*(CameraDistance)
>  up y*5/2
>  right x*5/2
>  rotate <asind(tand(30)),45,0>
> }
>
> camera
> {
>  location -z*(CameraDistance)
>  look_at 0
>  direction z*(CameraDistance)
>  up vnormalize(y-z)*5/2
>  right x*5/2
>  rotate <asind(tand(30)),45,0>
> }
>
> The latter results in no difference. Am I on the right track by messing with the
> up and right vectors?
>
> -Mike


Post a reply to this message

From: SharkD
Subject: Re: Oblique projection
Date: 2 Jan 2008 14:45:01
Message: <web.477be9b9443d65d78fa1930b0@news.povray.org>
Removing "look_at" causes the scene to not render at all (without errors, too).

"Slime" <fak### [at] emailaddress> wrote:
> I'm not sure whether this is the problem, but if I were you I'd remove the
> "look_at" from your cameras. Look_at is applied after direction, up, right,
> and location even if it's specified before them. It might be affecting the
> up and right vectors in some way.
>
>  - Slime
>  [ http://www.slimeland.com/ ]


Post a reply to this message

From: SharkD
Subject: Re: Oblique projection
Date: 2 Jan 2008 14:50:01
Message: <web.477bea70443d65d78fa1930b0@news.povray.org>
Oblique projection should be achieved by simply skewing the projection plane. It
shouldn't matter if you modify "direction", or "right" and "up". I prefer not
messing with the direction, as that makes more sense in my mind.

"Slime" <fak### [at] emailaddress> wrote:
> Also, if I understand the oblique projection, I think you may be going for
> something more like this:
>
> camera
> {
>     direction < .5, .5, 1 >
>     right x*1.3333
>     up y
> }
>
> This uses the regular right and up vectors but a diagonal direction vector
> so that more distant objects are displayed with a horizonal and vertical
> offset.
>
>  - Slime
>  [ http://www.slimeland.com/ ]


Post a reply to this message

From: Trevor G Quayle
Subject: Re: Oblique projection
Date: 2 Jan 2008 15:20:00
Message: <web.477bf0d5443d65d7c150d4c10@news.povray.org>
"SharkD" <nomail@nomail> wrote:
> Oblique projection should be achieved by simply skewing the projection plane. It
> shouldn't matter if you modify "direction", or "right" and "up". I prefer not
> messing with the direction, as that makes more sense in my mind.
>
> "Slime" <fak### [at] emailaddress> wrote:
> > Also, if I understand the oblique projection, I think you may be going for
> > something more like this:
> >
> > camera
> > {
> >     direction < .5, .5, 1 >
> >     right x*1.3333
> >     up y
> > }
> >
> > This uses the regular right and up vectors but a diagonal direction vector
> > so that more distant objects are displayed with a horizonal and vertical
> > offset.
> >
> >  - Slime
> >  [ http://www.slimeland.com/ ]

I think true oblique projection is impossible from camera settings alone as it
has no direct correlation to any single camera viewing projection.  The front
views are show face on as in orthographic projection, but the sides are give a
forced 3d look by skewing them.  To achieve this with a camera, it would need
to have two viewing vectors, one for viewing the face-on surfacesand another
for the sides.
You can try to fake it with orthographic viewing (or a really far perspective
view) and try to get the up and right vectors oriented to kep the desired
'front' face prependicular, but this will still be just an orthographic
projection and not true oblique.

The only real way to do it would be to use a matrix transform to skew your
objects instead as has already been suggested.

-tgq


Post a reply to this message

From: SharkD
Subject: Re: Oblique projection
Date: 2 Jan 2008 16:40:00
Message: <web.477c042f443d65d78fa1930b0@news.povray.org>
"Trevor G Quayle" <Tin### [at] hotmailcom> wrote:
> The only real way to do it would be to use a matrix transform to skew your
> objects instead as has already been suggested.
>
> -tgq

Either way, the code I provided should result in an image that appears taller
than it is wide (similar to adjusting the height of the output image without
changing the up and right vectors). This is not happening, and I can't figure
out why.


Post a reply to this message

From: SharkD
Subject: Re: Oblique projection
Date: 2 Jan 2008 17:05:00
Message: <web.477c0961443d65d78fa1930b0@news.povray.org>
I was looking in the wrong place for the error (I think). On a second attempt I
received an error that non-perpendicular camera vectors cannot be used while
the vista buffer is turned on (I noticed this later in the docs, too). I
commented out the "look_at" statement and turned off the vista buffer, and now
everything works. Thanks! Now all that is left to do is to experiment with the
values until I achieve the projection used in Ultima Online: Kingdom Reborn
(link: http://en.wikipedia.org/wiki/Ultima_Online:_Kingdom_Reborn).

"SharkD" <nomail@nomail> wrote:
> Removing "look_at" causes the scene to not render at all (without errors, too).
>
> "Slime" <fak### [at] emailaddress> wrote:
> > I'm not sure whether this is the problem, but if I were you I'd remove the
> > "look_at" from your cameras. Look_at is applied after direction, up, right,
> > and location even if it's specified before them. It might be affecting the
> > up and right vectors in some way.
> >
> >  - Slime
> >  [ http://www.slimeland.com/ ]


Post a reply to this message

From: Trevor G Quayle
Subject: Re: Oblique projection
Date: 2 Jan 2008 17:10:00
Message: <web.477c0aa0443d65d7c150d4c10@news.povray.org>
"SharkD" <nomail@nomail> wrote:
> "Trevor G Quayle" <Tin### [at] hotmailcom> wrote:
> > The only real way to do it would be to use a matrix transform to skew your
> > objects instead as has already been suggested.
> >
> > -tgq
>
> Either way, the code I provided should result in an image that appears taller
> than it is wide (similar to adjusting the height of the output image without
> changing the up and right vectors). This is not happening, and I can't figure
> out why.

If you feel like getting megaPOV, you can try this code I threw together which
simply takes an normal orthographic projection and distorts it to simulate an
oblique one (uses the 'camera' pigment)

//START
#version unofficial megapov 1.21;  //set for POV version being used

light_source { <20,  20, -30> rgb 1}
light_source { <20,  20,  30> rgb 1}
light_source { <-20, 20,  30> rgb 1}
light_source { <-20, 20, -30> rgb 1}

box{-2,2
  pigment{rgb <1,0,0>}
}

background{rgb 0}

#declare XX=-10;
#declare ZZ=10;
#declare YY=10;
#declare XZ=sqrt(XX*XX+ZZ*ZZ);
#declare XYZ=sqrt(XZ*XZ+YY*YY);
#declare VIEWSIZE=20;
#declare AR=image_width/image_height;
#declare FFUNC=
function{
  pigment{
    camera_view{
      orthographic
      up y*VIEWSIZE
      right x*VIEWSIZE*AR
      location <XX,YY,ZZ>
      look_at 0
    }
    translate -1/2
    scale 2
  }
}

#declare
FCol=function(x,y,z,comp){select(comp,FFUNC(x,y,z).red,FFUNC(x,y,z).green,FFUNC(x,y,z).blue)}
#declare
FOBL=function(x,y,z,comp){FCol(x*(ZZ/XZ),(y+x*(XX*YY)/(XZ*XZ)*AR)*(XZ/XYZ),0,comp)}

box{<-1/2,-1/2,0>,<1/2,1/2,0>
  texture{
    pigment{
      average
      pigment_map{
        [function{FOBL(x,y,z,-1)} color_map{[0 rgb 0][1 rgb <3,0,0>]}]
        [function{FOBL(x,y,z, 0)} color_map{[0 rgb 0][1 rgb <0,3,0>]}]
        [function{FOBL(x,y,z, 1)} color_map{[0 rgb 0][1 rgb <0,0,3>]}]
      }
    }
    finish{ambient 1 diffuse 0}
  }
  translate -y*5000
}

camera {
  orthographic
  location -10*z
  look_at 0
  up y
  right x
  translate -y*5000
}
//

-tgq


Post a reply to this message

From: Tim Attwood
Subject: Re: Oblique projection
Date: 2 Jan 2008 17:27:43
Message: <477c0fdf$1@news.povray.org>
> Sorry I wasn't clear, but I am using immensely distant camera positions, 
> so the
> view is essentially the same as when using the orthographic keyword. 
> According
> to Wikipedia, all I should need to do is change the up or right vector, 
> but
> this isn't working. I'll try some of your solutions.

The way I understand oblique projection the right (x) and up (y) axis are
perpendicular, but the direction (z) is slanted at an angle. Theoretically
you could define the correct right, up and direction in POV, but POV 3.6
specifically disallows this.  The camera vectors must all be perpendicular
to each other. The look_at command modifies the camera by rotating the
axis vectors, so for clarity it probably should be after any specified
camera axis vectors.


Post a reply to this message

From: Alain
Subject: Re: Oblique projection
Date: 2 Jan 2008 20:25:07
Message: <477c3973$1@news.povray.org>
Tim Attwood nous apporta ses lumieres en ce 2008/01/02 17:27:
>> Sorry I wasn't clear, but I am using immensely distant camera positions, 
>> so the
>> view is essentially the same as when using the orthographic keyword. 
>> According
>> to Wikipedia, all I should need to do is change the up or right vector, 
>> but
>> this isn't working. I'll try some of your solutions.
> 
> The way I understand oblique projection the right (x) and up (y) axis are
> perpendicular, but the direction (z) is slanted at an angle. Theoretically
> you could define the correct right, up and direction in POV, but POV 3.6
> specifically disallows this.  The camera vectors must all be perpendicular
> to each other. The look_at command modifies the camera by rotating the
> axis vectors, so for clarity it probably should be after any specified
> camera axis vectors. 
> 
> 
The camera vectors don't need to all be perpendicular. That only a requierment 
to be able to use the vista buffer.
The following camera is perfectly legal, and the 3 vectors are not, by far, 
perpendiculars:
camera {
   location <0, 1, -4>
   direction <0.5,0.33,1.5>
   right<1.33,0.4,0.53>
   up<0.19,1,0.2>
}

You only have to set -uv on the command line to disable the vista buffer.

-- 
Alain
-------------------------------------------------
   Last night my wife met me at the front door. She was wearing a Sexy negligee. 
The only trouble was, she was coming home.
	Rodney Dangerfield


Post a reply to this message

From: Tim Attwood
Subject: Re: Oblique projection
Date: 3 Jan 2008 02:56:02
Message: <477c9512@news.povray.org>
> You only have to set -uv on the command line to disable the vista buffer.

Ah, I didn't know that! Works great! Always something new to learn.

// use -uv
#version 3.6;
#include "colors.inc"

camera { //oblique camera
   orthographic
   location  <0.1, 0.6, -2.0>
   direction vrotate(z,<7,-5,0>)
   right     x*image_width/image_height
   up vrotate(y,<7,0,0>)
}

background {White}

light_source {
  <-10, 30, -30>
  color rgb <1, 1, 1>
}

light_source {
  <20, 30, -30>
  color rgb <0.2, 0.2, 0.4>
  shadowless
}

#declare blgs = union {
 box {<0,0,0>,<0.2,0.2,0.2>}
 box {<0,0,0.3>,<0.2,0.3,0.5>}
 box {<0,0,0.6>,<0.2,0.2,0.8>}
 pigment {White}
};

// scene
plane {y,-0.001
   pigment{hexagon Yellow*0.5 LimeGreen ForestGreen scale 0.05}
}
object {blgs translate <-0.5,0,0>}
object {blgs translate <-0.2,0,0>}
object {blgs translate <0.1,0,0>}


Post a reply to this message

From: SharkD
Subject: Re: Oblique projection
Date: 3 Jan 2008 09:20:01
Message: <web.477cede6443d65d7849476bf0@news.povray.org>
OK, I think I accomplished what I set out to do.

Compare the isometric image of a cube:
http://img134.imageshack.us/img134/6726/cubeisometricot0.png
with the oblique image of the same cube:
http://img141.imageshack.us/img141/639/cubeobliquedl4.png

Here is the scene for the isometric image:

camera
{
 orthographic
 location -z*(CameraDistance)
 direction z*(CameraDistance)
 up y*5/2
 right x*5/2
 rotate <asind(tand(30)),45,0>
}

light_source
{
 <0, 0, -100>            // light's position (translated below)
 color rgb <1, 1, 1>  // light's color
 rotate <60,30,0>
 parallel
 shadowless
}

box
{
 -0.5,0.5
 texture
 {
  pigment {rgb 1}
  finish {Phong_Glossy}
 }
}

Here is the scene for the oblique image:

camera
{
 orthographic
 location -z*(CameraDistance)
 direction z*(CameraDistance)
 up y*tand(30)*5/2 * (tand(45)/sind(45))/(tand(30)/sind(30))
 right x*5/2 * (tand(45)/sind(45))/(tand(30)/sind(30))
 rotate <asind(tand(30)),45,0>
}

light_source
{
 <0, 0, -100>            // light's position (translated below)
 color rgb <1, 1, 1>  // light's color
 rotate <60,30,0>
 parallel
 shadowless
}

box
{
 -0.5,0.5
 texture
 {
  pigment {rgb 1}
  finish {Phong_Glossy}
 }
 scale y *  tand(30) * (tand(45)/sind(45))/(tand(30)/sind(30))
}

The oblique image is scaled so that that the length of the axes is the same in
both images. Note that I had to also scale the height of the object in order to
achieve this. The projection used for the oblique image is called cavalier
perspective, I believe.


Post a reply to this message

From: Trevor G Quayle
Subject: Re: Oblique projection
Date: 3 Jan 2008 10:25:01
Message: <web.477cfdef443d65d7c150d4c10@news.povray.org>
"SharkD" <nomail@nomail> wrote:
> OK, I think I accomplished what I set out to do.
>
> Compare the isometric image of a cube:
> http://img134.imageshack.us/img134/6726/cubeisometricot0.png
> with the oblique image of the same cube:
> http://img141.imageshack.us/img141/639/cubeobliquedl4.png

This is a top side oblique, which seems fairly easy to achieve, you need to
basically adjust the aspect ratio of the camera to the correct proportions
which you have done.  I haven't been able to get this to work properly with
front or side projected oblique.  For the top-side as you've shown, the image
and camera merely need to be stretched, whereas with front/side, it also needs
to be sheared.

>
> The oblique image is scaled so that that the length of the axes is the same in
> both images. Note that I had to also scale the height of the object in order to

You shouldn't need to have to stretch the actual object using this method.  The
problem is you are only rotating up 30deg so when you stretch the aspect ratio
to make the top square, the projection length becomes too long which is why you
are having to shorten it.  In order to get the 1:1 legth without having to
stretch the object, you need to rotate up 45 degrees before stretching. Try
this:
//START
camera{
 orthographic
 location -z*(CameraDistance)
 direction z
 up y*5/2   *sind(45)  //stretch to square top for 45deg rotation
 right x*5/2           //no need to stretch in this direction
 rotate <45,0,0>       //rotate up 45 degrees
}

light_source{
 -100*z
 rgb 1
 rotate <60,30,0>
 parallel
 shadowless
}

box{
 -0.5,0.5
 rotate y*45
 pigment {rgb 1}
}
//END



> achieve this. The projection used for the oblique image is called cavalier
> perspective, I believe.

Yes, cavalier projection, where the projected length is shown the same as the
true length, as opposed to cabinet projection where it is shortend to half
scale.


-tgq


Post a reply to this message

From: SharkD
Subject: Re: Oblique projection
Date: 3 Jan 2008 14:35:01
Message: <web.477d37c9443d65d7849476bf0@news.povray.org>
"Trevor G Quayle" <Tin### [at] hotmailcom> wrote:
> This is a top side oblique, which seems fairly easy to achieve, you need to
> basically adjust the aspect ratio of the camera to the correct proportions
> which you have done.  I haven't been able to get this to work properly with
> front or side projected oblique.  For the top-side as you've shown, the image
> and camera merely need to be stretched, whereas with front/side, it also needs
> to be sheared.

Simply rotating the output image in an image editor should achieve the desired
results.

> You shouldn't need to have to stretch the actual object using this method.  The
> problem is you are only rotating up 30deg so when you stretch the aspect ratio
> to make the top square, the projection length becomes too long which is why you
> are having to shorten it.  In order to get the 1:1 legth without having to
> stretch the object, you need to rotate up 45 degrees before stretching. Try
> this:

Thanks! That's much simpler.


Post a reply to this message

From: SharkD
Subject: Re: Oblique projection
Date: 3 Jan 2008 16:20:00
Message: <web.477d5080443d65d7849476bf0@news.povray.org>
"Trevor G Quayle" <Tin### [at] hotmailcom> wrote:
> This is a top side oblique, which seems fairly easy to achieve, you need to
> basically adjust the aspect ratio of the camera to the correct proportions
> which you have done.  I haven't been able to get this to work properly with
> front or side projected oblique.  For the top-side as you've shown, the image
> and camera merely need to be stretched, whereas with front/side, it also needs
> to be sheared.

I experimented a bit and got pretty close. At least now it's clear that it's
possible. Unfortunately, the math is a bit too complex for me to figure out.

camera
{
 orthographic
 location -z*(CameraDistance)
 direction z*(CameraDistance)
 up vaxis_rotate(y*5/2,z,-14.2)
 right vaxis_rotate(x*5/2,z,14.2)
 rotate z*15
 rotate <asind(tand(30)),45,0> //rotate the camera so that it lies along the
vector starting at the origin and passing through the cube's corner
}


Post a reply to this message

From: SharkD
Subject: Re: Oblique projection
Date: 3 Jan 2008 17:05:01
Message: <web.477d5bd4443d65d7849476bf0@news.povray.org>
"SharkD" <nomail@nomail> wrote:
> "Trevor G Quayle" <Tin### [at] hotmailcom> wrote:
> > This is a top side oblique, which seems fairly easy to achieve, you need to
> > basically adjust the aspect ratio of the camera to the correct proportions
> > which you have done.  I haven't been able to get this to work properly with
> > front or side projected oblique.  For the top-side as you've shown, the image
> > and camera merely need to be stretched, whereas with front/side, it also needs
> > to be sheared.
>
> I experimented a bit and got pretty close. At least now it's clear that it's
> possible. Unfortunately, the math is a bit too complex for me to figure out.
>
> camera
> {
>  orthographic
>  location -z*(CameraDistance)
>  direction z*(CameraDistance)
>  up vaxis_rotate(y*5/2,z,-14.2)
>  right vaxis_rotate(x*5/2,z,14.2)
>  rotate z*15
>  rotate <asind(tand(30)),45,0> //rotate the camera so that it lies along the
> vector starting at the origin and passing through the cube's corner
> }

That should be:

camera
{
 orthographic
 location -z*(CameraDistance)
 direction z*(CameraDistance)
 up vaxis_rotate(y*5/2,z,-15)
 right vaxis_rotate(x*5/2,z,15)
 rotate z*15
 rotate <asind(tand(30)),45,0>
}

Except, now there's the depth problem again; e.g., the 1:1 ratio is not
preserved. Maybe you could fix this like you did the last time?


Post a reply to this message

From: Slime
Subject: Re: Oblique projection
Date: 3 Jan 2008 18:00:14
Message: <477d68fe$1@news.povray.org>
>  direction z*(CameraDistance)
>  up vaxis_rotate(y*5/2,z,-14.2)
>  right vaxis_rotate(x*5/2,z,14.2)

I don't think you can get get an oblique projection if the direction is
perpendicular to the up and right. Taking the cube for example, in order to
get that top face to have its perfect square shape, the camera needs to be
looking straight at that face, head on. In POV-Ray that means the up and
right vectors must be perpendicular to the green axis. Of course, this would
then completely hide the other two sides of the cube, which is where the
direction vector comes in. By skewing the direction vector so that rays
coming from the camera go to the side as they go away from the camera, they
will hit the side of the cube.

I would try something like this (untested code):

camera
{
orthographic
location y * 3 // or whatever
right x*1.3333
up z
direction <0,-1,1>
rotate y*45
}


 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

From: SharkD
Subject: Re: Oblique projection
Date: 3 Jan 2008 18:50:01
Message: <web.477d73f0443d65d7849476bf0@news.povray.org>
"Slime" <fak### [at] emailaddress> wrote:
> I don't think you can get get an oblique projection if the direction is
> perpendicular to the up and right. Taking the cube for example, in order to
> get that top face to have its perfect square shape, the camera needs to be
> looking straight at that face, head on. In POV-Ray that means the up and
> right vectors must be perpendicular to the green axis. Of course, this would
> then completely hide the other two sides of the cube, which is where the
> direction vector comes in. By skewing the direction vector so that rays
> coming from the camera go to the side as they go away from the camera, they
> will hit the side of the cube.

My code works. You'll see if you test it.


Post a reply to this message

From: SharkD
Subject: Re: Oblique projection
Date: 3 Jan 2008 19:45:00
Message: <web.477d8145443d65d7849476bf0@news.povray.org>
"SharkD" <nomail@nomail> wrote:
> "SharkD" <nomail@nomail> wrote:
> > I experimented a bit and got pretty close. At least now it's clear that it's
> > possible. Unfortunately, the math is a bit too complex for me to figure out.
>
> Except, now there's the depth problem again; e.g., the 1:1 ratio is not
> preserved. Maybe you could fix this like you did the last time?

I fixed the depth problem. Here's the working code:

camera
{
 orthographic
 location -z*(CameraDistance)
 direction z*(CameraDistance)
 up vaxis_rotate(y,z,-15/2)*5/2
 right vaxis_rotate(x,z,15/2)*5/2
 rotate z*15
 rotate x*asind(tand(30))
 rotate y*45
 Axis_Rotate_Trans(<1,1,0,>, -15)
}

light_source
{
 <0, 0, -100>            // light's position (translated below)
 color rgb <1, 1, 1>  // light's color
 rotate <60,30,0>
 parallel
 shadowless
}

box
{
 -0.5,0.5
 texture
 {
  pigment {rgb 1}
  finish {Phong_Glossy}
 }
}

The rotations aren't perfect due to roundoff errors. There's noticable jagginess
on edges that are supposed to be smooth. If someone could look through the code
and simplify things in order to reduce the number of floating point
calculations, I would *really* appreciate it.


Post a reply to this message

From: SharkD
Subject: Re: Oblique projection
Date: 3 Jan 2008 20:00:00
Message: <web.477d8402443d65d7849476bf0@news.povray.org>
Nevermind. It's still not right. The face of the cube is slightly too large.

"SharkD" <nomail@nomail> wrote:
> "SharkD" <nomail@nomail> wrote:
> > "SharkD" <nomail@nomail> wrote:
> > > I experimented a bit and got pretty close. At least now it's clear that it's
> > > possible. Unfortunately, the math is a bit too complex for me to figure out.
> >
> > Except, now there's the depth problem again; e.g., the 1:1 ratio is not
> > preserved. Maybe you could fix this like you did the last time?
>
> I fixed the depth problem. Here's the working code:
>
> The rotations aren't perfect due to roundoff errors. There's noticable jagginess
> on edges that are supposed to be smooth. If someone could look through the code
> and simplify things in order to reduce the number of floating point
> calculations, I would *really* appreciate it.


Post a reply to this message

From: Rune
Subject: Re: Oblique projection
Date: 3 Jan 2008 21:17:21
Message: <477d9731$1@news.povray.org>
"SharkD" wrote:
> OK, I think I accomplished what I set out to do.
>
> Compare the isometric image of a cube:
> http://img134.imageshack.us/img134/6726/cubeisometricot0.png
> with the oblique image of the same cube:
> http://img141.imageshack.us/img141/639/cubeobliquedl4.png

If you just want to create the effect of that second image, then the below 
code works perfectly and is far simpler than the math you were using:

#declare CameraDistance = 20;
#declare CameraArea = 5/2;
#declare CameraSkewed = 0.7;
#declare AspectRatio = image_width/image_height;

camera {
   orthographic
   location <-CameraSkewed,1,-CameraSkewed>*CameraDistance
   direction <CameraSkewed,-1,CameraSkewed>
   up (x+z)*CameraArea
   right (x-z)*CameraArea*AspectRatio
}

light_source {
   <0,0,-100> color rgb 1
   rotate <60,30,0>
   parallel
   shadowless
}

box {-0.5,0.5 pigment {rgb 1}}

#declare Arrow = union {cylinder {-x, x, 0.02} cone {x, 0.1, 1.2*x, 0}}
object {Arrow pigment {red 1}}
object {Arrow rotate 90*z pigment {green 1}}
object {Arrow rotate -90*y pigment {blue 1}}

plane {y, 0
   pigment {
      boxed translate x+z warp {repeat x*2} warp {repeat z*2}
      scale 0.05
      color_map {[0.1, rgb 0.3][0.1, transmit 1]}
   }
}


Rune
-- 
http://runevision.com


Post a reply to this message

From: SharkD
Subject: Re: Oblique projection
Date: 3 Jan 2008 23:55:00
Message: <web.477dba76443d65d7849476bf0@news.povray.org>
"SharkD" <nomail@nomail> wrote:
> Nevermind. It's still not right. The face of the cube is slightly too large.

I got it now:

camera
{
 #local diff = (45 - asind(tand(30))); // the difference between a 45 degree
angle and the vertical angle required to view from one corner of a cube to the
opposite corner
 #local angl = 30; // the angle required to rotate the hexagonal outline of the
isometric cube so that one of its bottom sides is parallel with the bottom of
the image
 #local dimm = 5/2; // the width and height of the output image (assuming a
square image)
 #local quadrantangle = (90 - diff * 2) / 2; // an angle used to determine the
length of the segment, below.
 #local leng = tand(quadrantangle) + 1/tand(quadrantangle); // the length of a
side of the parallelogram defined by the (unit length) up and right vectors
 #local AspectRatio = image_width/image_height;
 orthographic
 location -z*(CameraDistance)
 up vaxis_rotate(y,z,-(angl - diff)/2) * dimm * leng/2
 right vaxis_rotate(x,z,+(angl - diff)/2) * dimm * leng/2 * AspectRatio
 rotate z*angl/2
 rotate x*(45 - diff)
 rotate y*45
 Axis_Rotate_Trans(<1,1,0,>, -diff)
}

light_source
{
 <0, 0, -100>            // light's position (translated below)
 color rgb <1, 1, 1>  // light's color
 rotate <60,30,0>
 parallel
 shadowless
}

box
{
 -0.5,0.5
 texture
 {
  pigment {rgb 1}
  finish {Phong_Glossy}
 }
}

I added an AspectRatio, per Rune's suggestion, for those of you not rendering to
square images (I should have thought of you earlier). Anyway, the above code
works (as far as I can tell); I super-imposed it over a rotated version of the
"top side oblique" rendering I completed earlier, and everything lines up
perfectly. The code could probably be cleaned up, but I'm satisfied for now.


Post a reply to this message

From: SharkD
Subject: Re: Oblique projection
Date: 3 Jan 2008 23:55:00
Message: <web.477dbbdb443d65d7849476bf0@news.povray.org>
"Rune" <aut### [at] runevisioncom> wrote:
> If you just want to create the effect of that second image, then the below
> code works perfectly and is far simpler than the math you were using:

Thanks, but some of the code I added was in order to preserve the unit scale of
the orthographic image.


Post a reply to this message

From: SharkD
Subject: Re: Oblique projection
Date: 4 Jan 2008 01:05:00
Message: <web.477dcc79443d65d7849476bf0@news.povray.org>
Here it is again, except from a different angle:

camera
{
 #local diff = (45 - asind(tand(30))); // the difference between a 45 degree
angle and the vertical angle required to view from one corner of a cube to the
opposite corner
 #local angl = 30; // the angle required to rotate the hexagonal outline of the
isometric cube so that one of its bottom sides is parallel with the bottom of
the image
 #local dimm = 5/2; // the width and height of the output image (assuming a
square image)
 #local quadrantangle = (90 - diff * 2) / 2; // an angle used to determine the
length of the segment, below.
 #local leng = tand(quadrantangle) + 1/tand(quadrantangle); // the length of a
side of the parallelogram defined by the (unit length) up and right vectors
 #local AspectRatio = image_width/image_height;
 orthographic
 location -z*(CameraDistance)
 up vaxis_rotate(y,z,-(angl - diff)/2) * dimm * leng/2
 right vaxis_rotate(x,z,+(angl - diff)/2) * dimm * leng/2 * AspectRatio
 rotate z*-45
 rotate x*(45 - diff)
 rotate y*45
 Axis_Rotate_Trans(<1,0,-1,>, diff)
}

light_source
{
 <0, 0, -100>            // light's position (translated below)
 color rgb <1, 1, 1>  // light's color
 rotate <60,30,0>
 parallel
 shadowless
}

box
{
 -0.5,0.5
 texture
 {
  pigment {rgb 1}
  finish {Phong_Glossy}
 }
}

Here's the image, itself:
http://img139.imageshack.us/img139/7937/obliquetoprotatedgm6.png
You'll notice some jagginess due to roundoff errors. I hope there's some way of
fixing them.


Post a reply to this message

From: Rune
Subject: Re: Oblique projection
Date: 4 Jan 2008 05:27:41
Message: <477e0a1d$1@news.povray.org>
"SharkD" wrote:
> Anyway, the above code
> works (as far as I can tell); I super-imposed it over a rotated version of 
> the
> "top side oblique" rendering I completed earlier, and everything lines up
> perfectly.

Is it intentional that the side facing the camera is a slight rhombe and not 
a perfect square? You'll see it if you render with a for example 640x480 
resolution. If this is what you call the "jagginess due to roundoff errors" 
then in my experience, these errors are far too large to just be rounding 
errors.

The camera below will give an identical image, exact that you get a perfect 
square (no "jagginess"):

#declare CameraDistance = 40;
camera {
   #local CameraArea = 3.03;
   #local CameraSkewed = 0.7;
   #local AspectRatio = image_width/image_height;
   orthographic
   location <-CameraSkewed,CameraSkewed,-1>*CameraDistance
   direction <CameraSkewed,-CameraSkewed,1>
   up y*CameraArea
   right x*CameraArea*AspectRatio
}

Rune
-- 
http://runevision.com


Post a reply to this message

From: Trevor G Quayle
Subject: Re: Oblique projection
Date: 4 Jan 2008 08:40:01
Message: <web.477e3710443d65d7c150d4c10@news.povray.org>
OK, I finally got this figured out, it was actually very simple once I looked at
the geometry involved.  This gives oblique projections of the x-y plane (-z
viewpoint).  Changing the value of DPTH toggles between cavalier and cabinet
projection:

//START
#declare AR=image_width/image_height; //Image aspect ratio (square pixels)
#declare VW=5;                        //Viewing width
#declare CD=6;                        //Cameras distance

#declare DPTH=1/(2*sqrt(2)); //Cabinet projection:  Depth = 0.5:1
#declare DPTH=1/(sqrt(2));   //Cavalier projection: Depth = 1:1

camera{
  orthographic
  location -z*CD
  up y*VW
  right x*VW*AR
  direction <-DPTH,-DPTH,1>
  translate  <CD*DPTH,CD*DPTH,0>
}

light_source{<100,300,-200> rgb 1}

box{-1,1 pigment {rgb 1}}

union{cylinder{0,x*2,0.02} cone{x*2,0.1,x*2.25,0} pigment{rgb <1,0,0>}}
union{cylinder{0,y*2,0.02} cone{y*2,0.1,y*2.25,0} pigment{rgb <0,1,0>}}
union{cylinder{0,-z*2,0.02} cone{-z*2,0.1,-z*2.25,0} pigment{rgb <0,0,1>}}
//END

-tgq


Post a reply to this message

From: Trevor G Quayle
Subject: Re: Oblique projection
Date: 4 Jan 2008 08:45:01
Message: <web.477e37e3443d65d7c150d4c10@news.povray.org>
"Trevor G Quayle" <Tin### [at] hotmailcom> wrote:
> blah blah blah
> -tgq

And don't forget -uv on the command line.

-tgq


Post a reply to this message

From: SharkD
Subject: Re: Oblique projection
Date: 4 Jan 2008 13:10:00
Message: <web.477e761b443d65d79d0d33710@news.povray.org>
"Rune" <aut### [at] runevisioncom> wrote:
> "SharkD" wrote:
> > Anyway, the above code
> > works (as far as I can tell); I super-imposed it over a rotated version of
> > the
> > "top side oblique" rendering I completed earlier, and everything lines up
> > perfectly.
>
> Is it intentional that the side facing the camera is a slight rhombe and not
> a perfect square? You'll see it if you render with a for example 640x480
> resolution. If this is what you call the "jagginess due to roundoff errors"
> then in my experience, these errors are far too large to just be rounding
> errors.

Well, the face of the cube only diverges from a perfect square by one pixel i
each direction at 640x480 resolution. Yes, I would call that "jagginess".

> The camera below will give an identical image, exact that you get a perfect
> square (no "jagginess"):

That does work a lot better. Could you try a shot at this image?

http://img139.imageshack.us/img139/7937/obliquetoprotatedgm6.png

Also, you describe how you derived the float values?


Post a reply to this message

From: Trevor G Quayle
Subject: Re: Oblique projection
Date: 4 Jan 2008 14:10:00
Message: <web.477e83e3443d65d7c150d4c10@news.povray.org>
"SharkD" <nomail@nomail> wrote:
> "Rune" <aut### [at] runevisioncom> wrote:
> > "SharkD" wrote:
> > > Anyway, the above code
> > > works (as far as I can tell); I super-imposed it over a rotated version of
> > > the
> > > "top side oblique" rendering I completed earlier, and everything lines up
> > > perfectly.
> >
> > Is it intentional that the side facing the camera is a slight rhombe and not
> > a perfect square? You'll see it if you render with a for example 640x480
> > resolution. If this is what you call the "jagginess due to roundoff errors"
> > then in my experience, these errors are far too large to just be rounding
> > errors.
>
> Well, the face of the cube only diverges from a perfect square by one pixel i
> each direction at 640x480 resolution. Yes, I would call that "jagginess".
>
> > The camera below will give an identical image, exact that you get a perfect
> > square (no "jagginess"):
>
> That does work a lot better. Could you try a shot at this image?
>
> http://img139.imageshack.us/img139/7937/obliquetoprotatedgm6.png
>
> Also, you describe how you derived the float values?

0.7 ~ 0.707 ~ 1/sqrt(2)

use 1/sqrt(2) for the exact value and everything should be correct and similar
to the one I posted as well.

I put together a little diagram that I hope can explain the basic geometry
behind the numbers  (thi shows cavalier projection, for cabinet, the depth
becomes 1/2 and 1/sqrt(2) becomes 1/2sqrt(2))
http://i69.photobucket.com/albums/i52/barberofcivil/Oblique.jpg

-tgq


Post a reply to this message

From: Rune
Subject: Re: Oblique projection
Date: 4 Jan 2008 14:37:50
Message: <477e8b0e$1@news.povray.org>
"SharkD" wrote:
> Well, the face of the cube only diverges from a perfect square by one 
> pixel i
> each direction at 640x480 resolution. Yes, I would call that "jagginess".

That's only because the cube only fills a small part of the image. When you 
put in the grid like in your image below, it becomes clear that the lines 
are not horizontal and vertical at all, but diverges many pixels from the 
top of the image to the bottom. That's not just rounding errors; POV-Ray is 
far more precise than that.

> That does work a lot better. Could you try a shot at this image?
>
> http://img139.imageshack.us/img139/7937/obliquetoprotatedgm6.png

Sure:

#declare CameraDistance = 40;
camera {
   #local CameraArea = 3.03; // arbritary
   #local CameraSkewed = 1/sqrt(2);
   #local AspectRatio = image_width/image_height;
   orthographic
   location <-CameraSkewed,1,-CameraSkewed>*CameraDistance
   direction <CameraSkewed,-1,CameraSkewed>
   up x*CameraArea
   right -z*CameraArea*AspectRatio
}

background {color <0.5,0.7,1.0>}
global_settings {assumed_gamma 1}

light_source {
   <0,0,-100> color rgb 1
   rotate <60,30,0>
   parallel
   shadowless
}

box {-0.5,0.5 pigment {rgb 1}}

#declare Arrow = union {
   cylinder {-x, x, 0.01}
   cone {x, 0.05, 1.1*x, 0}
   scale <1.35,1,1>
}
object {Arrow pigment {red 1}}
object {Arrow rotate 90*z pigment {green 1}}
object {Arrow rotate -90*y pigment {blue 1}}

plane {y, 0
   pigment {
      boxed translate x+z warp {repeat x*2} warp {repeat z*2}
      scale 0.05
      color_map {[0.19, rgb 0.35][0.19, transmit 1]}
   }
}


> Also, you describe how you derived the float values?

I changed the 0.7 to 1/sqrt(2) like Trevor G Quayle wrote. The CameraArea of 
3.03 is arbritary to match your images.

Rune
-- 
http://runevision.com


Post a reply to this message

From: SharkD
Subject: Re: Oblique projection
Date: 4 Jan 2008 22:25:00
Message: <web.477ef7bc443d65d7e14fbc8d0@news.povray.org>
"Rune" <aut### [at] runevisioncom> wrote:
> "SharkD" wrote:
> > Well, the face of the cube only diverges from a perfect square by one
> > pixel i
> > each direction at 640x480 resolution. Yes, I would call that "jagginess".
>
> That's only because the cube only fills a small part of the image. When you
> put in the grid like in your image below, it becomes clear that the lines
> are not horizontal and vertical at all, but diverges many pixels from the
> top of the image to the bottom. That's not just rounding errors; POV-Ray is
> far more precise than that.
>
> > That does work a lot better. Could you try a shot at this image?
> >
> > http://img139.imageshack.us/img139/7937/obliquetoprotatedgm6.png
>
> Sure:
>
> #declare CameraDistance = 40;
> camera {
>    #local CameraArea = 3.03; // arbritary
>    #local CameraSkewed = 1/sqrt(2);
>    #local AspectRatio = image_width/image_height;
>    orthographic
>    location <-CameraSkewed,1,-CameraSkewed>*CameraDistance
>    direction <CameraSkewed,-1,CameraSkewed>
>    up x*CameraArea
>    right -z*CameraArea*AspectRatio
> }
>
> background {color <0.5,0.7,1.0>}
> global_settings {assumed_gamma 1}
>
> light_source {
>    <0,0,-100> color rgb 1
>    rotate <60,30,0>
>    parallel
>    shadowless
> }
>
> box {-0.5,0.5 pigment {rgb 1}}
>
> #declare Arrow = union {
>    cylinder {-x, x, 0.01}
>    cone {x, 0.05, 1.1*x, 0}
>    scale <1.35,1,1>
> }
> object {Arrow pigment {red 1}}
> object {Arrow rotate 90*z pigment {green 1}}
> object {Arrow rotate -90*y pigment {blue 1}}
>
> plane {y, 0
>    pigment {
>       boxed translate x+z warp {repeat x*2} warp {repeat z*2}
>       scale 0.05
>       color_map {[0.19, rgb 0.35][0.19, transmit 1]}
>    }
> }
>
>
> > Also, you describe how you derived the float values?
>
> I changed the 0.7 to 1/sqrt(2) like Trevor G Quayle wrote. The CameraArea of
> 3.03 is arbritary to match your images.
>
> Rune
> --
> http://runevision.com

Here's my version (a little more exact).

Side view:

camera
{
 #local CameraArea = 5/2;
 #local CameraDistance = 40;
 #local SkewAdjust = (tand(45)/sind(45))/(tand(30)/sind(30));
 #local CameraSkewed = 1/sqrt(2);
 #local CameraPosition =
vnormalize(<-CameraSkewed,CameraSkewed,-1>)*CameraDistance;
 #local AspectRatio = image_width/image_height;
 orthographic
 location CameraPosition
 direction -CameraPosition
 up y*CameraArea*SkewAdjust
 right x*CameraArea*SkewAdjust*AspectRatio
}

Top view:

camera
{
 #local CameraArea = 5/2;
 #local CameraDistance = 40;
 #local SkewAdjust = (tand(45)/sind(45))/(tand(30)/sind(30));
 #local CameraSkewed = 1/sqrt(2);
 #local CameraPosition =
vnormalize(<-CameraSkewed,1,-CameraSkewed>)*CameraDistance;
 #local AspectRatio = image_width/image_height;
 orthographic
 location CameraPosition
 direction -CameraPosition
 up vnormalize(x+z)*CameraArea*SkewAdjust
 right vnormalize(x-z)*CameraArea*SkewAdjust*AspectRatio
}


Post a reply to this message

From: SharkD
Subject: Re: Oblique projection
Date: 4 Jan 2008 22:55:00
Message: <web.477efe75443d65d7e14fbc8d0@news.povray.org>
"Trevor G Quayle" <Tin### [at] hotmailcom> wrote:
> I put together a little diagram that I hope can explain the basic geometry
> behind the numbers  (thi shows cavalier projection, for cabinet, the depth
> becomes 1/2 and 1/sqrt(2) becomes 1/2sqrt(2))
> http://i69.photobucket.com/albums/i52/barberofcivil/Oblique.jpg
>
> -tgq

Is there any way you could upload the image to the cavalier perspective article
on Wikipedia? Some suggestions before (that is, if) you do:
1) Split the image into two separate images.
2) Remove the label "Oblique Projection", as it's not necessary.
3) Rename "View plane" to "Projection plane".
4) Show the ray originating behind the projection plane.
5) Use the SVG format instead of JPG if at all possible.
6) Make another set of images for cabinet perspective.


Post a reply to this message

From: SharkD
Subject: Re: Oblique projection
Date: 4 Jan 2008 23:05:01
Message: <web.477f0161443d65d7e14fbc8d0@news.povray.org>
"SharkD" <nomail@nomail> wrote:
> "Trevor G Quayle" <Tin### [at] hotmailcom> wrote:
> > I put together a little diagram that I hope can explain the basic geometry
> > behind the numbers  (thi shows cavalier projection, for cabinet, the depth
> > becomes 1/2 and 1/sqrt(2) becomes 1/2sqrt(2))
> > http://i69.photobucket.com/albums/i52/barberofcivil/Oblique.jpg
> >
> > -tgq
>
> Is there any way you could upload the image to the cavalier perspective article
> on Wikipedia? Some suggestions before (that is, if) you do:
> 1) Split the image into two separate images.
> 2) Remove the label "Oblique Projection", as it's not necessary.
> 3) Rename "View plane" to "Projection plane".
> 4) Show the ray originating behind the projection plane.
> 5) Use the SVG format instead of JPG if at all possible.
> 6) Make another set of images for cabinet perspective.

One more thought: the diagram would need to be generalized for all skew angles,
not just 45 degrees. So, it might not be worth it.


Post a reply to this message

From: Rune
Subject: Re: Oblique projection
Date: 5 Jan 2008 06:41:09
Message: <477f6cd5$1@news.povray.org>
"SharkD" wrote:
> Here's my version (a little more exact).

Looks fine, but I'm curious how it is more exact exactly. I mean, sure, 
instead of a CameraArea of 3.03 you effectively use one of

5/2*(tand(45)/sind(45))/(tand(30)/sind(30)) which evaluates to 3.0618621785

But that's just the "zoom" of the image (or the orthographic equivalent of 
zoom) and has nothing to do with the skewing. Your variable name SkewAdjust 
seem confusing that way, since it sounds like it adjusts the skewing, while 
it just adjusts the size of the visible area. The projection itself is 
exactly the same as the one I posted and which several others suggested all 
along.

Rune
-- 
http://runevision.com


Post a reply to this message

From: SharkD
Subject: Re: Oblique projection
Date: 5 Jan 2008 09:55:00
Message: <web.477f996c443d65d7e14fbc8d0@news.povray.org>
"Rune" <aut### [at] runevisioncom> wrote:
> "SharkD" wrote:
> > Here's my version (a little more exact).
>
> Looks fine, but I'm curious how it is more exact exactly. I mean, sure,
> instead of a CameraArea of 3.03 you effectively use one of
>
> 5/2*(tand(45)/sind(45))/(tand(30)/sind(30)) which evaluates to 3.0618621785
>
> But that's just the "zoom" of the image (or the orthographic equivalent of
> zoom) and has nothing to do with the skewing. Your variable name SkewAdjust
> seem confusing that way, since it sounds like it adjusts the skewing, while
> it just adjusts the size of the visible area. The projection itself is
> exactly the same as the one I posted and which several others suggested all
> along.
>
> Rune
> --
> http://runevision.com

More exact because it's less arbitrary?

Here, I created a diagram to show you the derivation of the formula:

http://img263.imageshack.us/img263/8406/cubescomparepe2.png

On the left you see an isometric rendering of a cube. On the right you see the
same rendering, except that the projection plane is skewed so that it becomes
oblique instead of isometric. Now, one result of skewing the projection plane
is that the unit scale in the resulting image is different than in the
original. To fix this, one must simply scale the oblique image by an amount
equal to the ratio of the lengths of some vector that exists in both images,
but is scaled in one.

In this case I wanted to scale the image on the right so that segment c in the
right image is equal in length to segment a in the left image. The formula I
provided does just that.

Here's another way of obtaining the same result, except using a different
formula (one based on the pythagorean theorem):

sqrt(1^2 + tan(45)^2) / sqrt(1^2 + tan(30)^2)

You then multiply this by 5/2 to get the correct projection plane dimensions.


Post a reply to this message

From: Trevor G Quayle
Subject: Re: Oblique projection
Date: 5 Jan 2008 10:10:01
Message: <web.477f9ccd443d65d72ae8612c0@news.povray.org>
"SharkD" <nomail@nomail> wrote:
> "Rune" <aut### [at] runevisioncom> wrote:
> > "SharkD" wrote:
> > > Here's my version (a little more exact).
> >
> > Looks fine, but I'm curious how it is more exact exactly. I mean, sure,
> > instead of a CameraArea of 3.03 you effectively use one of
> >
> > 5/2*(tand(45)/sind(45))/(tand(30)/sind(30)) which evaluates to 3.0618621785
> >
> > But that's just the "zoom" of the image (or the orthographic equivalent of
> > zoom) and has nothing to do with the skewing. Your variable name SkewAdjust
> > seem confusing that way, since it sounds like it adjusts the skewing, while
> > it just adjusts the size of the visible area. The projection itself is
> > exactly the same as the one I posted and which several others suggested all
> > along.
> >
> > Rune
> > --
> > http://runevision.com
>
> More exact because it's less arbitrary?
>
> Here, I created a diagram to show you the derivation of the formula:
>
> http://img263.imageshack.us/img263/8406/cubescomparepe2.png
>
> On the left you see an isometric rendering of a cube. On the right you see the
> same rendering, except that the projection plane is skewed so that it becomes
> oblique instead of isometric. Now, one result of skewing the projection plane
> is that the unit scale in the resulting image is different than in the
> original. To fix this, one must simply scale the oblique image by an amount
> equal to the ratio of the lengths of some vector that exists in both images,
> but is scaled in one.
>
> In this case I wanted to scale the image on the right so that segment c in the
> right image is equal in length to segment a in the left image. The formula I
> provided does just that.
>
> Here's another way of obtaining the same result, except using a different
> formula (one based on the pythagorean theorem):
>
> sqrt(1^2 + tan(45)^2) / sqrt(1^2 + tan(30)^2)
>
> You then multiply this by 5/2 to get the correct projection plane dimensions.

I see what you are trying to do, but actually to be equivilant, segment d should
equal segment b.  You are assuming that a is shown as the correct length, but in
the iso projection, a is shortened from what it should be (ie, not 1:1), whereas
segment b is already the correct length as it has no distortion from the
projection.  This means that the same horizontal camera sizeworks for both

-tgq


Post a reply to this message

From: SharkD
Subject: Re: Oblique projection
Date: 5 Jan 2008 10:35:00
Message: <web.477fa2f9443d65d7e14fbc8d0@news.povray.org>
"Trevor G Quayle" <Tin### [at] hotmailcom> wrote:
> I see what you are trying to do, but actually to be equivilant, segment d should
> equal segment b.  You are assuming that a is shown as the correct length, but in
> the iso projection, a is shortened from what it should be (ie, not 1:1), whereas
> segment b is already the correct length as it has no distortion from the
> projection.  This means that the same horizontal camera sizeworks for both
>
> -tgq

No. In the images, segment d *does* equal segment b. The isometric image uses
the correct unit scale along all three axes (hence the term "isometric", "equal
measure"). The distortion caused by the oblique projection causes the vertical
(in this case) axis to become stretched.


Post a reply to this message

From: SharkD
Subject: Re: Oblique projection
Date: 5 Jan 2008 10:35:01
Message: <web.477fa36e443d65d7e14fbc8d0@news.povray.org>
Also, 1/sqrt(2) is equal to sind(45), which is a ratio already mentioned by
someone in a previous post in this thread (go figure). I'm using that in all my
scenes from now on.


Post a reply to this message

From: SharkD
Subject: Re: Oblique projection
Date: 5 Jan 2008 15:55:01
Message: <web.477fee53443d65d7e458a4ca0@news.povray.org>
"SharkD" <nomail@nomail> wrote:
> "Trevor G Quayle" <Tin### [at] hotmailcom> wrote:
> > I see what you are trying to do, but actually to be equivilant, segment d should
> > equal segment b.  You are assuming that a is shown as the correct length, but in
> > the iso projection, a is shortened from what it should be (ie, not 1:1), whereas
> > segment b is already the correct length as it has no distortion from the
> > projection.  This means that the same horizontal camera sizeworks for both
> >
> > -tgq
>
> No. In the images, segment d *does* equal segment b. The isometric image uses
> the correct unit scale along all three axes (hence the term "isometric", "equal
> measure"). The distortion caused by the oblique projection causes the vertical
> (in this case) axis to become stretched.

I take that back. You're right. The scaling is not necessary.


Post a reply to this message

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