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

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

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