POV-Ray : Newsgroups : povray.unofficial.patches : Patch or Unofficial Version with Persistent Variables/Objects Server Time
5 Nov 2024 14:24:35 EST (-0500)
  Patch or Unofficial Version with Persistent Variables/Objects (Message 1 to 5 of 5)  
From: Excentp
Subject: Patch or Unofficial Version with Persistent Variables/Objects
Date: 16 Feb 2014 00:25:01
Message: <web.53004a73e2fb9b2cc116c8bf0@news.povray.org>
I am currently working on a project that involves creating animation frames for
a mesh2 object with at 400,000 triangles and one light source.

I've already voiced my concern at the animation forum, but replies have been
slow.

So my issue is that my scene is being reparsed into around 3000 K tokens every
time prior to rendering the frame. The mesh contains the bulk of the information
for my scene, but it is unchanged throughout the animation. The only thing that
changed is the location of the light source.

So what I would like to know is if UberPOV has any plans to include persistent
variables and objects like what MegaPOV in its very early versions?

If not, I would like to know how which POV-Ray source code files to alter so as
to be able to load unchanging object data only once and retain it for all
frames.


Post a reply to this message

From: Christian Froeschlin
Subject: Re: Patch or Unofficial Version with Persistent Variables/Objects
Date: 16 Mar 2014 14:15:40
Message: <5325ea4c@news.povray.org>
> If not, I would like to know how which POV-Ray source code files to alter so as
> to be able to load unchanging object data only once and retain it for all
> frames.

Sorry for the long silence, you find me in continuous state of guilt.

I did hack something together for this based on 3.7b34 (back in
2009 I think) with the intent of creating a real patch after 3.7
proper was released. Of course that turned out to be a lot of
years in between and now mostly busy with other things.

After your post I thought I might give it a shot but I actually got
stuck already getting 3.7 release to compile (new computer, new OS,
new Visual Studio version, changed build) and think I won't be
focussing on this anytime soon.

I just dug up an old CVS repository from a backup of my last
computers hard drive to find out what changes I did. Its a bit
of a mess, really, I didn't plan to store this for eternity.

Still I think the info could help you implement a patch for 3.7
even if the codebase probably looks totally different than in 2009.
The 5 files I changed were parse.h, parse.cpp, reswords.h, reswords.cpp
and tokenize.cpp. I attach 2 zipfiles, one contains the state these
files were in in 3.7b34 and one the files after my changes (because
it's all a bit of a mess there can be changes regarding tokens
for an aoi pattern in there too, ignore those).

The basic idea of the change is to introduce a new symbol table.
POVRay already had 2, one for reserved words and one for variables.
The new symbol table is for static variables introduced using a
new keyword #static instead of #declare. When a variable name
is use, it is first looked up in the static table and then
falls through to the dynamic table.

Really the only difference between the tables is that I
completely left out the code for freeing the static table
after rendering. This has the following effects:

In a command line environment, static variables values persist
between frames of an animation.

In an interactive GUI environment, static variables persist as
long as the process is running. So you can run a single render
that loads static variables, and when you run any other render
it can still see that variable. In order to be complete such a
patch should contain GUI functionality to show and clear the
currently stored static variables.

But even without it is very useful. It would be cool to see it
implemented in an official version.

Hope this helps,

   Christian

PS: Strictly speaking code changes based on beta version should not
be published but the idea there is to prevent variants of unsupported
and outdated versions making the rounds. I hope showing you one change
I made in 2009 will not cause b34 to go rampant again :)


Post a reply to this message


Attachments:
Download 'b34orig.zip' (83 KB) Download 'b34static.zip' (83 KB)

