Looping through 9000 individual .pov files to create 9000 individual png

417 Views Asked by At

This question has been asked a lot but no solution seems to match the questions asked!

I have 9000 pov ray files numbered frame0001.pov frame0002.pov frame0003.pov ... frame9000.pov

They each define a frame of an animation (that is put together from the resulting png files with quicktime pro). Currently I am using the batch upload to render 500 "per session" but this not efficient as I have to add 500 to the batch each time (I can't do this while I'm sleeping!).

This solution seems to be what I need but I need some more explanation on how to write the loop to render each individual .pov frame separately (they are all independent of each other)

Render multiple files in POV-Ray (Windows)

Input_File_Name="frame0001.pov"
Width = 720

Height = 400
Antialias = On
Antialias_Threshold = 0.03
Output_File_Type = N

Initial_Frame = 1
Final_Frame = 9000

Subset_Start_Frame = 1
Subset_End_Frame = 10

#if(frame_number=1)
#include "frame0001.pov"
#end

#if(frame_number=2)
#include "frame0002.pov"
#end

#if(frame_number=3)
#include "frame0003.pov"
#end

#if(frame_number=4)
#include "frame0004.pov"
#end

etc...

I'm banging my head on a wall and soon there will be no wall left :(

1

There are 1 best solutions below

1
On

Banging seemed to be the solution. Solution found myself!

Here goes for all those who also don't really know what they are doing with povray for windows:

You have this problem:

You have thousaneds of .pov files to render individually but batch upload only allows 500 in the queue at a time. You don't want to wake up every hour to add more files and you don't know anything about batch or ini files. Your files are named "yournameXXXX.pov". where XXXX is the frame number

Note: for the first frame your file must be called "yourname0001.pov" not just "yourname1.pov" notice the leading digits

Solution:

  1. Open text edit and create a file anyname.ini
  2. Write in that text file

    Input_File_Name="yourname.pov"
    Width = 720
    Height = 400
    Antialias = On
    Antialias_Threshold = 0.03
    Output_File_Type = N
    Initial_Frame = 1
    Final_Frame = 9000

when you run this file pov ray will use the settings you provide here for each of you rendered scenes, so you can change them as required. You just need to set Initial_Frame and Final_Frame to the number of the first and last in your sequence. You can also set the Subset here if you only want to render some of the files (good for testing this out). For each frame between initial and final, povray is going to look for your "yourname.pov" file, which we are about to create.

  1. Create a new text edit file named "yourname.pov"
  2. Write in the "yourname.pov" text file:

    # include concat("yourname", str(frame_number, -4, 0) ".pov"

only that one line is required! This is the clever part. Povray will call this file for each scene between initial and final. It will also bring with it a frame_number. for each frame the concat will construct the correct file to look for for each frame. the str(frame_number, -4, 0) will create the correct 4 digit number of the file. If you have more or less digits than 4 in the name then change the -4 appropriately.

  1. Save both these files in the folder where your "yournameXXXX.pov" files are

  2. Open the anyname.ini with povray and run that file

  3. The resulting png's will be created in the same directory as yournameXXXX.png

Done