Showing posts with label batch. Show all posts
Showing posts with label batch. Show all posts

Friday, 13 March 2009

Tip: ad hoc scripting #1 - batch rendering multiple .flame files

Following on from the previous tip, this becomes a very simple but powerful tool to enhance lengthy unattended rendering, ideal for setting up before a weekend away. With reference to the previous tip, [script code] represents the chosen block of script for rendering the contents of a single .flame file. The choice of method may be varied for each .flame file. The following code will render the content of three .flame files in a single run:

SetFlameFile('full path\filename1.flame');
[script code]
SetFlameFile('full path\filename2.flame');
[script code]
SetFlameFile('full path\filename3.flame');
[script code]

The snippet may be stored in a text file and then amended and copied to the clipboard (Ctrl-C). In Apophysis, open the script editor (Ctrl-D), click New and paste (Ctrl-V), then click Run. This way, you don't end up with a load of stored scripts that won't be used again.

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.