POV-Ray : Newsgroups : povray.general : Oblique projection Server Time
31 Jul 2024 06:22:42 EDT (-0400)
  Oblique projection (Message 11 to 20 of 43)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>
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

<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>

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