![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
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
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"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
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"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
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"Rune" <aut### [at] runevision com> 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
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
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
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"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
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
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
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"Trevor G Quayle" <Tin### [at] hotmail com> wrote:
> blah blah blah
> -tgq
And don't forget -uv on the command line.
-tgq
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"Rune" <aut### [at] runevision com> 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
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"SharkD" <nomail@nomail> wrote:
> "Rune" <aut### [at] runevision com> 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
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |