POV-Ray : Newsgroups : povray.animations : Clockless_Animation Server Time
1 Jun 2024 11:30:58 EDT (-0400)
  Clockless_Animation (Message 41 to 44 of 44)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: muyu
Subject: Re: Clockless_Animation
Date: 4 Jan 2018 07:05:00
Message: <web.5a4e17ec992dfbe2cf0bfa9c0@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 03.01.2018 um 16:16 schrieb muyu:
>
> > I did another search in the forum. It seems that UberPOV can pass data through
> > frames without parsing each time. Is this true?
>
> Yes, absolutely.

I did not find material to show how to use this feature. Could you please give
an simple example? Thanks a lot.

Shouyang


Post a reply to this message

From: clipka
Subject: Re: Clockless_Animation
Date: 4 Jan 2018 11:40:35
Message: <5a4e5903$1@news.povray.org>
Am 04.01.2018 um 13:02 schrieb muyu:
> clipka <ano### [at] anonymousorg> wrote:
>> Am 03.01.2018 um 16:16 schrieb muyu:
>>
>>> I did another search in the forum. It seems that UberPOV can pass data through
>>> frames without parsing each time. Is this true?
>>
>> Yes, absolutely.
> 
> I did not find material to show how to use this feature. Could you please give
> an simple example? Thanks a lot.

For example, to load a complex mesh just once, you could use:

    #ifndef MyMesh
      #persistent MyMesh = mesh { ... }
    #endif
    object { MyMesh }

Or, to load an image map just once, you could use:

    #ifndef MyPigment
      #persistent MyPigment = pigment {
        image_map { ... }
      }
    #endif
    object { SomeObject
      texture {
        pigment { MyPigment }
        finish { ... }
      }
    }


In essence, `#persistent` works like `#declare`, but the variable sticks
around until UberPOV exits.

You'll still need to assemble the contents of such persistent variables
into a new scene for each frame; however, you can prepare arbitrarily
complex objects in this manner, such as nested CSG unions.


Post a reply to this message

From: muyu
Subject: Re: Clockless_Animation
Date: 5 Jan 2018 20:20:00
Message: <web.5a502405992dfbe2553834de0@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 04.01.2018 um 13:02 schrieb muyu:
> > clipka <ano### [at] anonymousorg> wrote:
> >> Am 03.01.2018 um 16:16 schrieb muyu:
> >>
> >>> I did another search in the forum. It seems that UberPOV can pass data through
> >>> frames without parsing each time. Is this true?
> >>
> >> Yes, absolutely.
> >
> > I did not find material to show how to use this feature. Could you please give
> > an simple example? Thanks a lot.
>
> For example, to load a complex mesh just once, you could use:
>
>     #ifndef MyMesh
>       #persistent MyMesh = mesh { ... }
>     #endif
>     object { MyMesh }
>
> Or, to load an image map just once, you could use:
>
>     #ifndef MyPigment
>       #persistent MyPigment = pigment {
>         image_map { ... }
>       }
>     #endif
>     object { SomeObject
>       texture {
>         pigment { MyPigment }
>         finish { ... }
>       }
>     }
>
>
> In essence, `#persistent` works like `#declare`, but the variable sticks
> around until UberPOV exits.
>
> You'll still need to assemble the contents of such persistent variables
> into a new scene for each frame; however, you can prepare arbitrarily
> complex objects in this manner, such as nested CSG unions.

Thanks a lot for your suggestions. But it still need parsing from frame to
frame. I upload my pov file in this link
http://news.povray.org/povray.binaries.animations/message/%3Cweb.5a50228f5c821073553834de0%40news.povray.org%3E/#%3Cweb
.5a50228f5c821073553834de0%40news.povray.org%3E

Could you please help have a look? Thanks a lot in advance.

Have a nice weekend
Shouyang


Post a reply to this message

From: clipka
Subject: Re: Clockless_Animation
Date: 6 Jan 2018 00:55:27
Message: <5a5064cf$1@news.povray.org>
Am 06.01.2018 um 02:19 schrieb muyu:

>> In essence, `#persistent` works like `#declare`, but the variable sticks
>> around until UberPOV exits.
>>
>> You'll still need to assemble the contents of such persistent variables
>> into a new scene for each frame; however, you can prepare arbitrarily
>> complex objects in this manner, such as nested CSG unions.
> 
> Thanks a lot for your suggestions. But it still need parsing from frame to
> frame.

Well, yes, of course. The scene needs to be parsed again for each frame,
if only to insert the `#persistent`-declared object into the scene for
that frame in a manner that's unique to that particular frame (after all
you want /some/ difference between the frames of an animation).

Parsing speed is still increased, because UberPOV doesn't actually need
to process the tokens in the `#ifndef FOO #persistent FOO = ... #endif`
blocks again, but can just skip over them instead. For example, in an
image based pigment the most time is spent in loading the actual image
file, not parsing.

In cases where the block is just a long litany of loopless SDL code that
would be easy to parse except for its sheer length (as might be the case
for mesh2 objects), another trick you can use is to pull out that code
into an include file, and place the `#include` statement into the
`#ifndef... #endif` block, e.g.:

    // main file
    #ifndef MyMesh
      #include "mymesh.inc"
    #endif
    object { MyMesh }

    // mymesh.inc
    #persistent MyMesh = mesh2 {
      ...
    }

Or, if your mesh is generated by a 3rd party utility and uses
`#declare`, you might use:

    // main file
    #ifndef MyMesh
      #include "mymesh.inc"
      #persistent MyMesh = object { ExportedMesh }
    #endif

    // mymesh.inc
    #declare ExportedMesh = mesh2 {
      ...
    }


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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