glitch3d 0.2.3.7 → 0.2.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/Gemfile +5 -0
- data/README.md +4 -2
- data/fixtures/base.blend +0 -0
- data/fixtures/textures/anime.jpg +0 -0
- data/fixtures/textures/jakob.jpg +0 -0
- data/fixtures/textures/putin.jpg +0 -0
- data/fixtures/textures/ship.jpg +0 -0
- data/glitch3d.gemspec +0 -2
- data/lib/glitch3d/bpy/helpers.py +39 -25
- data/lib/glitch3d/bpy/main.py +24 -13
- data/lib/glitch3d/bpy/post-processing/mosaic.py +0 -3
- data/lib/glitch3d/bpy/render_settings.py +23 -5
- data/lib/glitch3d/version.rb +1 -1
- data/lib/glitch3d.rb +3 -1
- metadata +6 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec475b255b46f4551f90beca88270427a52448a0
|
4
|
+
data.tar.gz: daa94afaa38feaf6e4adb0844c114a71ba9610c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 040645624a3c5f963ca7726b5641be2d05078ef3ba174c41d8a755e6196dd8aef8356e54f87e2887e1a4a44c64de5003f2d76444ab1f797525342ca62b28a310
|
7
|
+
data.tar.gz: 0cfc081fc9df2b94678ef2e3716d6d83f5983bf8424f023137ea78bdc6411ce487bbb194152d9b8fadbbfe062ea6a05acce5be9c3fb9793bf916569af998e1b4
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -6,11 +6,11 @@ You can read a bit more about where it come from [here](http://pascal.cc/blog/gl
|
|
6
6
|
|
7
7
|
<img src="https://raw.githubusercontent.com/pskl/glitch3d/master/fixtures/examples/demo.jpg" width="400">
|
8
8
|
|
9
|
-
This gem uses the Blender Python API to produces renders headlessly.
|
9
|
+
This gem uses the Blender Python API to produces renders headlessly. Calls made to the Blender API have been tested with versions 2.78 and 2.79.
|
10
10
|
|
11
11
|
## Warning
|
12
12
|
|
13
|
-
Setting `BLENDER_EXECUTABLE_PATH` in your environment is required.
|
13
|
+
Setting `BLENDER_EXECUTABLE_PATH` in your environment is required. In general this gem relies on the presence of Python and Blender on the host machine. I am very aware this is not standard practice and plan to split components later down the road but this proves convenient for now.
|
14
14
|
|
15
15
|
## Installation
|
16
16
|
|
@@ -58,3 +58,5 @@ Copyright © 217 PSKL <hello@pascal.cc>
|
|
58
58
|
This work is free. You can redistribute it and/or modify it under the
|
59
59
|
terms of the Do What The Fuck You Want To Public License, Version 2,
|
60
60
|
as published by Sam Hocevar. See the COPYING file for more details.
|
61
|
+
|
62
|
+
NOTE: Above license is for the code part only. Some of the materials used as fixtures could be copyrighted (models and textures). Please be careful.
|
data/fixtures/base.blend
ADDED
Binary file
|
data/fixtures/textures/anime.jpg
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/glitch3d.gemspec
CHANGED
data/lib/glitch3d/bpy/helpers.py
CHANGED
@@ -6,7 +6,7 @@ DISPLACEMENT_AMPLITUDE = random.uniform(0.02, 0.1)
|
|
6
6
|
REPLACE_TARGET = str(random.uniform(0, 9))
|
7
7
|
REPLACEMENT = str(random.uniform(0, 9))
|
8
8
|
ORIGIN = (0,0,2)
|
9
|
-
NUMBER_OF_FRAMES =
|
9
|
+
NUMBER_OF_FRAMES = 300
|
10
10
|
SCATTER_INTENSITY = 0.015
|
11
11
|
ABSORPTION_INTENSITY = 0.25
|
12
12
|
DISPLAY_SCALE = (2, 2, 2)
|
@@ -18,11 +18,16 @@ BLUE = (0.1, 0.1, 0.8, 0.4)
|
|
18
18
|
PINK = (0.8, 0.2, 0.7, 1.0)
|
19
19
|
WORDS = string.ascii_lowercase
|
20
20
|
RENDER_OUTPUT_PATHS = []
|
21
|
+
NORMALS_RENDERING = False #(random.randint(0, 1) == 1)
|
21
22
|
|
22
23
|
def pry():
|
23
24
|
code.interact(local=dict(globals(), **locals()))
|
24
25
|
sys.exit("Aborting execution")
|
25
26
|
|
27
|
+
def fetch_material(material_name):
|
28
|
+
new_material = bpy.data.materials[material_name].copy()
|
29
|
+
return new_material
|
30
|
+
|
26
31
|
# Helper methods
|
27
32
|
def look_at(obj):
|
28
33
|
location_camera = CAMERA.matrix_world.to_translation()
|
@@ -94,11 +99,14 @@ def camera_location_string(camera):
|
|
94
99
|
|
95
100
|
def assign_material(obj, material):
|
96
101
|
obj.data.materials.append(material)
|
102
|
+
return material
|
97
103
|
|
98
104
|
# Returns a new Cycles material with default DiffuseBsdf node linked to output
|
99
|
-
def create_cycles_material():
|
100
|
-
material = bpy.data.materials.new(
|
105
|
+
def create_cycles_material(name = 'Object Material - ', clean=False):
|
106
|
+
material = bpy.data.materials.new(name + str(uuid.uuid1()))
|
101
107
|
material.use_nodes = True
|
108
|
+
if clean:
|
109
|
+
flush_nodes(material)
|
102
110
|
return material
|
103
111
|
|
104
112
|
def random_texture():
|
@@ -106,6 +114,9 @@ def random_texture():
|
|
106
114
|
print("LOADING TEXTURE -> " + texture_path)
|
107
115
|
return bpy.data.images.load(texture_path)
|
108
116
|
|
117
|
+
def random_material():
|
118
|
+
return random.choice(bpy.data.materials)
|
119
|
+
|
109
120
|
def assign_texture_to_material(material, texture):
|
110
121
|
assert material.use_nodes == True
|
111
122
|
texture_node = material.node_tree.nodes.new('ShaderNodeTexImage')
|
@@ -126,8 +137,7 @@ def mix_nodes(material, node1, node2):
|
|
126
137
|
assign_node_to_output(material, mix)
|
127
138
|
|
128
139
|
def make_object_glossy(obj, color = (PINK), roughness = 0.2):
|
129
|
-
material =
|
130
|
-
material.use_nodes = True
|
140
|
+
material = create_cycles_material('Glossy Material - ')
|
131
141
|
glossy_node = material.node_tree.nodes.new('ShaderNodeBsdfGlossy')
|
132
142
|
glossy_node.inputs[0].default_value = color
|
133
143
|
glossy_node.inputs[1].default_value = roughness
|
@@ -150,27 +160,21 @@ def make_texture_object_transparent(obj, color = (1,1,1,0.5), intensity = 0.25):
|
|
150
160
|
trans.inputs[0].default_value = color
|
151
161
|
|
152
162
|
def make_object_transparent(obj):
|
153
|
-
material =
|
154
|
-
material.use_nodes = True
|
163
|
+
material = create_cycles_material('Transparent Material - ')
|
155
164
|
trans = material.node_tree.nodes.new('ShaderNodeBsdfTransparent')
|
156
165
|
trans.inputs[0].default_value = rand_color()
|
157
166
|
assign_node_to_output(material, trans)
|
158
167
|
assign_material(obj, material)
|
159
168
|
|
160
169
|
def make_object_emitter(obj, emission_strength):
|
161
|
-
emissive_material =
|
162
|
-
|
163
|
-
emission_node = emissive_material.node_tree.nodes.new('ShaderNodeEmission')
|
170
|
+
emissive_material = assign_material(obj, fetch_material('emission'))
|
171
|
+
emission_node = emissive_material.node_tree.nodes['Emission']
|
164
172
|
emission_node.inputs[0].default_value = rand_color()
|
165
173
|
emission_node.inputs[1].default_value = emission_strength
|
166
|
-
assign_node_to_output(emissive_material, emission_node)
|
167
|
-
assign_material(obj, emissive_material)
|
168
174
|
return emission_node
|
169
175
|
|
170
176
|
def make_object_gradient_fabulous(obj, color1, color2):
|
171
|
-
material =
|
172
|
-
material.use_nodes = True
|
173
|
-
assign_material(obj, material)
|
177
|
+
material = assign_material(obj, fetch_material('gradient_fabulous'))
|
174
178
|
mixer_node = material.node_tree.nodes.new('ShaderNodeMixRGB')
|
175
179
|
gradient_node = material.node_tree.nodes.new('ShaderNodeTexGradient')
|
176
180
|
gradient_node.gradient_type = 'SPHERICAL'
|
@@ -227,6 +231,7 @@ def wireframize(obj):
|
|
227
231
|
bpy.ops.object.modifier_add(type='WIREFRAME')
|
228
232
|
obj.modifiers['Wireframe'].thickness = WIREFRAME_THICKNESS
|
229
233
|
make_object_emitter(obj, 1)
|
234
|
+
return obj
|
230
235
|
|
231
236
|
def shuffle(obj):
|
232
237
|
obj.location = rand_location()
|
@@ -343,7 +348,6 @@ def add_ocean(spatial_size, resolution, depth = 100, scale=(4,4,4)):
|
|
343
348
|
ocean.modifiers["Ocean"].depth = depth
|
344
349
|
make_object_glossy(ocean, rand_color())
|
345
350
|
make_object_gradient_fabulous(ocean, rand_color(), rand_color())
|
346
|
-
# mix_nodes(ocean.data.materials[0], ocean.data.materials[0].node_tree.nodes['Diffuse BSDF'], ocean.data.materials[0].node_tree.nodes['Glossy BSDF'])
|
347
351
|
shadow = clone(ocean)
|
348
352
|
shadow.location += mathutils.Vector((1,1,-0.4))
|
349
353
|
wireframize(shadow)
|
@@ -356,6 +360,15 @@ def flush_objects(objs = bpy.data.objects):
|
|
356
360
|
for obj in objs:
|
357
361
|
bpy.data.objects.remove(obj, do_unlink=True)
|
358
362
|
|
363
|
+
# Delete materials
|
364
|
+
def flush_materials(mats = bpy.data.materials):
|
365
|
+
for mat in mats:
|
366
|
+
bpy.data.materials.remove(mat, do_unlink=True)
|
367
|
+
|
368
|
+
def flush_nodes(material):
|
369
|
+
for node in material.node_tree.nodes:
|
370
|
+
material.node_tree.nodes.remove(node)
|
371
|
+
|
359
372
|
# Rotate hue to generate palette
|
360
373
|
def adjacent_colors(r, g, b, number):
|
361
374
|
angle = (360 / 5) / 360
|
@@ -389,12 +402,12 @@ def build_pyramid(width=random.uniform(1,3), length=random.uniform(1,3), height=
|
|
389
402
|
faces.append([3,0,4])
|
390
403
|
return create_mesh('Pyramid ' + str(uuid.uuid1()), verts, faces, location)
|
391
404
|
|
392
|
-
def camera_path(pitch =
|
405
|
+
def camera_path(pitch = NUMBER_OF_FRAMES):
|
393
406
|
res = []
|
394
407
|
initial_z = INITIAL_CAMERA_LOCATION[2]
|
395
408
|
initial_x = INITIAL_CAMERA_LOCATION[0]
|
396
409
|
for y in pitched_array(initial_x, -initial_x, pitch):
|
397
|
-
|
410
|
+
res.append((initial_x, y, math.sin(0.5*y) + 0.5))
|
398
411
|
for x in pitched_array(initial_x, -initial_x, pitch):
|
399
412
|
res.append((x,-initial_x, math.sin(0.5*x) + 0.5))
|
400
413
|
for y in pitched_array(-initial_x, initial_x, pitch):
|
@@ -407,14 +420,15 @@ def pitched_array(minimum, maximum, pitch):
|
|
407
420
|
return list(map(lambda x: (minimum + pitch * x), range(int((maximum - minimum) / pitch))))
|
408
421
|
|
409
422
|
def still_routine(index = 1):
|
410
|
-
CAMERA.location = mathutils.Vector(INITIAL_CAMERA_LOCATION) + mathutils.Vector((round(random.uniform(-
|
423
|
+
CAMERA.location = mathutils.Vector(INITIAL_CAMERA_LOCATION) + mathutils.Vector((round(random.uniform(-CAMERA_OFFSET, CAMERA_OFFSET), 10),round(random.uniform(-CAMERA_OFFSET, CAMERA_OFFSET), 10), round(random.uniform(-1, 1), 10)))
|
411
424
|
randomize_reflectors_colors()
|
412
425
|
make_object_glossy(OCEAN[0])
|
426
|
+
assign_material(SUBJECT, random_material())
|
413
427
|
rotate(SUBJECT, index)
|
414
428
|
CAMERA.rotation_euler.y += math.radians(round(random.uniform(-50, +50)))
|
415
429
|
for ocean in OCEAN:
|
416
430
|
ocean.modifiers['Ocean'].random_seed = round(random.uniform(0, 100))
|
417
|
-
ocean.modifiers['Ocean'].choppiness += random.uniform(0,
|
431
|
+
ocean.modifiers['Ocean'].choppiness += random.uniform(0, 0.5)
|
418
432
|
if bpy.data.groups['Lines'].objects:
|
419
433
|
for l in bpy.data.groups['Lines'].objects:
|
420
434
|
rotation = rand_rotation()
|
@@ -443,15 +457,15 @@ def animation_routine(frame):
|
|
443
457
|
make_object_glossy(OCEAN[0])
|
444
458
|
SUBJECT.rotation_euler.z += math.radians(1)
|
445
459
|
for l in bpy.data.groups['Lines'].objects:
|
446
|
-
l.rotation_euler.x += math.radians(
|
447
|
-
l.rotation_euler.z += math.radians(
|
460
|
+
l.rotation_euler.x += math.radians(1)
|
461
|
+
l.rotation_euler.z += math.radians(1)
|
448
462
|
if props:
|
449
463
|
for prop in props:
|
450
464
|
prop.rotation_euler.x += math.radians(5)
|
451
465
|
if WIREFRAMES:
|
452
466
|
for obj in WIREFRAMES:
|
453
|
-
obj.location
|
454
|
-
obj.rotation_euler.rotate(mathutils.Euler((math.radians(
|
467
|
+
obj.location.z = math.sin(frame)
|
468
|
+
obj.rotation_euler.rotate(mathutils.Euler((math.radians(1), math.radians(1), math.radians(1)), 'XYZ'))
|
455
469
|
if bpy.data.groups['Displays'].objects:
|
456
470
|
for display in bpy.data.groups['Displays'].objects:
|
457
471
|
display.rotation_euler.x += math.radians(2)
|
@@ -497,4 +511,4 @@ def add_frame(collection = bpy.data.objects):
|
|
497
511
|
for obj in collection:
|
498
512
|
obj.keyframe_insert(data_path="rotation_euler", index=-1)
|
499
513
|
obj.keyframe_insert(data_path="location", index=-1)
|
500
|
-
obj.keyframe_insert(data_path="scale", index=-1)
|
514
|
+
obj.keyframe_insert(data_path="scale", index=-1)
|
data/lib/glitch3d/bpy/main.py
CHANGED
@@ -20,6 +20,7 @@ def get_args():
|
|
20
20
|
parsed_script_args, _ = parser.parse_known_args(script_args)
|
21
21
|
return parsed_script_args
|
22
22
|
|
23
|
+
|
23
24
|
args = get_args()
|
24
25
|
file = args.file
|
25
26
|
mode = args.mode
|
@@ -35,14 +36,18 @@ shots_number = int(args.shots_number)
|
|
35
36
|
import os, bpy, datetime, random, math, mathutils, random, uuid, sys, logging, string, colorsys, code
|
36
37
|
from subprocess import call
|
37
38
|
|
39
|
+
def load_file(file_path):
|
40
|
+
# load and define function and vars in global namespace, yolo
|
41
|
+
exec(open(file_path).read(), globals())
|
42
|
+
|
38
43
|
# Create directory for renders
|
39
44
|
directory = os.path.dirname('./renders')
|
40
45
|
if not os.path.exists(directory):
|
41
46
|
os.makedirs(directory)
|
42
47
|
|
43
|
-
|
44
|
-
|
45
|
-
|
48
|
+
load_file(os.path.join(path + '/glitch3d/bpy/helpers.py'))
|
49
|
+
load_file(os.path.join(path + '/glitch3d/bpy/render_settings.py'))
|
50
|
+
load_file(os.path.join(path + '/glitch3d/bpy/lighting.py'))
|
46
51
|
|
47
52
|
# Create groups
|
48
53
|
WIREFRAMES = []
|
@@ -58,20 +63,20 @@ for primitive in PRIMITIVES:
|
|
58
63
|
|
59
64
|
FISHEYE = True
|
60
65
|
COLORS = rand_color_palette(5)
|
61
|
-
|
66
|
+
CAMERA_OFFSET = 1
|
67
|
+
INITIAL_CAMERA_LOCATION = (CAMERA_OFFSET, CAMERA_OFFSET, 1)
|
62
68
|
FIXTURES_FOLDER_PATH = path + '/../fixtures/'
|
63
69
|
TEXTURE_FOLDER_PATH = FIXTURES_FOLDER_PATH + 'textures/'
|
64
70
|
|
65
71
|
# Scene
|
66
72
|
context = bpy.context
|
67
73
|
new_scene = bpy.data.scenes.new("Automated Render Scene")
|
68
|
-
bpy.ops.scene.delete()
|
69
74
|
context.screen.scene = new_scene
|
70
75
|
SCENE = new_scene
|
71
76
|
|
72
77
|
flush_objects()
|
73
78
|
|
74
|
-
camera_data = bpy.data.cameras
|
79
|
+
camera_data = bpy.data.cameras.new(name = 'Camera')
|
75
80
|
bpy.data.objects.new('Camera', object_data=camera_data)
|
76
81
|
CAMERA = bpy.data.objects['Camera']
|
77
82
|
new_scene.objects.link(CAMERA)
|
@@ -86,23 +91,24 @@ if FISHEYE:
|
|
86
91
|
CAMERA.data.sensor_width = 20
|
87
92
|
CAMERA.data.sensor_height = 20
|
88
93
|
|
89
|
-
render_settings(animate, mode)
|
94
|
+
render_settings(animate, mode, NORMALS_RENDERING)
|
90
95
|
|
91
96
|
# Load model
|
92
97
|
model_path = os.path.join(file)
|
93
98
|
bpy.ops.import_scene.obj(filepath = model_path, use_edges=True)
|
94
|
-
SUBJECT = bpy.data.objects['
|
99
|
+
SUBJECT = bpy.data.objects['0_glitch3d']
|
95
100
|
SUBJECT.select = True
|
96
101
|
bpy.ops.object.origin_set(type="ORIGIN_CENTER_OF_MASS")
|
97
102
|
SUBJECT.location = ORIGIN
|
98
|
-
make_object_glossy(SUBJECT, YELLOW, 0.01)
|
103
|
+
# make_object_glossy(SUBJECT, YELLOW, 0.01)
|
104
|
+
assign_material(SUBJECT, fetch_material('magma'))
|
99
105
|
look_at(SUBJECT)
|
100
106
|
let_there_be_light(SCENE)
|
101
107
|
|
102
108
|
if debug == False:
|
103
|
-
|
104
|
-
|
105
|
-
|
109
|
+
load_file(os.path.join(path + '/glitch3d/bpy/canvas', 'dreamatorium.py'))
|
110
|
+
load_file(os.path.join(path + '/glitch3d/bpy/canvas', 'lyfe.py'))
|
111
|
+
load_file (os.path.join(path + '/glitch3d/bpy/canvas', 'aether.py'))
|
106
112
|
|
107
113
|
print('Rendering images with resolution: ' + str(SCENE.render.resolution_x) + ' x ' + str(SCENE.render.resolution_y))
|
108
114
|
|
@@ -110,7 +116,11 @@ if debug == False:
|
|
110
116
|
print('ANIMATION RENDERING BEGIN')
|
111
117
|
SCENE.frame_start = 0
|
112
118
|
SCENE.frame_end = NUMBER_OF_FRAMES
|
113
|
-
|
119
|
+
|
120
|
+
x = 0.08
|
121
|
+
while len(camera_path(x)) <= NUMBER_OF_FRAMES:
|
122
|
+
x -= 0.01
|
123
|
+
CAMERA_PATH = camera_path(x)
|
114
124
|
|
115
125
|
for frame in range(0, NUMBER_OF_FRAMES):
|
116
126
|
SCENE.frame_set(frame)
|
@@ -132,6 +142,7 @@ else:
|
|
132
142
|
|
133
143
|
# Save scene as .blend file
|
134
144
|
bpy.ops.wm.save_as_mainfile(filepath=output_name(model_path) + '.blend')
|
145
|
+
|
135
146
|
print("Files rendered:")
|
136
147
|
for p in RENDER_OUTPUT_PATHS:
|
137
148
|
print(p)
|
@@ -17,13 +17,10 @@ print('stitching ' + str(len(files)) + ' images')
|
|
17
17
|
x_offset = 0
|
18
18
|
y_offset = 0
|
19
19
|
for file in files:
|
20
|
-
print(file)
|
21
20
|
image = Image.open(file)
|
22
|
-
print(image.size)
|
23
21
|
res.paste(image, (x_offset, y_offset))
|
24
22
|
x_offset += image.size[0]
|
25
23
|
if x_offset > total_width:
|
26
|
-
print('reset')
|
27
24
|
y_offset += image.size[1]
|
28
25
|
x_offset = 0
|
29
26
|
|
@@ -3,12 +3,31 @@ def set_tile(size):
|
|
3
3
|
SCENE.render.tile_x = size
|
4
4
|
SCENE.render.tile_y = size
|
5
5
|
|
6
|
-
def
|
6
|
+
def render_normals():
|
7
|
+
SCENE.use_nodes = True
|
8
|
+
SCENE.render.layers[0].use_pass_normal = True
|
9
|
+
SCENE.render.layers[0].use_pass_z = False
|
10
|
+
SCENE.render.layers[0].use_pass_combined = False
|
11
|
+
node_tree = bpy.context.scene.node_tree
|
12
|
+
enter = node_tree.nodes[1]
|
13
|
+
composite = node_tree.nodes['Composite']
|
14
|
+
multiply = node_tree.nodes.new('CompositorNodeMixRGB')
|
15
|
+
add = node_tree.nodes.new('CompositorNodeMixRGB')
|
16
|
+
multiply.blend_type = "MULTIPLY"
|
17
|
+
add.blend_type = 'ADD'
|
18
|
+
add.inputs[1].default_value = rand_color()
|
19
|
+
multiply.inputs[1].default_value = rand_color()
|
20
|
+
invert = node_tree.nodes.new('CompositorNodeInvert')
|
21
|
+
node_tree.links.new(add.outputs[0], invert.inputs[1])
|
22
|
+
node_tree.links.new(multiply.outputs[0], add.inputs[2])
|
23
|
+
node_tree.links.new(enter.outputs['Normal'], multiply.inputs[1])
|
24
|
+
node_tree.links.new(invert.outputs[0], composite.inputs[0])
|
25
|
+
|
26
|
+
def render_settings(animate, mode, normals):
|
7
27
|
SCENE.render.resolution_x = 2000
|
8
28
|
SCENE.render.resolution_y = 2000
|
9
29
|
SCENE.render.engine = 'CYCLES'
|
10
30
|
SCENE.render.resolution_percentage = 25
|
11
|
-
|
12
31
|
# bpy.SCENE.cycles.device = 'GPU'
|
13
32
|
SCENE.render.image_settings.compression = 90
|
14
33
|
SCENE.cycles.samples = 20
|
@@ -16,16 +35,15 @@ def render_settings(animate, mode):
|
|
16
35
|
SCENE.cycles.min_bounces = 1
|
17
36
|
SCENE.cycles.caustics_reflective = False
|
18
37
|
SCENE.cycles.caustics_refractive = False
|
19
|
-
|
20
38
|
SCENE.render.image_settings.color_mode ='RGBA'
|
21
39
|
SCENE.render.layers[0].cycles.use_denoising = True
|
22
40
|
set_tile(32)
|
23
|
-
|
41
|
+
if normals:
|
42
|
+
render_normals()
|
24
43
|
if animate:
|
25
44
|
SCENE.render.image_settings.file_format='AVI_RAW'
|
26
45
|
else:
|
27
46
|
SCENE.render.image_settings.file_format='PNG'
|
28
|
-
|
29
47
|
if mode == 'high':
|
30
48
|
set_tile(64)
|
31
49
|
SCENE.cycles.samples = 100
|
data/lib/glitch3d/version.rb
CHANGED
data/lib/glitch3d.rb
CHANGED
@@ -16,6 +16,7 @@ module Glitch3d
|
|
16
16
|
|
17
17
|
BLENDER_EXECUTABLE_PATH = ENV['BLENDER_EXECUTABLE_PATH'].freeze
|
18
18
|
RENDERING_SCRIPT_PATH = File.dirname(__FILE__) + '/glitch3d/bpy/main.py'
|
19
|
+
BASE_BLEND_FILE_PATH = File.dirname(__FILE__) + '/../fixtures/base.blend'
|
19
20
|
|
20
21
|
def clean_model(source_file)
|
21
22
|
self.class.include Glitch3d::None
|
@@ -134,7 +135,7 @@ module Glitch3d
|
|
134
135
|
f.puts model_name
|
135
136
|
f.puts '# Boundaries: ' + boundaries.to_s
|
136
137
|
f.puts ''
|
137
|
-
f.puts "g
|
138
|
+
f.puts "g 0_glitch3d"
|
138
139
|
f.puts ''
|
139
140
|
f.puts content_hash[:vertices].map(&:to_s)
|
140
141
|
f.puts ''
|
@@ -150,6 +151,7 @@ module Glitch3d
|
|
150
151
|
args = [
|
151
152
|
BLENDER_EXECUTABLE_PATH,
|
152
153
|
'-b',
|
154
|
+
BASE_BLEND_FILE_PATH,
|
153
155
|
'-P',
|
154
156
|
RENDERING_SCRIPT_PATH,
|
155
157
|
'--',
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glitch3d
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.3.
|
4
|
+
version: 0.2.3.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pskl
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,34 +38,6 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rspec
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '3.0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '3.0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: byebug
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
41
|
description: Glitch3D is a library designed to transform a 3D model randomly and render
|
70
42
|
screenshots.
|
71
43
|
email:
|
@@ -88,6 +60,7 @@ files:
|
|
88
60
|
- bin/console
|
89
61
|
- bin/glitch3d
|
90
62
|
- bin/setup
|
63
|
+
- fixtures/base.blend
|
91
64
|
- fixtures/brain.obj
|
92
65
|
- fixtures/cube.obj
|
93
66
|
- fixtures/examples/demo.jpg
|
@@ -106,11 +79,14 @@ files:
|
|
106
79
|
- fixtures/textures/checkered_texture.jpg
|
107
80
|
- fixtures/textures/dude.jpg
|
108
81
|
- fixtures/textures/grid.jpg
|
82
|
+
- fixtures/textures/jakob.jpg
|
109
83
|
- fixtures/textures/kago.jpg
|
110
84
|
- fixtures/textures/kawai.jpg
|
111
85
|
- fixtures/textures/mario.jpg
|
112
86
|
- fixtures/textures/nice_glasses.jpg
|
87
|
+
- fixtures/textures/putin.jpg
|
113
88
|
- fixtures/textures/rug.jpg
|
89
|
+
- fixtures/textures/ship.jpg
|
114
90
|
- fixtures/textures/slavs.jpg
|
115
91
|
- fixtures/textures/spiral.jpg
|
116
92
|
- fixtures/textures/vapor.jpg
|