Saturday, 7 March 2009

Tip: batch rendering

Historically, this was always accomplished using a script, whether with the internal renderer or flam3. We now have a bulit-in batch rendering command, plus I have my own custom (script) method. Which method to use depends very much on one's preferred workflow. Essentially, we can divide this into two groups:

1. All renders share the basic rendering parameters.
2. Each render has individual requirements.

Case #1 is simple: its simplest solution is to use the bulit-in method Flame, Render All Flames (Ctrl-Alt-R), offering the usual dialogue for setting parameters. Scripted, the equivalent is:

Renderer.Width := ##;
Renderer.Height := ##;
for i := 0 to FileCount - 1 do
begin
LoadFlame(i);
Flame.SampleDensity := ##;
Flame.Oversample := ##;
Flame.FilterRadius := ##;
Renderer.Filename :='path' + Flame.Name + '.ext';
SetRenderBounds;
Render;
end;
UpdateFlame := False;

where ##, path and ext should be specified as desired.

To render the contents of a .flame file other than the current one, simply precede the code with:

SetFlameFile('full path\filename.flame');

Case #2 requires a little more work, but provides more flexibility. Each parameter set would require saving with the desired dimensions, set on the Image Size tab of the Adjust dialogue (make sure to click Apply). The script code would then read:

for i := 0 to FileCount - 1 do
begin
LoadFlame(i);
Renderer.Width := Flame.Width;
Renderer.Height := Flame.Height;
Flame.SampleDensity := ##;
Flame.Oversample := ##;
Flame.FilterRadius := ##;
Renderer.Filename :='path' + Flame.Name + '.ext';
SetRenderBounds;
Render;
end;
UpdateFlame := False;

But there is no easy way to set individual values for quality, oversample and filter radius, other than editing the .flame file manually, either with a text or XML editor. To this end, I developed a spreadsheet in which values for each parameter set are entered into adjacent cells, then a button pressed that copies the code to form a consecutive set of instructions, like this:

LoadFlame(0);
Renderer.Width := 6000;
Renderer.Height := 6000;
Flame.FilterRadius := 1.2;
Flame.Oversample := 1;
Flame.SampleDensity := 1000;
Renderer.Filename := 'C:\Program Files\Apophysis 2.0\Prints\' + Flame.Name + '.jpg';
SetRenderBounds;
Render;
LoadFlame(1);
Renderer.Width := 6000;
Renderer.Height := 6000;
Flame.FilterRadius := 0.8;
Flame.Oversample := 1;
Flame.SampleDensity := 500;
Renderer.Filename := 'C:\Program Files\Apophysis 2.0\Prints\' + Flame.Name + '.jpg';
SetRenderBounds;
Render;
.
.
.
etc.

This takes very little time and provides complete flexibility for parameter choice for unattended rendering.

No comments: