POV-Ray : Newsgroups : povray.general : changing output file in script Server Time
15 Nov 2024 23:21:12 EST (-0500)
  changing output file in script (Message 1 to 8 of 8)  
From: Sally
Subject: changing output file in script
Date: 13 May 2004 02:27:12
Message: <40a31540$1@news.povray.org>
First question: is there a way to change the output file name from
within a POV file... perhaps during a preprocessor directive? Doing it
from within an INI will not work either as I want the output file to
depend on the clock variable if possible.

Another question is if I can somehow access a list of files in a
directory. The purpose of this would be to put 100 different textures
into a directory and loop through rendering a single script/object but
using a different texture each time. Hopefully this could be done again
with the clock variable, if not, what is the best way to do this without
having to manually type in all the files one by one?


Post a reply to this message

From: Christoph Hormann
Subject: Re: changing output file in script
Date: 13 May 2004 08:00:02
Message: <c7vnnk$594$1@chho.imagico.de>
Sally wrote:
> First question: is there a way to change the output file name from
> within a POV file... perhaps during a preprocessor directive? Doing it
> from within an INI will not work either as I want the output file to
> depend on the clock variable if possible.

You are probably trying to do something really ugly that would better be 
  done in a different way.  The clock variable can't be set from within 
the POV-SDL file so there is no reason to set the output file name 
depending on it from there either.  Both can only be specified as 
command line/ini file options.

> Another question is if I can somehow access a list of files in a
> directory. The purpose of this would be to put 100 different textures
> into a directory and loop through rendering a single script/object but
> using a different texture each time. Hopefully this could be done again
> with the clock variable, if not, what is the best way to do this without
> having to manually type in all the files one by one?

There are dozens of possible ways to accomplish this, the most simple 
probably is (as shell script, should be possible as Windows batch file 
as well):

for TEXTURE in *.jpeg ; do
   echo "#declare TEXTURE_FILE=\"$TEXTURE\"" > image_file.inc
   povray -iscene.pov -o${TEXTURE}_pov.png
done

Where scene.pov of course #includes image_file.inc and uses TEXTURE_FILE 
then.

