POV-Ray : Newsgroups : povray.general : Oblique projection : Re: Oblique projection Server Time
31 Jul 2024 10:18:52 EDT (-0400)
  Re: Oblique projection  
From: SharkD
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

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