diff --git a/model.blend b/model.blend index 66f8bec..ec9270e 100644 Binary files a/model.blend and b/model.blend differ diff --git a/render.cmd b/render.cmd new file mode 100644 index 0000000..e2a8f18 --- /dev/null +++ b/render.cmd @@ -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 \ No newline at end of file diff --git a/render.py b/render.py new file mode 100644 index 0000000..54d85ec --- /dev/null +++ b/render.py @@ -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!") \ No newline at end of file diff --git a/src/graphics/black.png b/src/graphics/black.png index 24be46d..df1a1fa 100644 Binary files a/src/graphics/black.png and b/src/graphics/black.png differ diff --git a/src/graphics/cyan.png b/src/graphics/cyan.png index d0b422f..282c72e 100644 Binary files a/src/graphics/cyan.png and b/src/graphics/cyan.png differ diff --git a/src/graphics/green.png b/src/graphics/green.png index 609e747..e95241a 100644 Binary files a/src/graphics/green.png and b/src/graphics/green.png differ diff --git a/src/graphics/purple.png b/src/graphics/purple.png index 22cf038..0e646fd 100644 Binary files a/src/graphics/purple.png and b/src/graphics/purple.png differ diff --git a/src/graphics/red.png b/src/graphics/red.png index c20b034..2664d93 100644 Binary files a/src/graphics/red.png and b/src/graphics/red.png differ diff --git a/src/graphics/white.png b/src/graphics/white.png index 015f0d4..7235f28 100644 Binary files a/src/graphics/white.png and b/src/graphics/white.png differ diff --git a/src/graphics/yellow.png b/src/graphics/yellow.png index 80910e0..4a387fd 100644 Binary files a/src/graphics/yellow.png and b/src/graphics/yellow.png differ