Template pipeline for individual, small-team sized Blender project development.
Build | Status |
---|---|
Sample PR Render Build | |
Sample Full Render Build | |
Docker Container Creation Build |
This uses Docker to run a small image of blender into a Github Action that has staged rendering. The Stages in rendering are tightly coupled with the animator's workflow in mind.
Site | URL |
---|---|
Docker Container | https://hub.docker.com/r/tennisgazelle/blender-pipeline |
Website Repo | https://github.com/TennisGazelle/baap-website |
Website | https://github.com/TennisGazelle/blender-pipeline |
Needed to be installed/configured on your local machine.
- python3
- pyyaml
- blender (technically optional)
- docker
- You may run
./scripts/install_docker_linux.sh
if you are using a linux machine.
- You may run
Copy this repo's contents to your projects workdir.
Place your blender files into blender/
and your image resource files into imgs/resources
. Be sure to relink everything.
A stage is a specific rendering configuration, details in config.yaml
, consisting of at least one blender file to be rendered.
The information held in such a stage includes:
scene:
buffer_frames: 1-9,11-20 # frames 1 through 20 except 10
force_update: false # force frame to rerender, even if file exists
render_output: 'imgs/buffer/' # where to put the output of that file
engine: CYCLES # EEVEE support coming soon
blend_file: scene.blend # the blend file in question
render_format: PNG # what format the output should be in
blender_flags: '' # parameters for blender to be used in the docker call
file_output_format: '{bfile}_{stage}_####'
for
blender_flags:
, use flags found for blender arguments found here
file_output_format
arguments:
Arg Desc bfile
Blender file stage
Name of stage ####
Frame number
In this project, Stage scene
refers to the blend file that contains the models/textures to be build, and stage edit
includes the blender file with post processing.
A model is reference to an OBJ file outputted by a 3D modeler, void of static (image) and dynamic (procedural) texture information. A model may be autorendered in turnstyle format based on configuration as defaulted below:
models:
- cool_cube:
obj_file: 'blender/models/curve-skeleton-cube.obj'
render_output: 'imgs/out/models/'
scaling_factor: 1 # default (1)
remove_doubles: true # default (false)
edge_split: false # default (false)
depth_scale: 1.4 # default (1.4)
color_depth: 8 # default (8)
format: PNG # default PNG
video: false # default (false); if true, format is ____ and rotation_iteration will be 5 sec rotation at 30 fps (150)
resolution: 600 # is square; default (600)
rotation_iterations: 30 # default 6
include:
- color # default only one active
- depth
- normal
- albedo
- id
model_output_format: '{model}_{angle}_{map}
model_output_format
arguments:
Arg Desc model
name of model (ex. 'cool_cube') objfile
Object file angle
Angle of Camera [0-360) map
which type of map it is (see models.MODEL_NAME.include
options)
In this project, cool_cube
is the shape found in blender/cool_scene.blend
.
- (optional) Set up the Docker image locally (this will take some time).
docker build -t blender-pipeline scripts/
You can also just download the image to save time
docker pull tennisgazelle/blender-pipeline:latest
- If you just downloaded this project, first set the paths of your working directory.
make set_paths
You can verify the output of this with make get_paths
- Render the scene stage
make scene_render
- Render the post processing stage (edit)
make edit_render
Raw, individual frames will populate in imgs/buffer/ without post processing. A video file will be found in imgs/out/ with post processing.
- ikester/blender - Dockerfile that has Blender in it
- dolphinkiss/blender-python-docker - Similar to above; Dolphin Kiss's implementation is also simple and easy to understand.
- Raymond Lo - Article helping detail how to write one's own blender-based dockerfile and how to get dependencies in it.
- Amber Wilkie - FreeCodeCamp - Calling webhooks from Github Actions.
- Stack Overflow/Stack Exchange
mvoelk
's fork of Stanford Shapenet Render - Object rendering suite for modelers- Props to both Stanford researchers and Github user
mvoelk
for his update for Blender 2.9 - For Help: https://blender.stackexchange.com/questions/43346/how-do-you-set-the-current-image-as-far-as-bpy-is-concerned
- Blender docs:
- Props to both Stanford researchers and Github user
- https://towardsdatascience.com/how-to-properly-use-the-gpu-within-a-docker-container-4c699c78c6d1
- https://tabreturn.github.io/code/blender/python/2020/11/01/a_quick_intro_to_blender_creative_coding-part_3_of_3.html
https://blender.stackexchange.com/questions/104651/selecting-gpu-with-python-script