POV-Ray : Newsgroups : povray.general : 'IF EXISTS' technique to speed up animation restarts - possible? : Re: 'IF EXISTS' technique to speed up animation restarts - possible? Server Time
11 Aug 2024 11:21:19 EDT (-0400)
  Re: 'IF EXISTS' technique to speed up animation restarts - possible?  
From: Nieminen Mika
Date: 22 Jul 1999 03:10:13
Message: <3796c3d5@news.povray.org>
I think this is possible without patching povray or using any external
utility.

  Let me think...
  First you have to create a file named, for example, "currentframe" with
a "0" in it. For example:

echo 0 > currentframe

  You set it to "0" each time you start rendering (no matter if it's a
continued render or the first time).
  You also need another file, which you also initialize to "0". Let's name
it "calculatedframes":

echo 0 > calculatedframes

  We don't change this one anymore (until we have finished all the frames).

  Now, in the povray script you open both files and read their contents
into two identifiers (with same names, for example).
  If the 'currentframe' value is less than 'calculatedframes', we skip
this frame.
  AFAIK there's no way to tell povray "stop rendering this image". I think
this would be a good suggestion for the next version. Something like an
#exit directive. The #error directive is not good because it completely
stops povray instead of stopping just the current frame.
  We can however just enclose all the scene inside the #if-block. The scene
could be in another file. For example:

#if(!currentframe<calculatedframes)
  #include "scene.pov"
#end

  This way we save the parsing of the scene when we don't want to calculate
this frame.

  Now we add 1 to 'currentframe' and save it to its correspondent file. If
we rendered the scene we do this also to 'calculatedframes'. Like this:

(read 'currentframe' and 'calculatedframes')
#if(!currentframe<calculatedframes)
  #include "scene.pov"
  #declare calculatedframes=calculatedframes+1;
#end
#declare currentframe=currentframe+1;
(save 'currentframe' and 'calculatedframes' to their files)

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

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