POV-Ray : Newsgroups : povray.general : Sequence of images but not animation Server Time
27 Nov 2024 03:49:34 EST (-0500)
  Sequence of images but not animation (Message 1 to 7 of 7)  
From: Daniel
Subject: Sequence of images but not animation
Date: 18 Jun 2009 13:45:00
Message: <web.4a3a7a0cbf13d750d6bbb9d50@news.povray.org>
Hi. I have a povray file that has a few stuff in it, and I can use it to render
an image. One of the things is:

mesh { #include "mesh.inc" inside_vector <1, 0, 0> translate <0, -2, 0>}

, which is a file that includes a complex mesh in triangle forms.

Now I have a huge series of meshes numbered as follows:

mesh00000.inc
mesh00001.inc
mesh00002.inc

etc, all the way to about 800 or something.

How can I get a single povray file to render all images, changing the value of
the include file only for each seporate image?


serperate files. Oh, and the files should be saved as bmp format, same as the
input mesh. So mesh00000.bmp etc...

anyone?


Post a reply to this message

From: CShake
Subject: Re: Sequence of images but not animation
Date: 18 Jun 2009 14:12:44
Message: <4a3a839c@news.povray.org>
Daniel wrote:
> Hi. I have a povray file that has a few stuff in it, and I can use it to render
> an image. One of the things is:
> 
> mesh { #include "mesh.inc" inside_vector <1, 0, 0> translate <0, -2, 0>}
> 
> , which is a file that includes a complex mesh in triangle forms.
> 
> Now I have a huge series of meshes numbered as follows:
> 
> mesh00000.inc
> mesh00001.inc
> mesh00002.inc
> 
> etc, all the way to about 800 or something.
> 
> How can I get a single povray file to render all images, changing the value of
> the include file only for each seporate image?
> 

> serperate files. Oh, and the files should be saved as bmp format, same as the
> input mesh. So mesh00000.bmp etc...
> 
> anyone?
> 
> 

I came across a similar problem a while ago while working on macros, 
where I needed to call functions with different names depending on a 
parameter. The way I got it to work, thanks to clipka, was using a 
'parse literals' function:
#macro ParseLiteral(s)
   #declare ParseLiteralFile = "ParseLiteral_$$$.inc";
   #fopen ParseLiteral_FD ParseLiteralFile write
   #write (ParseLiteral_FD,s)
   #fclose ParseLiteral_FD
   #include ParseLiteralFile
#end

This would work for you by calling:
ParseLiteral(concat("#include mesh", str(MeshNumber,-5,0), ".inc"))
where 'MeshNum' is your frame number.

If you're looking to output to the animation style sequence of files, 
I'd recommend treating it like an animation with the proper frame usage 
(+KFI, +KFF, etc), and using the current frame number as MeshNumber.

Hope this helps, and if I'm wrong with some of the syntax that you can 
figure out the idea!

CShake


Post a reply to this message

From: clipka
Subject: Re: Sequence of images but not animation
Date: 18 Jun 2009 14:15:01
Message: <web.4a3a8351989c16d853f3f7840@news.povray.org>
"Daniel" <nomail@nomail> wrote:
> Now I have a huge series of meshes numbered as follows:
>
> mesh00000.inc
> mesh00001.inc
> mesh00002.inc
>
> etc, all the way to about 800 or something.
>
> How can I get a single povray file to render all images, changing the value of
> the include file only for each seporate image?

If you do use POV-Ray's animation rendering mechanisms, you can include the
fitting mesh as follows:

  #local MyFrameNumberStr = substr(str(100000+frame_number,0,0),2,5);
  #local MyMeshInc = concat("mesh", MyFrameNumberStr, ".inc");
  #include MyMeshInc

Voila. The somewhat complex definition of MyFrameNumberStr serves to enforce
leading zeros.


> serperate files. Oh, and the files should be saved as bmp format, same as the
> input mesh. So mesh00000.bmp etc...

Specify the output file name as "mesh.bmp"; pretend that your frame number
ranges from 0 to 99999 (again to get those leading zeros) and just render the
subset you actually need.

The only thing is that they must all have the same resolution.


Post a reply to this message

From: Daniel
Subject: Re: Sequence of images but not animation
Date: 18 Jun 2009 14:35:00
Message: <web.4a3a87d5989c16d8d6bbb9d50@news.povray.org>
Thank you both for your prompt responses! You were very helpful :)

I will try out your suggestions later tonight, but from a first glance, they
both seem logical and feasible.

Thanks again. Now I can get my batch job started. ;)


Post a reply to this message

From: CShake
Subject: Re: Sequence of images but not animation
Date: 18 Jun 2009 14:53:38
Message: <4a3a8d32@news.povray.org>
Yeah, ignore what I said here, it works for calling custom functions but 
I forgot that you can simply specify the name of the file to include, no 
need to go through this extra function. Go with clipka's reply, just 
make sure you do the leading zeros correctly.

CShake wrote:
> I came across a similar problem a while ago while working on macros, 
> where I needed to call functions with different names depending on a 
> parameter. The way I got it to work, thanks to clipka, was using a 
> 'parse literals' function:
> #macro ParseLiteral(s)
>   #declare ParseLiteralFile = "ParseLiteral_$$$.inc";
>   #fopen ParseLiteral_FD ParseLiteralFile write
>   #write (ParseLiteral_FD,s)
>   #fclose ParseLiteral_FD
>   #include ParseLiteralFile
> #end
> 
> This would work for you by calling:
> ParseLiteral(concat("#include mesh", str(MeshNumber,-5,0), ".inc"))
> where 'MeshNum' is your frame number.
> 
> If you're looking to output to the animation style sequence of files, 
> I'd recommend treating it like an animation with the proper frame usage 
> (+KFI, +KFF, etc), and using the current frame number as MeshNumber.
> 
> Hope this helps, and if I'm wrong with some of the syntax that you can 
> figure out the idea!
> 
> CShake


Post a reply to this message

From: Warp
Subject: Re: Sequence of images but not animation
Date: 18 Jun 2009 16:33:14
Message: <4a3aa48a@news.povray.org>
clipka <nomail@nomail> wrote:
> > mesh00000.inc
> > mesh00001.inc
> > mesh00002.inc

>   #local MyFrameNumberStr = substr(str(100000+frame_number,0,0),2,5);

  That's a rather contrived way of doing it. There's a simpler way:

#include concat("mesh", str(frame_number, -5, 0), ".inc")

-- 
                                                          - Warp


Post a reply to this message

From: clipka
Subject: Re: Sequence of images but not animation
Date: 19 Jun 2009 13:00:01
Message: <web.4a3bc393989c16d87080f32a0@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
> clipka <nomail@nomail> wrote:
> > > mesh00000.inc
> > > mesh00001.inc
> > > mesh00002.inc
>
> >   #local MyFrameNumberStr = substr(str(100000+frame_number,0,0),2,5);
>
>   That's a rather contrived way of doing it. There's a simpler way:
>
> #include concat("mesh", str(frame_number, -5, 0), ".inc")

Revoco!

You're perfectly right. Looks like I browsed the str() documentation too
superficially.

But it's always good to know that in POV-Ray there's typically plenty of ways to
skin a cat :)


Post a reply to this message

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