POV-Ray : Newsgroups : povray.newusers : batch data output : Re: batch data output Server Time
4 Jul 2024 14:57:06 EDT (-0400)
  Re: batch data output  
From: Alain
Date: 7 Oct 2010 15:38:03
Message: <4cae219b$1@news.povray.org>

> Hi all
>
> Thanks to lots of help from you guys on here, I have now managed to write a
> POVRAY file to read a greyscale tiff file and produce a height_field to
> represent it in 3 dimensions.
>
> I have written the following code:
>
>
>   #include "colors.inc"
>    camera {
>          location<1, 2, -1.5>
>      look_at<0.25, 0, 1>
>      angle 30}
>
> background { color Gray } // to make the torus easy to see
>
>   light_source {<5, 8, -5>  White}
>
> height_field{
>        tiff
>        "map0001.tif"
>           smooth
>            texture{
>            pigment{
>                 gradient y
>                 color_map{
>                         [0.0 rgb<0.2,0,0>]
>                         [0.5 rgb<0.5,0.2,0>]
>                         [1.0 rgb<1,1,1>]
>                          }
>                   }
>               finish{ambient .2 diffuse .8}
>              }
>                     scale<0,0.025,0>
>         translate<0,0.5,0>
>      }
>
>
> I now wish to get POVRAY to automatically read a list of 1000 map####.tif files
> (each one with a consecutive file number: i.e. map0001.tif, map0002.tif,
> map0003.tif, etc, etc) to then produce 1000 map####.bmp files (POVRAY rendered,
> of course!).
>
> Alain has kindly given me the following code for concat, but I am now not 100 %
> sure how to apply this to my POVRAY code to get me exactly what I want:
>
>   concat("map", str(frame_number,-4,0)),".tif")
>
> Please can somebody help me just to finish off this last bit of coding required?
>
> Many thanks for all your help so far.
>
> Colaroid
>
>
When you use that in an amimation, the internal variable "frame_number" 
contains a value representing the number of the current frame been rendered.

If you use it in place of the ordinary file's name, then, for each 
frame, POV-Ray will read the corresponding source image.
Sample code:

[begining of your code]
height_field{
       tiff
       concat("map", str(frame_number,-4,0)),".tif")
          smooth
[rest of your code]

Then, on the command line, you put "+kff1000" to invoque the animation loop.
Under windows and I think mac OS, the command line is the text box next 
to the resolutions list.

The output images will be named scene0001, scene0002,... with an 
extention according to the file format you chosed for the output.

If you want to test outside of an animation, you'll need a file named 
map0000.tif or use:
tiff
  #if(frame_number = 0)
   "map0001.tif"
#else
   concat("map", str(frame_number,-4,0)),".tif")
#end
smooth

This will use your first image for testing outside an animation.




Alain


Post a reply to this message

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