Upgrade lighting setup and change to 600x600 px.

This commit is contained in:
jmsgrogan 2017-10-24 10:19:14 +01:00
parent d4ac6705e5
commit 565ded39fc
28 changed files with 157 additions and 91139 deletions

View file

@ -5,14 +5,15 @@ def setup_renderer(engine="CYCLES"):
# Set up and do the render
if engine=="CYCLES":
bpy.context.scene.render.engine = 'CYCLES'
bpy.context.scene.cycles.samples = 30.0
bpy.context.scene.cycles.samples = 24.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 = True # Tell Blender to use border render
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.resolution_percentage = 100.0

View file

@ -1,3 +1,4 @@
import math
import bpy
def initialize_scene():
@ -11,11 +12,76 @@ def setup_scene():
# Set up world
bpy.context.scene.world.use_sky_paper = True
bpy.context.scene.world.horizon_color = (0.95, 0.95, 0.95)
bpy.context.scene.world.horizon_color = (0.58, 0.58, 0.58)
#bpy.context.scene.world.light_settings.use_environment_light = True
# Set up lamps and cameras
bpy.data.objects["Lamp"].location = bpy.data.objects["Camera"].location
bpy.data.objects["Lamp"].delta_location = (-3, 0, -3)
#bpy.data.objects["Lamp"].type = "POINT"
bpy.data.objects["Lamp"].name = "front"
# 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.5, 0.5, 0.5)
mat.specular_color = (0.5, 0.5, 0.5)
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)
fov = 65.0
bpy.data.objects["Camera"].data.angle = fov*(math.pi/180.0)
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
# Lamps
bpy.data.scenes['Scene'].objects.unlink(bpy.data.objects["Lamp"])
bpy.data.objects.remove(bpy.data.objects["Lamp"])
bpy.ops.mesh.primitive_plane_add(radius=5, location=(10.0, -10.0, 5.0))
bpy.ops.transform.rotate(value=math.pi/2.0, axis=(1.0,2.0,0.0))
bpy.data.objects["Plane"].name = "key_lamp"
mat = bpy.data.materials.get("key-material")
if mat is None:
mat = bpy.data.materials.new("key-material")
mat.use_nodes = True
mat.node_tree.nodes.new('ShaderNodeEmission')
inp = mat.node_tree.nodes["Material Output"].inputs["Surface"]
outp = mat.node_tree.nodes["Emission"].outputs["Emission"]
mat.node_tree.nodes['Emission'].inputs[1].default_value = 30.0
mat.node_tree.links.new(inp, outp)
bpy.context.scene.objects.active = bpy.data.objects["key_lamp"]
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=5, location=(10.0, 10.0, -5.0))
bpy.ops.transform.rotate(value=-math.pi/2.0, axis=(1.0,2.0,0.0))
bpy.ops.transform.rotate(value=-math.pi/4.0, axis=(0.0,0.0,1.0))
bpy.data.objects["Plane"].name = "fill_lamp"
mat = bpy.data.materials.get("fill-material")
if mat is None:
mat = bpy.data.materials.new("fill-material")
mat.emit = 12.0
bpy.context.scene.objects.active = bpy.data.objects["fill_lamp"]
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)