git @ Cat's Eye Technologies kinoje / 9fe8148
Add swirled example, which demonstrates overriding the render command template. Also improve the README. Chris Pressey 8 years ago
2 changed file(s) with 85 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
66 frame of the animation; the result of the template expansion is used to create a still image; and
77 the resulting sequence of images is compiled into the finished movie.
88
9 Quick Start
10 -----------
11
912 The following are required:
1013
11 * Python 2.7 — to run the script
12 * PyYAML and Jinja2 — to fill out the templates
13 * POV-Ray or Inkscape — to create the images from the filled-out templates
14 * ffmpeg or ImageMagick — to compile the images into a movie file
14 * **Python** 2.7 — to run the script
15 * **PyYAML** and **Jinja2** — to fill out the templates
16 * something to create images from filled-out templates — typically **POV-Ray** or **Inkscape**
17 * **ffmpeg** or **ImageMagick** — to compile the images into a movie file
1518
1619 You might also find VLC useful, for viewing the final movie file.
1720
2225
2326 You can then run the tool from the repository directory like so:
2427
25 bin/kinoje eg/moebius.yaml -o moebius.mp4
28 bin/kinoje eg/moebius.yaml
2629
27 You can also ask it to create a GIF by using that file extension:
30 Since no output filename was given, kinoje assumes MP4 format and automatically picks a reasonable
31 filename, in this case `moebius.mp4`.
2832
29 bin/kinoje eg/squares.yaml --output=squares.gif --duration=2.0
33 You can also ask it to create a GIF by specifying an output filename with that as its file extension:
34
35 bin/kinoje eg/squares.yaml -o squares.gif --duration=2.0
36
37 File Format
38 -----------
39
40 The input YAML file must contain, at the minimum, a key called `template` giving a string (typically
41 a multi-line string) in Jinja2 syntax, which will be filled out once for each frame.
42
43 The context with which it will be filled out is constructed as follows:
44
45 * `t` is a floating point value which will vary from 0.0 on the first frame to 1.0 on the last
46 frame. It is this value which will typically drive the animation. For example, if the animation
47 consists of moving a circle from x=0 to x=10, the part of the template which gives the x
48 co-ordinate of the circle would be written as `{{ t * 10.0 }}`.
49
50 And actually this is not 100% true. `t` would be 1.0 on the frame after the last frame
51 which, by definition, is never rendered. On the last frame, it is 1.0 less a small value,
52 which we could call the t-delta, and which varies based on the duration and the frame rate.
53
54 * `math`, which is Python's math module, and which can be used to access functions such as `sin`.
55
56 * `tween`, which is a function which is currently undocumented.
57
58 * `fmod`, which is a function which is currently undocumented.
59
60 Other configuration options:
61
62 * `duration` gives the duration, in seconds, to make the movie. If omitted, it needs to be
63 supplied on the command-line with the `--duration` option.
3064
3165 No further documentation on how to use the tool will be given, as it is all very subject to change
3266 right now.
0 render_command_template: povray -D +I{infile} +O{outfile}z.png +W{width} +H{height} +A && convert {outfile}z.png -swirl 80 {outfile}
1 template: |-
2 global_settings { assumed_gamma 2.2 }
3
4 #include "colors.inc"
5 #include "textures.inc"
6 #include "stones.inc"
7 #include "finish.inc"
8 #include "glass.inc"
9
10 light_source {
11 <-20, 50, 0>
12 color White
13 }
14
15 camera {
16 location <0, 15, -15>
17 look_at <0, 5, 0>
18 }
19
20 plane { y, 0
21 pigment {
22 checker color White, color Black
23 scale 4
24 }
25 finish {
26 ambient 0.25
27 }
28 }
29
30 sphere {
31 <0, {{ t * 15.0 }}, 0>, {{ t * 15.0 }}
32
33 material {
34 texture {
35 pigment { color rgbf <0.98, 1.0, 0.99, 0.75> }
36 finish {
37 F_Glass4
38 ambient 0.25
39 }
40 }
41 interior { I_Glass caustics 1 }
42 }
43 }