lib/glitch3d/bpy/rendering.py in glitch3d-0.2.2.2 vs lib/glitch3d/bpy/rendering.py in glitch3d-0.2.2.3
- old
+ new
@@ -20,15 +20,16 @@
shots_number = int(args.shots_number)
FIXTURES_FOLDER_PATH = path + '/../fixtures/'
DEBUG = False
-FISHEYE = False
+FISHEYE = True
COLORS = rand_color_palette(5)
-INITIAL_CAMERA_LOCATION = (8, 8, 1)
+INITIAL_CAMERA_LOCATION = (4, 4, 1)
ANIMATE = False
+# DEBUG = True
if DEBUG:
shots_number = 2
import os
mode = 'low'
file = "/Users/pascal/dev/glitch3d/fixtures/skull.obj"
@@ -44,12 +45,12 @@
# Initialize groups
for primitive in PRIMITIVES:
bpy.data.groups.new(primitive.lower().title())
# Render settings
-context.scene.render.resolution_x = 1920
-context.scene.render.resolution_y = 1080
+context.scene.render.resolution_x = 2000
+context.scene.render.resolution_y = 2000
context.scene.render.engine = 'CYCLES'
context.scene.render.resolution_percentage = 25
# uncomment if GPU
# bpy.context.scene.cycles.device = 'GPU'
context.scene.render.image_settings.compression = 0
@@ -61,11 +62,13 @@
context.scene.render.image_settings.compression = 90
context.scene.cycles.samples = 400
context.scene.render.resolution_percentage = 100
# Add background to world
-bpy.data.worlds.remove(bpy.data.worlds[0])
+
+# This shit doesnt work in v 2.76
+# bpy.data.worlds.remove(bpy.data.worlds[0])
world = bpy.data.worlds.new('A Brave New World')
world.use_nodes = True
world_node_tree = world.node_tree
context.scene.world = world
@@ -105,19 +108,19 @@
camera_object.location = INITIAL_CAMERA_LOCATION
if FISHEYE:
camera_object.data.type = 'PANO'
camera_object.data.cycles.panorama_type = 'FISHEYE_EQUISOLID'
- camera_object.data.cycles.fisheye_lens = 8
- camera_object.data.cycles.fisheye_fov = 2.27
- camera_object.data.sensor_width = 15.81
- camera_object.data.sensor_height = 8.88
+ camera_object.data.cycles.fisheye_lens = 12
+ camera_object.data.cycles.fisheye_fov = 2.5
+ camera_object.data.sensor_width = 20
+ camera_object.data.sensor_height = 20
# Add reflectors
bpy.ops.mesh.primitive_plane_add(location=(0,8 + REFLECTOR_LOCATION_PADDING, 0))
bpy.ops.mesh.primitive_plane_add(location=(8 + REFLECTOR_LOCATION_PADDING,0,0))
-bpy.ops.mesh.primitive_plane_add(location=(0, 0, 8))
+bpy.ops.mesh.primitive_plane_add(location=(0, 0, 20))
bpy.ops.mesh.primitive_plane_add(location=(0, 0, -2))
reflector1 = bpy.data.objects['Plane']
reflector2 = bpy.data.objects['Plane.001']
reflector3 = bpy.data.objects['Plane.002']
@@ -165,17 +168,24 @@
context.scene.camera = camera_object
look_at(camera_object, model_object)
# Make floor
floor = bpy.data.objects['Plane.003']
+bpy.data.groups['Plane'].objects.link(floor)
floor.scale = (20,20,20)
-texture_object(floor)
subdivide(floor, 8)
-glitch(floor)
+displace(floor)
+texture_object(floor)
OCEAN = add_ocean(10, 20)
+# Create lines
+bpy.data.groups.new('Lines')
+for i in range(0, 20):
+ new_line = create_line('line' + str(uuid.uuid1()), series(30))
+ new_line.location.z += i / 6
+
for index in range(1, len(WORDS)):
new_object = spawn_text()
props.append(new_object)
text_scale = random.uniform(0.75, 2)
make_object_glossy(new_object, GREY)
@@ -189,11 +199,11 @@
unwrap_model(plane)
for obj in WIREFRAMES:
wireframize(obj)
-if ANIMATE == True:
- exec(open(os.path.join(os.path.dirname(__file__), 'animation_recording.py')).read())
+look_at(camera_object, model_object)
+model_object.location.z += 2
# ------
# Shoot
# ------
print('Rendering images with resolution: ' + str(context.scene.render.resolution_x) + ' x ' + str(context.scene.render.resolution_y))