factorio-cb-science/render.py
Hornwitser 67a4773187 Iterate on graphics design
Improve the design, materials and lighting of the bottles and switch
arround the purple and yellow shape.
2019-12-06 18:02:31 +01:00

41 lines
No EOL
1.5 KiB
Python

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", "Pentagon", "//src/graphics/purple.png"],
["Yellow", "Cylinder", "//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!")