Add more general shape description.

This commit is contained in:
jmsgrogan 2017-10-24 20:18:12 +01:00
parent cfb558e540
commit 422f458469
27 changed files with 234 additions and 106 deletions

View file

Binary file not shown.

View file

@ -1,22 +1,23 @@
import bpy
def setup_renderer(engine="CYCLES"):
def setup_renderer(shape_parameters, engine="CYCLES"):
# Set up and do the render
this_scene = bpy.context.scene
if engine=="CYCLES":
bpy.context.scene.render.engine = 'CYCLES'
bpy.context.scene.cycles.device = 'GPU'
bpy.context.scene.cycles.samples = 12.0
bpy.context.scene.cycles.caustics_reflective = False
bpy.context.scene.cycles.caustics_refractive = False
bpy.context.scene.cycles.max_bounces = 0.0
bpy.data.scenes["Scene"].render.use_border = False # Tell Blender to use border render
bpy.data.scenes["Scene"].render.border_max_y = 0.75 # Set the border top at 3/4 of the image's height
bpy.data.scenes["Scene"].render.border_min_y = 0.33 # Set the border bottom at 1/3 of the image's height
bpy.data.scenes["Scene"].render.border_min_x = 0.25 # Set the border left at 1/4 of the image's width
bpy.data.scenes["Scene"].render.border_max_x = 0.65 # Set the border right at the image's right border
bpy.context.scene.render.resolution_x = 600.0
bpy.context.scene.render.resolution_y = 600.0
bpy.context.scene.render.tile_x = 32
bpy.context.scene.render.tile_y = 32
bpy.context.scene.render.resolution_percentage = 50.0
this_scene.render.engine = 'CYCLES'
this_scene.cycles.device = 'GPU'
this_scene.cycles.samples = 12.0
this_scene.cycles.caustics_reflective = False
this_scene.cycles.caustics_refractive = False
this_scene.cycles.max_bounces = 0.0
this_scene.render.use_border = False
this_scene.render.border_max_y = 0.75
this_scene.render.border_min_y = 0.33
this_scene.render.border_min_x = 0.25
this_scene.render.border_max_x = 0.65
this_scene.render.resolution_x = 600.0
this_scene.render.resolution_y = 600.0
this_scene.render.tile_x = 32
this_scene.render.tile_y = 32
this_scene.render.resolution_percentage = 50.0

View file

@ -1,38 +1,38 @@
import math
import bpy
def initialize_scene():
def initialize_scene(shape_parameters):
# Set up scene
objs = bpy.data.objects
bpy.data.scenes['Scene'].objects.unlink(objs["Cube"])
objs.remove(objs["Cube"])
def setup_scene():
def setup_scene(shape_parameters):
# Set up world
bpy.context.scene.world.use_sky_paper = True
bpy.context.scene.world.horizon_color = (0.58, 0.58, 0.58)
bpy.context.scene.world.horizon_color = (0.99, 0.8, 0.8)
#bpy.context.scene.world.light_settings.use_environment_light = True
# Add back wall
# bpy.ops.mesh.primitive_plane_add(radius=20, location=(-10.0, 0.0, 0.0))
# bpy.ops.transform.rotate(value=math.pi/2.0, axis=(0.0,1.0,0.0))
# bpy.data.objects["Plane"].name = "back_wall"
# mat = bpy.data.materials.get("backwall-material")
# if mat is None:
# mat = bpy.data.materials.new("backwall-material")
# mat.diffuse_color = (0.25, 0.25, 0.25)
# mat.specular_color = (0.25, 0.25, 0.25)
# mat.diffuse_intensity = 1.0
# mat.specular_intensity = 1.0
# bpy.context.scene.objects.active = bpy.data.objects["back_wall"]
# if bpy.context.active_object.data.materials:
# # assign to 1st material slot
# bpy.context.active_object.data.materials[0] = mat
# else:
# # no slots
# bpy.context.active_object.data.materials.append(mat)
bpy.ops.mesh.primitive_plane_add(radius=20, location=(-10.0, 0.0, 0.0))
bpy.ops.transform.rotate(value=math.pi/2.0, axis=(0.0,1.0,0.0))
bpy.data.objects["Plane"].name = "back_wall"
mat = bpy.data.materials.get("backwall-material")
if mat is None:
mat = bpy.data.materials.new("backwall-material")
mat.diffuse_color = (0.25, 0.25, 0.25)
mat.specular_color = (0.25, 0.25, 0.25)
mat.diffuse_intensity = 1.0
mat.specular_intensity = 1.0
bpy.context.scene.objects.active = bpy.data.objects["back_wall"]
if bpy.context.active_object.data.materials:
# assign to 1st material slot
bpy.context.active_object.data.materials[0] = mat
else:
# no slots
bpy.context.active_object.data.materials.append(mat)
# Set up cameras
bpy.data.objects["Camera"].location = (10.0, 0.0, -1)
@ -41,7 +41,8 @@ def setup_scene():
bpy.data.objects["Camera"].rotation_mode = 'XYZ'
bpy.data.objects["Camera"].rotation_euler[0] = math.pi/2.0
bpy.data.objects["Camera"].rotation_euler[1] = 0.0
bpy.data.objects["Camera"].rotation_euler[2] = math.pi/2.0
# todo tilt down further for light render
bpy.data.objects["Camera"].rotation_euler[2] = math.pi/2.0
# Lamps
bpy.data.scenes['Scene'].objects.unlink(bpy.data.objects["Lamp"])