Using the internal animation loop of POV-Ray would be possible as well 
but somewhat more complicated (generating an array of image file names 
would be possible as well as writing a file list to be read via #read).

Christoph

-- 
POV-Ray tutorials, include files, Sim-POV,
HCR-Edit and more: http://www.tu-bs.de/~y0013390/
Last updated 01 May. 2004 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: cubicon
Subject: Re: changing output file in script
Date: 13 May 2004 11:05:01
Message: <web.40a38d9ea683fab02e6949d0@news.povray.org>
Off-topic; sorry about this.
Sally, I couldn't get your email to work, so here is the letter:
http://www.geocities.com/fcmodelview/sally.txt


Post a reply to this message

From: Sally
Subject: Re: changing output file in script
Date: 13 May 2004 18:01:42
Message: <40a3f046@news.povray.org>
I dont need to change the clock variable in the .pov file, its changing
normally as I want it, but I want the texture to depend on it. I could
have a huge "switch" like statement with each filename, but then it
doesn't adapt to each file automatically.

And I'd prefer not to use batch files but its so far the only solution I
have seen (and ty for that solution by the way).


Post a reply to this message

From: Stephen McAvoy
Subject: Re: changing output file in script
Date: 13 May 2004 19:06:10
Message: <fqv7a0t316tuf6ru6mkq2lspg4qpv5dl5d@4ax.com>
On Thu, 13 May 2004 15:59:43 -0600, "Sally"
<bui### [at] NOSPAMyahoocom> wrote:

>I dont need to change the clock variable in the .pov file, its changing
>normally as I want it, but I want the texture to depend on it. I could
>have a huge "switch" like statement with each filename, but then it
>doesn't adapt to each file automatically.
>
>And I'd prefer not to use batch files but its so far the only solution I
>have seen (and ty for that solution by the way).
>

Would something like this do?


#declare Cycle02_Max = 120;   //      Number of textures in the cycle.

#declare F_Name = "My_Texture_"       ;       // Base name of your
Texture                            
        
#declare Cycle02Pos =  mod (frame_number, Cycle02_Max); 
// This should repeat the cycle if the number of frames is a multiple
of the number of textures.

#declare
Texture_clock=concat(F_Name,str(int(Cycle02Pos),-1,0),".txt");


box {
    <-1, 0,   -1>,  
    < 1, 0.5,  3>   
    texture {
      Texture_clock 
    }
}

Where
My_Texture_01.txt
My_Texture_02.txt
My_Texture_03.txt
Etc.
Is the list of textures

I use this sort of logic to create animations with sequentially
numbered meshes. Actually I do the opposite to what you want. One
texture for different objects.
I've not tested this as I'm running an animation.


Regards
        Stephen


Post a reply to this message

From: Alain
Subject: Re: changing output file in script
Date: 13 May 2004 19:12:28
Message: <40a400dc@news.povray.org>
Sally nous apporta ses lumieres ainsi en ce 2004/05/13 17:59... :

>I dont need to change the clock variable in the .pov file, its changing
>normally as I want it, but I want the texture to depend on it. I could
>have a huge "switch" like statement with each filename, but then it
>doesn't adapt to each file automatically.
>
>And I'd prefer not to use batch files but its so far the only solution I
>have seen (and ty for that solution by the way).
>
>
>  
>
Name your images files with names such as: Pic00.png, pic01.png ... 
Pic99.png
In your cene, use a string concatenation: #local PicName = 
concat("Pic",str(int(clock *100),-2,0),".png");
//I put the int() to ensure strictly integer values.
//I use a lenght of -2 in the str() to pad to 2 characters with leading 0s.
Then use PicName in your texture.
It should use your images in sequance, one per frame for your 100 
frames. If you change to 200 frames, each images will be used twice. If 
you use less frames, then some images will be skipped.

Alain


Post a reply to this message

From: Christoph Hormann
Subject: Re: changing output file in script
Date: 14 May 2004 04:10:02
Message: <c81uol$21i$2@chho.imagico.de>
Sally wrote:
> I dont need to change the clock variable in the .pov file, its changing
> normally as I want it, but I want the texture to depend on it. I could
> have a huge "switch" like statement with each filename, but then it
> doesn't adapt to each file automatically.

What does this have to do with changing the *output* file name from 
within the scene?

> And I'd prefer not to use batch files but its so far the only solution I
> have seen (and ty for that solution by the way).

As said you can use the internal animation loop but you would need to 
handle the list of image files you want to read somehow (either via 
#read function or as an array of strings)

Christoph

-- 
POV-Ray tutorials, include files, Sim-POV,
HCR-Edit and more: http://www.tu-bs.de/~y0013390/
Last updated 01 May. 2004 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: Alain
Subject: Re: changing output file in script
Date: 14 May 2004 06:05:13
Message: <40a499d9$1@news.povray.org>
Christoph Hormann nous apporta ses lumieres ainsi en ce 2004/05/14 
04:07... :

> Sally wrote:
>
>> I dont need to change the clock variable in the .pov file, its changing
>> normally as I want it, but I want the texture to depend on it. I could
>> have a huge "switch" like statement with each filename, but then it
>> doesn't adapt to each file automatically.
>
>
> What does this have to do with changing the *output* file name from 
> within the scene?

If you do an animation, then POV Ray will sequantialy change the image 
file's name by apending a number to the name.

>
>> And I'd prefer not to use batch files but its so far the only solution I
>> have seen (and ty for that solution by the way).
>
>
> As said you can use the internal animation loop but you would need to 
> handle the list of image files you want to read somehow (either via 
> #read function or as an array of strings)
>
> Christoph
>
Or construct the name by concatenation using the clock value.

Alain


Post a reply to this message

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