POV-Ray : Newsgroups : povray.newusers : How do you get just a piece of the image : Re: How do you get just a piece of the image Server Time
2 Nov 2024 13:17:38 EDT (-0400)
  Re: How do you get just a piece of the image  
From: StephenS
Date: 6 Mar 2004 22:11:52
Message: <404a92f8@news.povray.org>
> I have raytracing that is 200x200 and I want to extract just the upper
right
> 20x20 pixel corner. I thought
> +W200 +H200 +SC180 +ER20
> would do the trick but the result is still a 200x200 file with all but my
> desired square blackened out. But I don't want a 200x200 file. I want a
> 20x20 file that has that upper right corner and nothing else. Is there
some
> way to do this without resorting to manual cropping with an external
> graphics program?

Transforming the camera can work, example
// +h200 +w200
// -uv +h20 +w20
#declare Shear= transform {
   matrix <  .21,  0,  0,
             0,  .21,  0,
             .9,  .9,  1,
             0,  0,  0 >
}
camera {
        perspective
        location <0,0,0>
        right <1,0,0>
        look_at <0,0,10>
        // transform Shear
        }

box {<-10,-10,10>,<10,10,11>
     pigment {checker rgb<1,1,1>,rgb<0,0,0>}
     }
sky_sphere {pigment {rgb <0.859,0.910,0.831>}}

light_source {<100,120,-130> rgb<10,10,10>}

The transformation you need depends on the camera location and the direction
it's looking. I've chosen the easiest, with the location at <0,0,0>, looking
along the positive z direction. The .21 scales the view (.2 perfect fit) and
the .9 skews the image plane to the upper right corner. When using a
transformation like this, you need to turn off the vista buffer (-uv). The
only way to get a 20 x 20 final render is to use +h20 +w20.

I hope this is correct :-)

Stephen


Post a reply to this message

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