POV-Ray : Newsgroups : povray.newusers : Random Access inside a file. Server Time
1 Nov 2024 02:20:27 EDT (-0400)
  Random Access inside a file. (Message 1 to 3 of 3)  
From: pH
Subject: Random Access inside a file.
Date: 15 Aug 2011 18:15:01
Message: <web.4e4999a27447280bd0dbfa270@news.povray.org>
Hi all,

I am trying to read a frame_data_file which has data of frames to be animated.
This file has the following data

"Frame",<framenumber>,<number of bytes of data realted to this frame>
<framedata>
"Frame",<framenumber>,<number of bytes of data related to this frame>
<framedata>
..
..
..

I am reading this from a scene file(.pov) to generate a each frame. To generate
each image in the scene, I use the "clock" to get the frame I am generating.
Then I want to jump through my frame_data_file to that particular frame parse
the data pertinent to that. I am not able to find a way to randomly jump through
the frame_data_file using pov-ray file handling capabilities.

Is there some way I can achieve my functionality? The only other way I see is to
generate separate file for each frame which would be a lot.

Any help with this would be great.

Thanks,
pH


Post a reply to this message

From: Alain
Subject: Re: Random Access inside a file.
Date: 16 Aug 2011 12:59:38
Message: <4e4aa1fa$1@news.povray.org>

> Hi all,
>
> I am trying to read a frame_data_file which has data of frames to be animated.
> This file has the following data
>
> "Frame",<framenumber>,<number of bytes of data realted to this frame>
> <framedata>
> "Frame",<framenumber>,<number of bytes of data related to this frame>
> <framedata>
> ..
> ..
> ..
>
> I am reading this from a scene file(.pov) to generate a each frame. To generate
> each image in the scene, I use the "clock" to get the frame I am generating.
> Then I want to jump through my frame_data_file to that particular frame parse
> the data pertinent to that. I am not able to find a way to randomly jump through
> the frame_data_file using pov-ray file handling capabilities.
>
> Is there some way I can achieve my functionality? The only other way I see is to
> generate separate file for each frame which would be a lot.
>
> Any help with this would be great.
>
> Thanks,
> pH
>

There is no true random access of files.

You should use the "frame_number" internal variable.
Using that value, you sequentialy read through your file untill you find 
the coresponding <framenumber> entry, discarting unneeded frame 
informations. This will cause the parsing of your scene to get longer 
for later frames. For that reason, you should probably make some data 
files, maybe one per 100 frames.

Beter yet, reconstruct your data file as an .inc file and use 
#switch(frame_number) #case(Value) <frame_specific_code> #break ... 
#else ... #end

Using one #case(..)... #break statement per frame.

For your animation, if the first frame have less than 3 objects, it's 
advisable to create enough dummy objects to get about 4 objects uniquely 
for that frame. They can be zero radius spheres, of any object placed 
behind the camera, of having no_image no_reflection and no_shadow, or 
pigment{ rgbt 1} to make them invisible.
This will ensure that the bounding is done for all frames. There is no 
bounding done if there is less than 3 objects in the scene, and, in an 
animation, the flag is only set during the first frame.



Alain


Post a reply to this message

From: pH
Subject: Re: Random Access inside a file.
Date: 16 Aug 2011 15:15:01
Message: <web.4e4ac0a1874b3d7d2fab58380@news.povray.org>
Alain <aze### [at] qwertyorg> wrote:

> > Hi all,
> >
> > I am trying to read a frame_data_file which has data of frames to be animated.
> > This file has the following data
> >
> > "Frame",<framenumber>,<number of bytes of data realted to this frame>
> > <framedata>
> > "Frame",<framenumber>,<number of bytes of data related to this frame>
> > <framedata>
> > ..
> > ..
> > ..
> >
> > I am reading this from a scene file(.pov) to generate a each frame. To generate
> > each image in the scene, I use the "clock" to get the frame I am generating.
> > Then I want to jump through my frame_data_file to that particular frame parse
> > the data pertinent to that. I am not able to find a way to randomly jump through
> > the frame_data_file using pov-ray file handling capabilities.
> >
> > Is there some way I can achieve my functionality? The only other way I see is to
> > generate separate file for each frame which would be a lot.
> >
> > Any help with this would be great.
> >
> > Thanks,
> > pH
> >
>
> There is no true random access of files.
>
> You should use the "frame_number" internal variable.
> Using that value, you sequentialy read through your file untill you find
> the coresponding <framenumber> entry, discarting unneeded frame
> informations. This will cause the parsing of your scene to get longer
> for later frames. For that reason, you should probably make some data
> files, maybe one per 100 frames.
>
> Beter yet, reconstruct your data file as an .inc file and use
> #switch(frame_number) #case(Value) <frame_specific_code> #break ...
> #else ... #end
>
> Using one #case(..)... #break statement per frame.
>
> For your animation, if the first frame have less than 3 objects, it's
> advisable to create enough dummy objects to get about 4 objects uniquely
> for that frame. They can be zero radius spheres, of any object placed
> behind the camera, of having no_image no_reflection and no_shadow, or
> pigment{ rgbt 1} to make them invisible.
> This will ensure that the bounding is done for all frames. There is no
> bounding done if there is less than 3 objects in the scene, and, in an
> animation, the flag is only set during the first frame.
>
>
>
> Alain

Thanks Alian. I will look at the .inc option if it helps.


Post a reply to this message

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