From: Excentp
Subject: Re: Patch or Unofficial Version with Persistent Variables/Objects
Date: 9 Apr 2014 16:30:00
Message: <web.5345accd2520f633dd5403ef0@news.povray.org>
Christian Froeschlin <chr### [at] chrfrde> wrote:
> > If not, I would like to know how which POV-Ray source code files to alter so as
> > to be able to load unchanging object data only once and retain it for all
> > frames.
>
> Sorry for the long silence, you find me in continuous state of guilt.
>
> I did hack something together for this based on 3.7b34 (back in
> 2009 I think) with the intent of creating a real patch after 3.7
> proper was released. Of course that turned out to be a lot of
> years in between and now mostly busy with other things.
>
> After your post I thought I might give it a shot but I actually got
> stuck already getting 3.7 release to compile (new computer, new OS,
> new Visual Studio version, changed build) and think I won't be
> focussing on this anytime soon.
>
> I just dug up an old CVS repository from a backup of my last
> computers hard drive to find out what changes I did. Its a bit
> of a mess, really, I didn't plan to store this for eternity.
>
> Still I think the info could help you implement a patch for 3.7
> even if the codebase probably looks totally different than in 2009.
> The 5 files I changed were parse.h, parse.cpp, reswords.h, reswords.cpp
> and tokenize.cpp. I attach 2 zipfiles, one contains the state these
> files were in in 3.7b34 and one the files after my changes (because
> it's all a bit of a mess there can be changes regarding tokens
> for an aoi pattern in there too, ignore those).
>
> The basic idea of the change is to introduce a new symbol table.
> POVRay already had 2, one for reserved words and one for variables.
> The new symbol table is for static variables introduced using a
> new keyword #static instead of #declare. When a variable name
> is use, it is first looked up in the static table and then
> falls through to the dynamic table.
>
> Really the only difference between the tables is that I
> completely left out the code for freeing the static table
> after rendering. This has the following effects:
>
> In a command line environment, static variables values persist
> between frames of an animation.
>
> In an interactive GUI environment, static variables persist as
> long as the process is running. So you can run a single render
> that loads static variables, and when you run any other render
> it can still see that variable. In order to be complete such a
> patch should contain GUI functionality to show and clear the
> currently stored static variables.
>
> But even without it is very useful. It would be cool to see it
> implemented in an official version.
>
> Hope this helps,
>
>    Christian
>
> PS: Strictly speaking code changes based on beta version should not
> be published but the idea there is to prevent variants of unsupported
> and outdated versions making the rounds. I hope showing you one change
> I made in 2009 will not cause b34 to go rampant again :)

Christian

Of interest to me is the reswords.h. The current 3.7 has this line

#define SYM_ENTRY_REF_MAX           USHRT_MAX

in place of your changes

// Special symbol tables
#define ST_RESERVED_WORDS           0   // Reserved words only
#define ST_STATIC_SYMBOLS           1   // #static
#define ST_GLOBAL_SYMBOLS           2   // #declare / top-level #local


Post a reply to this message

From: clipka
Subject: Re: Patch or Unofficial Version with Persistent Variables/Objects
Date: 27 May 2014 15:14:23
Message: <5384e40f$1@news.povray.org>
Am 16.03.2014 19:15, schrieb Christian Froeschlin:

> I did hack something together for this based on 3.7b34 (back in
> 2009 I think) with the intent of creating a real patch after 3.7
> proper was released. Of course that turned out to be a lot of
> years in between and now mostly busy with other things.
>
> After your post I thought I might give it a shot but I actually got
> stuck already getting 3.7 release to compile (new computer, new OS,
> new Visual Studio version, changed build) and think I won't be
> focussing on this anytime soon.

...

> PS: Strictly speaking code changes based on beta version should not
> be published but the idea there is to prevent variants of unsupported
> and outdated versions making the rounds. I hope showing you one change
> I made in 2009 will not cause b34 to go rampant again :)

You surely are aware that this infringement cannot go unpunished, right? 
You are hereby sentenced to have your code stolen from you, mangled, and 
integrated into UberPOV :-P

See the following link for what is about to become of your idea:

https://github.com/UberPOV/UberPOV/tree/feature/persistent


Post a reply to this message

From: Christian Froeschlin
Subject: Re: Patch or Unofficial Version with Persistent Variables/Objects
Date: 26 Jun 2014 18:25:39
Message: <53ac9de3$1@news.povray.org>
On 27.05.2014 21:14, clipka wrote:

> You are hereby sentenced to have your code stolen from you, mangled, and
> integrated into UberPOV :-P

Hey, very cool! After all these years I finally contributed something ;)

The issue popped up now and then in the newsgroups so I'm sure a few
animators will be made happy once they discover this. It's been too long
since I rendered anything myself but I'll definitely have to check out
UberPOV at some point.


Post a reply to this message

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