Example: Export
Now that you can already prepare a JSON generating a few animation frames, let's try to export all Rebelle data layers for each animation frame.
We're going to add an oil stroke to the Quickstart example to have some meaningful data also in the bump
layer.
Download project files
- example_export.json - Animation commands for Rebelle
- out.zip - Out folder with exported animation frames for all data layers
Prepare a JSON file for Rebelle
Save the following file as example_export.json
(or download it from the link above).
{"frames":[
{"events":[
{
"event_type": "NEW_ARTWORK",
"width": 640,
"height": 480,
"units": "px",
"dpi": 200,
"paper": {
"preset": "Default/HM01 Handmade",
"color": { "r": 255, "g": 255, "b": 255 },
"deckled_edges": true,
"paper_scale": 150
}
},
{
"event_type": "SET_BRUSH",
"tool": "WATERCOLOR",
"preset": "Gouache/Gouache Filbert",
"size" : 40,
"water": 55,
"opacity": 10,
"paint_type": "PAINT",
"glaze_mode": "OPAQUE",
"color": { "r": 64, "g": 127, "b": 200 }
},
{ "event_type": "POINTER_PRESS" , "pos": { "x": 100, "y": 100 } },
{ "event_type": "POINTER_MOVE" , "pos": { "x": 200, "y": 200 } },
{ "event_type": "POINTER_MOVE" , "pos": { "x": 300, "y": 100 } },
{ "event_type": "POINTER_MOVE" , "pos": { "x": 400, "y": 300 } },
{ "event_type": "POINTER_RELEASE", "pos": { "x": 400, "y": 300 } }
]},
{"events":[
{ "event_type": "SIMULATION", "repeats": 10 }
]},
{"events":[
{ "event_type": "SIMULATION", "repeats": 10 }
]},
{"events":[
{
"event_type": "SET_BRUSH",
"tool": "OIL_AND_ACRYLIC",
"preset": "Round/Thick Hairy",
"size" : 40,
"paint_type": "PAINT",
"color": { "r": 127, "g": 64, "b": 200 }
},
{ "event_type": "POINTER_PRESS" , "pos": { "x": 100, "y": 200 } },
{ "event_type": "POINTER_MOVE" , "pos": { "x": 200, "y": 300 } },
{ "event_type": "POINTER_MOVE" , "pos": { "x": 300, "y": 200 } },
{ "event_type": "POINTER_MOVE" , "pos": { "x": 400, "y": 400 } },
{ "event_type": "POINTER_RELEASE", "pos": { "x": 400, "y": 400 } }
]},
{"events":[
{ "event_type": "SIMULATION", "repeats": 10 }
]},
{"events":[
{ "event_type": "SIMULATION", "repeats": 10 }
]}
]}
Run Rebelle
Tell Rebelle to process the JSON file and generate animation frames of all exportable data layers to the out/
folder.
mkdir out
"C:/Program Files/Rebelle 7 Motion IO/Rebelle 7 Motion IO.exe" \
-batch-json "example_export.json" \
-batch-out-rgba "out/rgba_####.png" \
-batch-out-rgba_dry "out/rgba_dry_####.exr" \
-batch-out-rgba_wet "out/rgba_wet_####.exr" \
-batch-out-bump "out/bump_####.exr" \
-batch-out-bump_dry "out/bump_dry_####.exr" \
-batch-out-bump_wet "out/bump_wet_####.exr" \
-batch-out-water "out/water_####.exr" \
-batch-out-wetness "out/wetness_####.exr" \
-batch-out-velocity "out/velocity_####.exr"
Convert animation frames to a video
png_size="640x480"
num_frames=$(ls out/rgba_????.png | wc -l)
framerate=1
duration=$(echo "scale=2; $num_frames / $framerate" | bc)
ffmpeg -y -framerate $framerate -i "out/rgba_%04d.png" -vf "color=white:size=${png_size} [bg]; [bg][0:v] overlay" -c:v libx264 -preset slow -crf 18 -t "$duration" "example_export.mp4"