POV-Ray : Newsgroups : povray.newusers : Setting image dimensions from the scene file? : Re: Setting image dimensions from the scene file? Server Time
29 Jul 2024 18:28:31 EDT (-0400)
  Re: Setting image dimensions from the scene file?  
From: JYR
Date: 22 May 2005 18:35:00
Message: <web.429108335f80a86f6a3607400@news.povray.org>
"Aek Chomaitong" <ach### [at] earthlinknet> wrote:
> I'm afraid I confused you.  Almost all calculations are in the scene
> file.  However, after I come out with the width and height in the
> scene file, I can not use it to control the image dimension from there
> (since POV-Ray requires the image dimension up front).
>
> To work around that, I copied a small part that calculates the image
> dimension into another program and have that program call POV-Ray with the
> correct image dimension.  It works but the problem is having to make sure
> the code in the external program and the one in the scene file is in sync
> at all times.  I also have to pass parameters to both the external program
> and POV-Ray too.  This process is quite error prone.
>
> I really appreciate your thought though.
>
> Aek.

Dear Aek,

Since you cannot set image dimension from within the scene description, but,
you have access to image_width and image_height, you can work around this
the other way.

*Have POV-Ray make the computations, including Requested_image_width and
Requested_image_height.
*Then have them compared against the built-in variables image_width and
image_height in a #if or a #switch statement
*If they match, POV-Ray keeps on rendering.
*If not, have POV-Ray create an INI file with proper width and height (see
documentation section 3.2.2.3 for opening and writing to a file) and abort
without rendering.

It still is cumbersome, as it is a 2 pass process. But at least the same
scene file is used to perform the computations in both case, which is much
less error prone.

Hoping this helps !

JYR


Post a reply to this message

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