Add rendering pipeline

Add render script that renders all of the bottles into the graphics
directory.
This commit is contained in:
Hornwitser 2019-12-05 22:56:16 +01:00
parent b02e943171
commit aa61ba5b69
10 changed files with 43 additions and 0 deletions

Binary file not shown.

2
render.cmd Normal file
View file

@ -0,0 +1,2 @@
REM Pass the path to blender as the first argument
%1 --background --python-exit-code 1 model.blend --python render.py

41
render.py Normal file
View file

@ -0,0 +1,41 @@
import bpy
base_collection = bpy.data.scenes["Base"].view_layers["RenderLayer"].layer_collection
highlight_collection = bpy.data.scenes["Toon Highlight"].view_layers["RenderLayer"].layer_collection
shadows_collection = bpy.data.scenes["Toon Shadows"].view_layers["RenderLayer"].layer_collection
def set_exclude(color, model, value):
base_collection.children[color].exclude = value
highlight_collection.children[f"Highlight {model}"].exclude = value
shadows_collection.children[f"Shadows {model}"].exclude = value
def render_bottle(color, model, output):
set_exclude(color, model, False)
bpy.data.scenes["Base"].render.filepath = output
bpy.ops.render.render(write_still=True)
set_exclude(color, model, True)
bottles = [
["Red", "Cone", "//src/graphics/red.png"],
["Green", "Cube", "//src/graphics/green.png"],
["Black", "Spiked", "//src/graphics/black.png"],
["Cyan", "Sphere", "//src/graphics/cyan.png"],
["Purple", "Cylinder", "//src/graphics/purple.png"],
["Yellow", "Hexagon", "//src/graphics/yellow.png"],
["White", "Tubes", "//src/graphics/white.png"],
]
# Set active scene so the highlights/shadows isn't accidentally rendered
bpy.context.window.scene = bpy.data.scenes["Base"]
# Reset visibility of all bottles
for color, model, output in bottles:
set_exclude(color, model, True)
# Render the bottles
for color, model, output in bottles:
render_bottle(color, model, output)
print("Done!")

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Before After
Before After