POV-Ray : Newsgroups : povray.advanced-users : Get image file name from the code : Re: Get image file name from the code Server Time
8 Jul 2024 18:39:22 EDT (-0400)
  Re: Get image file name from the code  
From: Tim Attwood
Date: 28 Aug 2007 21:02:33
Message: <46d4c5a9$1@news.povray.org>
>I just want to create a name for the radiosity info with extension .rad but 
>with the same name than the image that is being created. I already did it 
>but I am assuming that the output file name is not changed through command 
>line options or the .ini file and also I am assuming that the number of 
>frames is not greater than a certain number. Remember that name of the 
>output of a frame not only epends on the frame number but also on the total 
>number of frames (the number of digits).
>
> I have been programming during 25 years and I learnt that assumimg things 
> in the code is not a good practice. I just wanted to be sure that 
> hardcoding the file name was the only way to do it and that there is not a 
> constant or system variable that gives the name of the file.

You can access the frame number with the frame_number system variable.
With a little bit of string manipulation you can stick the frame number onto
a hard coded name.

#declare final_radiosity = off;
#declare rname = concat("radiosity_data",str(frame_number,0,0),".dat");

global_settings {
   // settings
   #if (final_radiosity)
      radiosity {
        load_file rname
         // radiosity settings
      }
   #else
      radiosity {
         // radiosity settings
        save_file rname
      }
   #end
}

If you don't have many moving objects and are just moving the camera
around then you don't need to recalculate the all the radiosity data for
every frame... it's OK to just use load_file and save_file with a single
file, you load the file, let it calculate the "holes" in the data, then save 
the
updated file for the next frame.

#declare final_radiosity = on;

global_settings {
   // settings
   #if (final_radiosity)
      radiosity {
        load_file "radiosity_data.dat"
         // radiosity settings
        save_file "radiosity_data.dat"
      }
   #else
       // no radiosity for previews
   #end
}


Post a reply to this message

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