POV-Ray : Newsgroups : povray.animations : How to speed up parsing in animation scenes? Server Time
23 Nov 2024 18:00:39 EST (-0500)
  How to speed up parsing in animation scenes? (Message 1 to 6 of 6)  
From: Icetoaster
Subject: How to speed up parsing in animation scenes?
Date: 4 Apr 2006 19:40:00
Message: <web.443302a27a8dbebefe62e2cd0@news.povray.org>
Hi,

I recognized, that at each frame of the animation Povray does a
parsing of the non-dynamic scene. This takes up 9/10 (=ParseTime)
of the total time. Only 1/10 of the time is the render time.
(ParseTime = 9 * RenderTime)

Lets say, I have n frames, the render time is

t_now = n * (ParseTime + RenderTime) = n * 10 * RenderTime

However, if objects stay the same, it should be speeded up to this:

t_better = 1 * ParseTime + n * RenderTime = (n + 9) * RenderTime


which is much less.
For n=10:  t_now = 100 * RenderTime
        t_better =  19 * RenderTime

Is there a possibility to speed up things like that?
Or is it my fault, because I use a rand() function for some
objects.

Thanks,
IT


Post a reply to this message

From: Slime
Subject: Re: How to speed up parsing in animation scenes?
Date: 5 Apr 2006 01:46:07
Message: <4433599f$1@news.povray.org>
> Is there a possibility to speed up things like that?
> Or is it my fault, because I use a rand() function for some
> objects.

Well, POV-Ray always re-parses the file each frame, and there's nothing that
can be done about that. However, if there's any part of your scene which is
dynamically generated (for instance, many objects created in a loop or
recursively) and doesn't change depending on the clock, you could #write it
to a file during the first frame, in POV-Ray SDL, and then #include that
file in the rest of the frames.

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

From: Mike Williams
Subject: Re: How to speed up parsing in animation scenes?
Date: 5 Apr 2006 02:36:17
Message: <UR12LEAaU2MEFwoU@econym.demon.co.uk>
Wasn't it Icetoaster who wrote:
>Hi,
>
>I recognized, that at each frame of the animation Povray does a
>parsing of the non-dynamic scene. This takes up 9/10 (=ParseTime)
>of the total time. Only 1/10 of the time is the render time.
>(ParseTime = 9 * RenderTime)
>
>Lets say, I have n frames, the render time is
>
>t_now = n * (ParseTime + RenderTime) = n * 10 * RenderTime
>
>However, if objects stay the same, it should be speeded up to this:
>
>t_better = 1 * ParseTime + n * RenderTime = (n + 9) * RenderTime
>
>
>which is much less.
>For n=10:  t_now = 100 * RenderTime
>        t_better =  19 * RenderTime
>
>Is there a possibility to speed up things like that?
>Or is it my fault, because I use a rand() function for some
>objects.

The old MegaPOV (before version 1.0) had "Persistence of Variables" and
"Persistence of Objects" features, which did that. I don't know of any
patched versions based on recent POV syntax that provide such features.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Icetoaster
Subject: Re: How to speed up parsing in animation scenes?
Date: 5 Apr 2006 19:15:00
Message: <web.44344e4bc3ee1f7fe62e2cd0@news.povray.org>
"Slime" <fak### [at] emailaddress> wrote:
> > Is there a possibility to speed up things like that?
> > Or is it my fault, because I use a rand() function for some
> > objects.
>
> Well, POV-Ray always re-parses the file each frame, and there's nothing that
> can be done about that. However, if there's any part of your scene which is
> dynamically generated (for instance, many objects created in a loop or
> recursively) and doesn't change depending on the clock, you could #write it
> to a file during the first frame, in POV-Ray SDL, and then #include that
> file in the rest of the frames.
>
>  - Slime
>  [ http://www.slimeland.com/ ]

How can I write those static objects to a file?
I have looked for the description of the #write command, but this seem
to make sense only for strings and numbers. I have e.g. a staple of
wooden trunks, which are translated by a small random value to make it
look more natural.

How can I output rendered objects with this method? And under what
circumstances
does this save time?

Thanks for help,
Icetoaster


Post a reply to this message

From: Roman Reiner
Subject: Re: How to speed up parsing in animation scenes?
Date: 5 Apr 2006 20:55:01
Message: <web.4434658cc3ee1f7e4cdad7b0@news.povray.org>
"Icetoaster" <icetoaster_at_gmx.de> wrote:
> How can I write those static objects to a file?
> I have looked for the description of the #write command, but this seem
> to make sense only for strings and numbers. I have e.g. a staple of
> wooden trunks, which are translated by a small random value to make it
> look more natural.
>
> How can I output rendered objects with this method? And under what
> circumstances
> does this save time?
>
> Thanks for help,
> Icetoaster

You have to use the #write command in a way where it writes POV-Ray SDL into
the file. If your wooden trunks are made using cylinders you have to use
something like

#write(file, "cylinder { ", P1, ", ", P2, ", ", Rad, " texture { /*some
texture definitions here*/ } transform { /*some transformations here*/
}}")

where P1, P2 and Rad are the variables that contain the appropriate data.
this happens to be very unreadable but you can always check the outputted
file for correctness (and you get errors when something is wrong ;))

Then what you do is including the previously generated file with the
#include command and the cylinders are added to the scene without needing
the time to calculate their positions/orientations.

Hope this helps!
Regards Roman


Post a reply to this message

From: Icetoaster
Subject: Re: How to speed up parsing in animation scenes?
Date: 2 May 2006 09:45:00
Message: <web.4457618ec3ee1f71859bb350@news.povray.org>
Thanks very much for the answer. However I think this is to complicated for
the scene I have created and I guess it would not save that much time.

However, in the meantime I have found another method to save a LOT of time:
I organized the animation into segments (rooms) and only add the rooms to
the current animation frame which are within range based on the current
camera position.

The rooms contain a set of macros and objects stored in variables defined
in a include file.

Regards,
Icetoaster


"Roman Reiner" <lim### [at] gmxde> wrote:
> You have to use the #write command in a way where it writes POV-Ray SDL into
> the file. If your wooden trunks are made using cylinders you have to use
> something like
>
> #write(file, "cylinder { ", P1, ", ", P2, ", ", Rad, " texture { /*some
> texture definitions here*/ } transform { /*some transformations here*/
> }}")
>
> where P1, P2 and Rad are the variables that contain the appropriate data.
> this happens to be very unreadable but you can always check the outputted
> file for correctness (and you get errors when something is wrong ;))
>
> Then what you do is including the previously generated file with the
> #include command and the cylinders are added to the scene without needing
> the time to calculate their positions/orientations.
>
> Hope this helps!
> Regards Roman


Post a reply to this message

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