POV-Ray : Newsgroups : povray.general : Parsing time and animations : Re: Parsing time and animations Server Time
3 May 2024 06:11:16 EDT (-0400)
  Re: Parsing time and animations  
From: clipka
Date: 4 Oct 2016 11:09:05
Message: <57f3c611$1@news.povray.org>
Am 04.10.2016 um 00:15 schrieb Mike Horvath:

> This is kind of a stupid question considering I've been using POV-Ray
> for nearly 20 years.

I would call the question anything but stupid.

> Does the program need to parse the scene completely each frame of an
> animation?

As far as official POV-Ray is concerned, yes.

> Is there any speed benefit compared to rendering each frame
> individually without POV's animation feature?

Yes, there still is.

There is always /some/ overhead associated with starting and terminating
a program: The operating system needs to set up a new process, load the
executable file into memory, and then start the process, which itself
may also do some general preparations (as a simple example, POV-Ray's
parser converts the "hand-woven" plain table of keywords into a format
that allows faster access); and upon termination the operating system
must do some cleaning-up.

Even more so, there's the matter of dynamic memory allocation: Whenever
a process needs additional memory, it needs to call the operating system
to allocate the amount needed, which is a comparatively costly matter.
Once the process terminates, all the allocated memory will be re-claimed
by the operating system, so when the process is re-started, it must
request the memory from the operating system all over again.

In contrast, when a process has finished a job and no longer needs all
the allocated memory allocated for it, it will /not/ release the memory
back to the operating system, but just make a mental note that the
memory block is vacant, and re-use it when it needs more memory again.
While there's still a bit of overhead involved in this management of
free memory blocks, it is far faster than acquiring more memory from the
operating system.


That said, the overhead of starting and stopping POV-Ray is fairly low
in magnitude compared to the total parsing and/or rendering time.


> I have a huge LDraw model that takes ~30 hours to parse and ~1 hour to
> render. If each frame doesn't need to the scene to be parsed completely
> I may consider making an animation. Otherwise, I won't do it.

As omniverse already mentioned, you definitely want to check out
UberPOV, which features an experimental (but working) mechanism to
persist data between frames of an animation (or, more precisely, for as
long as the instance of POV-Ray is running, which is the same on Unix
but makes a difference on Windows; but that's more of a side effect than
intentional, and is the sole reason why the mechanism is still
considered experimental).

The mechanism can persist virtually anything you can stuff into a
variable. To my knowledge (and I wrote the thing), the only exceptions
are random number generators (as created by `seed()` and used by
`rand()`) and file handles (as created by `#fopen` and used e.g. by
`#read` or `write`), as in both cases the variables technically just
hold plain numbers, which happen to be valid indices into tables
maintained separately.

The use is pretty straightforward: Simply use `#persistent` instead of
`#declare`, and the variable and its contents will still be around in
the next frame. `#ifdef` should work as expected, so you can e.g. choose
whether or not to include a file depending on whether the variable is
already set, without having to rely on frame numbers.


Post a reply to this message

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