POV-Ray : Newsgroups : povray.general : stuck with user_defined camera : Re: stuck with user_defined camera Server Time
27 Apr 2024 01:18:11 EDT (-0400)
  Re: stuck with user_defined camera  
From: clipka
Date: 21 Jan 2019 12:17:35
Message: <5c45feaf$1@news.povray.org>
Am 21.01.2019 um 17:24 schrieb ingo:

> In the scene below, two camera's, the user_defined one gives an identical
> image to the commented out perpective one, pixel perfect says imagemagick
> (without AA). With the commented out part of the user_defined camera I
> intend select the top left quadrant and render that to a square image. I
> get an image of a quarter sphere, not in the position I want and
> stretched in strange ways. It looks as if the "canvas" needs to be moved.
> But how?

I'm not exactly sure what you want to achieve.


(A) The easiest way to render an image in tiles is to tell POV-Ray to 
create a full-sized image but only render a subset of it, leaving the 
remaining pixels blank (transparent if the image file format supports 
it, or black otherwise). Multiple such images can later be merged with 
an appropriate operation (addition or overlay, depending on whether 
unrendered pixels are black or transparent).

If this is what you want, it can be easily achieved without even using a 
user-defined camera; simply specify the full image resolution, and use 
the partial output options (`+SCn +ECn +SRn +ERn`) to have POV-Ray 
render only the specified subset of the image.

Note that most file formats will compress uniform regions pretty well, 
so the unrendered portions won't add much to the on-disk size of the 
individual image files.


(B) If for some reason this is not an option, and you need to render to 
files that encompass just the regions actually rendered you could 
probably accomplish this use a shearing transformation on the camera; 
but if you already have a user-defined camera set up, it should be a 
piece of cake to use that instead.


> camera {
>    user_defined
>    location 0
>    direction{
>      function{u*tan(radians(90)/2)}
>      function{v*tan(radians(90)/2)}
>      //function{select((u>-0.5 & u<0  ),0,0,u*radians(90)/2)}
>      //function{select((v> 0   & v<0.5),0,0,v*radians(90)/2)}
>      function{.5}
>    }
> }

This looks like you were trying to aim for (A).

If (B) is what you are after, all you need to do is scale and offset u 
and v, like so:

     direction{
       //function{u*tan(radians(90)/2)}
       //function{v*tan(radians(90)/2)}
       function{(u*2-1)*tan(radians(90)/2)}
       function{(v*2+1)*tan(radians(90)/2)}
       function{.5}
     }

This should render an image that shows - in higher resolution - one 
quadrant of the image. (Not quite sure if it's the top left or bottom 
left quadrant, but it should be the one you were trying for.)

(The "quarter sphere" and "not in the position I want" is because you 
got the approach wrong, and the "stretched in strange ways" is because 
you forgot the `tan()` in the commented-out functions.)


Post a reply to this message

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