glitch3d 0.2.3.3 → 0.2.3.6
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 +1 -0
- data/.vscode/settings.json +4 -0
- data/fixtures/textures/baby.jpg +0 -0
- data/fixtures/textures/mario.jpg +0 -0
- data/fixtures/textures/yolo.jpg +0 -0
- data/lib/glitch3d/bpy/canvas/aether.py +25 -14
- data/lib/glitch3d/bpy/canvas/dreamatorium.py +5 -9
- data/lib/glitch3d/bpy/helpers.py +10 -15
- data/lib/glitch3d/bpy/lighting.py +0 -1
- data/lib/glitch3d/bpy/main.py +15 -14
- data/{image.py → lib/glitch3d/bpy/post-processing/mosaic.py} +3 -5
- data/lib/glitch3d/bpy/render_settings.py +14 -7
- data/lib/glitch3d/version.rb +1 -1
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9a221d591135c6764014bb2f568a8d97568dde6
|
4
|
+
data.tar.gz: a941e1d8f3ed02a05ac14b0ae0d2fb89b7020d54
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba1e3e41b11f3c551809593346c880ec70d74f3d943da2aa0b921673b8be76a5cf960eced4abd78f3c23f13a818b6ecbddb5091bfa7ca67d7f93ab83bdf30f2a
|
7
|
+
data.tar.gz: 3a01ad67f7ba65c5d6cfd37531f0a41b481bc516096516f3bdceac7d58d5a53b26d7acaba545bd6deadae1e294ed80197831452a2faded9d0a5283398ce423cd
|
data/.gitignore
CHANGED
Binary file
|
Binary file
|
Binary file
|
@@ -11,7 +11,7 @@ container = last_added_object('CUBE')
|
|
11
11
|
container.name = 'Container'
|
12
12
|
container.modifiers.new(name='container', type='FLUID_SIMULATION')
|
13
13
|
container.modifiers['container'].settings.type = 'DOMAIN'
|
14
|
-
container.modifiers['container'].settings.generate_particles =
|
14
|
+
container.modifiers['container'].settings.generate_particles = 1
|
15
15
|
container.modifiers['container'].settings.surface_subdivisions = 100
|
16
16
|
container.modifiers['container'].settings.viscosity_exponent = 6
|
17
17
|
container.modifiers['container'].settings.viscosity_base = 1.0
|
@@ -19,20 +19,31 @@ container.modifiers['container'].settings.simulation_scale = 1
|
|
19
19
|
|
20
20
|
container.location = (0, 0, 0)
|
21
21
|
|
22
|
-
|
23
|
-
bpy.ops.mesh.primitive_uv_sphere_add(location=
|
24
|
-
emitter =
|
25
|
-
emitter.cycles_visibility.camera = False
|
26
|
-
emitter.name = 'Emitter'
|
27
|
-
emitter.modifiers.new(name='emitter', type='FLUID_SIMULATION')
|
28
|
-
emitter.modifiers['emitter'].settings.type = 'INFLOW'
|
29
|
-
emitter.modifiers['emitter'].settings.inflow_velocity =
|
30
|
-
emitter.scale = (0.5, 0.5, 0.5)
|
31
|
-
|
32
|
-
|
22
|
+
def spawn_emitter_fuild(location, emission_vector):
|
23
|
+
bpy.ops.mesh.primitive_uv_sphere_add(location=location)
|
24
|
+
emitter = last_added_object('Sphere')
|
25
|
+
emitter.cycles_visibility.camera = False
|
26
|
+
emitter.name = 'Emitter' + str(uuid.uuid1())
|
27
|
+
emitter.modifiers.new(name='emitter', type='FLUID_SIMULATION')
|
28
|
+
emitter.modifiers['emitter'].settings.type = 'INFLOW'
|
29
|
+
emitter.modifiers['emitter'].settings.inflow_velocity = emission_vector
|
30
|
+
emitter.scale = (0.5, 0.5, 0.5)
|
31
|
+
return emitter
|
32
|
+
|
33
|
+
def make_object_fluid_collider(obj):
|
34
|
+
obj.modifiers.new(name='obstacle', type='FLUID_SIMULATION')
|
35
|
+
obj.modifiers['obstacle'].settings.type = 'OBSTACLE'
|
36
|
+
obj.modifiers['obstacle'].settings.volume_initialization = 'BOTH'
|
37
|
+
obj.modifiers['obstacle'].settings.partial_slip_factor = 0.15
|
38
|
+
|
39
|
+
spawn_emitter_fuild((0,0,((RADIUS/2) - 2)),mathutils.Vector((0.5, 0.5, -2)))
|
40
|
+
spawn_emitter_fuild((0,3,((RADIUS/2) - 2)),mathutils.Vector((0., -0.5, -0.5)))
|
41
|
+
|
33
42
|
make_object_gradient_fabulous(container, rand_color(), rand_color())
|
34
43
|
make_object_fluid_collider(SUBJECT)
|
35
|
-
make_object_fluid_collider(OCEAN[
|
44
|
+
make_object_fluid_collider(OCEAN[1])
|
36
45
|
|
37
46
|
# Bake animation
|
38
|
-
|
47
|
+
print("*** Baking commence *** (you might see a bunch of gibberish popping up cause baking is not supposed to be used headlessly")
|
48
|
+
bpy.ops.fluid.bake({'scene': context.scene, 'active_object': container})
|
49
|
+
print("*** Baking finished ***")
|
@@ -16,9 +16,9 @@ for l1 in elements:
|
|
16
16
|
|
17
17
|
# Set up virtual displays
|
18
18
|
bpy.ops.mesh.primitive_grid_add(x_subdivisions=100, y_subdivisions=100, location=(0, 6, 2))
|
19
|
-
display1 =
|
19
|
+
display1 = last_added_object('Grid')
|
20
20
|
bpy.ops.mesh.primitive_grid_add(x_subdivisions=100, y_subdivisions=100, location=(6, 0, 2))
|
21
|
-
display2 =
|
21
|
+
display2 = last_added_object('Grid')
|
22
22
|
|
23
23
|
bpy.data.groups['Displays'].objects.link(display1)
|
24
24
|
bpy.data.groups['Displays'].objects.link(display2)
|
@@ -33,21 +33,19 @@ for display in bpy.data.groups['Displays'].objects:
|
|
33
33
|
display.rotation_euler.x += math.radians(90)
|
34
34
|
display.scale = DISPLAY_SCALE
|
35
35
|
texture_object(display)
|
36
|
-
make_texture_object_transparent(display)
|
37
36
|
unwrap_model(display)
|
38
|
-
glitch(display)
|
39
37
|
|
40
38
|
glitch(m4a1)
|
41
39
|
make_object_gradient_fabulous(m4a1, rand_color(), rand_color())
|
42
40
|
|
43
41
|
# Make floor
|
44
42
|
bpy.ops.mesh.primitive_plane_add(location=(0, 0, -2))
|
45
|
-
floor = last_added_object('
|
46
|
-
bpy.data.groups['Planes'].objects.link(floor)
|
43
|
+
floor = last_added_object('Plane')
|
47
44
|
floor.scale = (20,20,20)
|
48
45
|
subdivide(floor, int(random.uniform(3, 7)))
|
49
46
|
displace(floor)
|
50
47
|
texture_object(floor)
|
48
|
+
unwrap_model(floor)
|
51
49
|
|
52
50
|
OCEAN = add_ocean(10, 20)
|
53
51
|
|
@@ -62,14 +60,12 @@ for j in range(0,20):
|
|
62
60
|
# Add flying letters, lmao
|
63
61
|
for index in range(1, len(WORDS)):
|
64
62
|
new_object = spawn_text()
|
63
|
+
bpy.data.groups['Texts'].objects.link(new_object)
|
65
64
|
props.append(new_object)
|
66
65
|
text_scale = random.uniform(0.75, 3)
|
67
66
|
make_object_glossy(new_object, rand_color(), 0.0)
|
68
67
|
new_object.scale = (text_scale, text_scale, text_scale)
|
69
68
|
new_object.location = rand_location()
|
70
69
|
|
71
|
-
for plane in bpy.data.groups['Planes'].objects:
|
72
|
-
unwrap_model(plane)
|
73
|
-
|
74
70
|
for obj in WIREFRAMES:
|
75
71
|
wireframize(obj)
|
data/lib/glitch3d/bpy/helpers.py
CHANGED
@@ -17,6 +17,7 @@ GREY = (0.2, 0.2, 0.2 ,1)
|
|
17
17
|
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
|
+
RENDER_OUTPUT_PATHS = []
|
20
21
|
|
21
22
|
def pry():
|
22
23
|
code.interact(local=dict(globals(), **locals()))
|
@@ -34,8 +35,10 @@ def shoot(filepath):
|
|
34
35
|
print('Camera now at location: ' + camera_location_string(CAMERA) + ' / rotation: ' + camera_rotation_string(CAMERA))
|
35
36
|
SCENE.render.filepath = filepath
|
36
37
|
if animate:
|
37
|
-
|
38
|
-
|
38
|
+
bpy.ops.render.render(animation=animate, write_still=True)
|
39
|
+
else:
|
40
|
+
RENDER_OUTPUT_PATHS.append(filepath)
|
41
|
+
bpy.ops.render.render(write_still=True)
|
39
42
|
|
40
43
|
def output_name(model_path, index = 0):
|
41
44
|
if animate:
|
@@ -100,9 +103,7 @@ def create_cycles_material():
|
|
100
103
|
|
101
104
|
def random_texture():
|
102
105
|
texture_path = TEXTURE_FOLDER_PATH + random.choice(os.listdir(TEXTURE_FOLDER_PATH))
|
103
|
-
|
104
|
-
logging.info(TEXTURE_FOLDER_PATH)
|
105
|
-
logging.info('---------')
|
106
|
+
print("LOADING TEXTURE -> " + texture_path)
|
106
107
|
return bpy.data.images.load(texture_path)
|
107
108
|
|
108
109
|
def assign_texture_to_material(material, texture):
|
@@ -225,7 +226,7 @@ def wireframize(obj):
|
|
225
226
|
SCENE.objects.active = obj
|
226
227
|
bpy.ops.object.modifier_add(type='WIREFRAME')
|
227
228
|
obj.modifiers['Wireframe'].thickness = WIREFRAME_THICKNESS
|
228
|
-
make_object_emitter(obj,
|
229
|
+
make_object_emitter(obj, 1)
|
229
230
|
|
230
231
|
def shuffle(obj):
|
231
232
|
obj.location = rand_location()
|
@@ -342,7 +343,7 @@ def add_ocean(spatial_size, resolution, depth = 100, scale=(4,4,4)):
|
|
342
343
|
ocean.modifiers["Ocean"].depth = depth
|
343
344
|
make_object_glossy(ocean, rand_color())
|
344
345
|
make_object_gradient_fabulous(ocean, rand_color(), rand_color())
|
345
|
-
mix_nodes(ocean.data.materials[0], ocean.data.materials[0].node_tree.nodes['Diffuse BSDF'], ocean.data.materials[0].node_tree.nodes['Glossy BSDF'])
|
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'])
|
346
347
|
shadow = clone(ocean)
|
347
348
|
shadow.location += mathutils.Vector((1,1,-0.4))
|
348
349
|
wireframize(shadow)
|
@@ -419,7 +420,7 @@ def still_routine(index = 1):
|
|
419
420
|
map(move_ocean, OCEAN)
|
420
421
|
map(make_object_glossy, OCEAN)
|
421
422
|
rotate(SUBJECT, index)
|
422
|
-
CAMERA.rotation_euler.y += math.radians(round(random.uniform(-
|
423
|
+
CAMERA.rotation_euler.y += math.radians(round(random.uniform(-50, +50)))
|
423
424
|
if bpy.data.groups['Lines'].objects:
|
424
425
|
for l in bpy.data.groups['Lines'].objects:
|
425
426
|
rotation = rand_rotation()
|
@@ -442,10 +443,10 @@ def animation_routine(frame):
|
|
442
443
|
CAMERA.location = CAMERA_PATH[frame]
|
443
444
|
look_at(SUBJECT)
|
444
445
|
randomize_reflectors_colors()
|
446
|
+
displace(SUBJECT)
|
445
447
|
if OCEAN:
|
446
448
|
map(move_ocean, OCEAN)
|
447
449
|
map(make_object_glossy, OCEAN)
|
448
|
-
glitch(SUBJECT)
|
449
450
|
SUBJECT.rotation_euler.z += math.radians(4)
|
450
451
|
for l in bpy.data.groups['Lines'].objects:
|
451
452
|
l.rotation_euler.x += math.radians(5)
|
@@ -498,12 +499,6 @@ def make_world_volumetric(world, scatter_intensity = SCATTER_INTENSITY, absorpti
|
|
498
499
|
absorption_node.inputs['Density'].default_value = ABSORPTION_INTENSITY
|
499
500
|
bg_node.inputs[0].default_value = rand_color()
|
500
501
|
|
501
|
-
def make_object_fluid_collider(obj):
|
502
|
-
obj.modifiers.new(name='obstacle', type='FLUID_SIMULATION')
|
503
|
-
obj.modifiers['obstacle'].settings.type = 'OBSTACLE'
|
504
|
-
obj.modifiers['obstacle'].settings.volume_initialization = 'BOTH'
|
505
|
-
obj.modifiers['obstacle'].settings.partial_slip_factor = 0.15
|
506
|
-
|
507
502
|
def add_frame(collection = bpy.data.objects):
|
508
503
|
for obj in collection:
|
509
504
|
obj.keyframe_insert(data_path="rotation_euler", index=-1)
|
@@ -15,7 +15,6 @@ def let_there_be_light(scene):
|
|
15
15
|
|
16
16
|
for r in [reflector1, reflector2, reflector3]:
|
17
17
|
r.cycles_visibility.camera = False
|
18
|
-
bpy.data.groups['Planes'].objects.link(r)
|
19
18
|
bpy.data.groups['Reflectors'].objects.link(r)
|
20
19
|
|
21
20
|
reflector2.rotation_euler.x += math.radians(90)
|
data/lib/glitch3d/bpy/main.py
CHANGED
@@ -48,7 +48,7 @@ WIREFRAMES = []
|
|
48
48
|
VORONOIED = []
|
49
49
|
OCEAN = []
|
50
50
|
|
51
|
-
for s in ['
|
51
|
+
for s in ['Texts', 'Lines', 'Displays', 'Reflectors']:
|
52
52
|
bpy.data.groups.new(s)
|
53
53
|
|
54
54
|
LINES = bpy.data.groups['Lines'].objects
|
@@ -99,24 +99,21 @@ look_at(SUBJECT)
|
|
99
99
|
let_there_be_light(SCENE)
|
100
100
|
|
101
101
|
if debug == False:
|
102
|
-
exec(open(os.path.join(path + '/glitch3d/bpy/canvas', 'lyfe.py')).read())
|
103
102
|
exec(open(os.path.join(path + '/glitch3d/bpy/canvas', 'dreamatorium.py')).read())
|
103
|
+
exec(open(os.path.join(path + '/glitch3d/bpy/canvas', 'lyfe.py')).read())
|
104
104
|
exec(open(os.path.join(path + '/glitch3d/bpy/canvas', 'aether.py')).read())
|
105
105
|
|
106
106
|
print('Rendering images with resolution: ' + str(SCENE.render.resolution_x) + ' x ' + str(SCENE.render.resolution_y))
|
107
107
|
|
108
|
-
for plane in bpy.data.groups['Planes'].objects:
|
109
|
-
unwrap_model(plane)
|
110
|
-
|
111
108
|
if animate:
|
112
109
|
print('ANIMATION RENDERING BEGIN')
|
113
110
|
SCENE.frame_start = 0
|
114
111
|
SCENE.frame_end = NUMBER_OF_FRAMES
|
115
|
-
CAMERA_PATH = camera_path(0.
|
112
|
+
CAMERA_PATH = camera_path(0.08)
|
116
113
|
|
117
114
|
for frame in range(0, NUMBER_OF_FRAMES):
|
118
115
|
SCENE.frame_set(frame)
|
119
|
-
animation_routine(frame
|
116
|
+
animation_routine(frame)
|
120
117
|
add_frame()
|
121
118
|
shoot(output_name(model_path))
|
122
119
|
|
@@ -124,13 +121,17 @@ if debug == False:
|
|
124
121
|
print('STILL RENDERING BEGIN')
|
125
122
|
for index in range(0, int(shots_number)):
|
126
123
|
print("-------------------------- " + str(index) + " --------------------------")
|
124
|
+
look_at(SUBJECT)
|
127
125
|
still_routine(index)
|
128
126
|
SCENE.frame_set(int(SCENE.frame_end/(index+1)))
|
129
|
-
look_at(SUBJECT)
|
130
127
|
shoot(output_name(model_path, index))
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
128
|
+
else:
|
129
|
+
look_at(SUBJECT)
|
130
|
+
shoot(output_name(model_path))
|
131
|
+
|
132
|
+
# Save scene as .blend file
|
133
|
+
bpy.ops.wm.save_as_mainfile(filepath=output_name(model_path) + '.blend')
|
134
|
+
print("Files rendered:")
|
135
|
+
for p in RENDER_OUTPUT_PATHS:
|
136
|
+
print(p)
|
137
|
+
print('FINISHED ¯\_(ツ)_/¯')
|
@@ -1,17 +1,15 @@
|
|
1
1
|
# Make a mosaic with images
|
2
|
-
import sys
|
3
|
-
import os
|
2
|
+
import os, sys
|
4
3
|
from PIL import Image
|
5
4
|
|
6
|
-
|
7
|
-
RES_Y = 5000
|
5
|
+
print("Mosaicing")
|
8
6
|
path = './renders/'
|
9
7
|
files = [path + f for f in os.listdir(path) if os.path.isfile(os.path.join(path, f))]
|
10
8
|
images = map(Image.open, files)
|
11
9
|
widths, heights = zip(*(i.size for i in images))
|
12
10
|
|
13
11
|
total_width = images[0].size[0] * 4
|
14
|
-
total_height =
|
12
|
+
total_height = images[0].size[1] * 4
|
15
13
|
|
16
14
|
res = Image.new('RGB', (total_height,total_width))
|
17
15
|
print('stitching ' + str(len(files)) + ' images')
|
@@ -1,3 +1,8 @@
|
|
1
|
+
# Square wall art resolution: 10200x10200 (threadless, society6)
|
2
|
+
def set_tile(size):
|
3
|
+
SCENE.render.tile_x = size
|
4
|
+
SCENE.render.tile_y = size
|
5
|
+
|
1
6
|
def render_settings(animate, mode):
|
2
7
|
SCENE.render.resolution_x = 2000
|
3
8
|
SCENE.render.resolution_y = 2000
|
@@ -5,15 +10,16 @@ def render_settings(animate, mode):
|
|
5
10
|
SCENE.render.resolution_percentage = 25
|
6
11
|
|
7
12
|
# bpy.SCENE.cycles.device = 'GPU'
|
8
|
-
SCENE.render.image_settings.compression =
|
9
|
-
SCENE.cycles.samples =
|
13
|
+
SCENE.render.image_settings.compression = 90
|
14
|
+
SCENE.cycles.samples = 20
|
10
15
|
SCENE.cycles.max_bounces = 1
|
11
16
|
SCENE.cycles.min_bounces = 1
|
12
17
|
SCENE.cycles.caustics_reflective = False
|
13
18
|
SCENE.cycles.caustics_refractive = False
|
14
|
-
|
15
|
-
SCENE.render.tile_y = 32
|
19
|
+
|
16
20
|
SCENE.render.image_settings.color_mode ='RGBA'
|
21
|
+
SCENE.render.layers[0].cycles.use_denoising = True
|
22
|
+
set_tile(32)
|
17
23
|
|
18
24
|
if animate:
|
19
25
|
SCENE.render.image_settings.file_format='AVI_RAW'
|
@@ -21,6 +27,7 @@ def render_settings(animate, mode):
|
|
21
27
|
SCENE.render.image_settings.file_format='PNG'
|
22
28
|
|
23
29
|
if mode == 'high':
|
24
|
-
|
25
|
-
SCENE.cycles.samples =
|
26
|
-
SCENE.render.resolution_percentage = 100
|
30
|
+
set_tile(64)
|
31
|
+
SCENE.cycles.samples = 100
|
32
|
+
SCENE.render.resolution_percentage = 100
|
33
|
+
|
data/lib/glitch3d/version.rb
CHANGED
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.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pskl
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -78,6 +78,7 @@ files:
|
|
78
78
|
- ".gitignore"
|
79
79
|
- ".rspec"
|
80
80
|
- ".travis.yml"
|
81
|
+
- ".vscode/settings.json"
|
81
82
|
- CODE_OF_CONDUCT.md
|
82
83
|
- COPYING
|
83
84
|
- Gemfile
|
@@ -99,19 +100,21 @@ files:
|
|
99
100
|
- fixtures/textures/afx_face.jpeg
|
100
101
|
- fixtures/textures/afx_logo.jpg
|
101
102
|
- fixtures/textures/anime.jpg
|
103
|
+
- fixtures/textures/baby.jpg
|
102
104
|
- fixtures/textures/btc.jpg
|
103
105
|
- fixtures/textures/checkered_texture.jpg
|
104
106
|
- fixtures/textures/dude.jpg
|
105
107
|
- fixtures/textures/grid.jpg
|
106
108
|
- fixtures/textures/kago.jpg
|
107
109
|
- fixtures/textures/kawai.jpg
|
110
|
+
- fixtures/textures/mario.jpg
|
108
111
|
- fixtures/textures/rug.jpg
|
109
112
|
- fixtures/textures/slavs.jpg
|
110
113
|
- fixtures/textures/spiral.jpg
|
111
114
|
- fixtures/textures/vapor.jpg
|
112
115
|
- fixtures/textures/woman.jpg
|
116
|
+
- fixtures/textures/yolo.jpg
|
113
117
|
- glitch3d.gemspec
|
114
|
-
- image.py
|
115
118
|
- lib/glitch3d.rb
|
116
119
|
- lib/glitch3d/bpy/canvas/aether.py
|
117
120
|
- lib/glitch3d/bpy/canvas/dreamatorium.py
|
@@ -119,6 +122,7 @@ files:
|
|
119
122
|
- lib/glitch3d/bpy/helpers.py
|
120
123
|
- lib/glitch3d/bpy/lighting.py
|
121
124
|
- lib/glitch3d/bpy/main.py
|
125
|
+
- lib/glitch3d/bpy/post-processing/mosaic.py
|
122
126
|
- lib/glitch3d/bpy/render_settings.py
|
123
127
|
- lib/glitch3d/objects/face.rb
|
124
128
|
- lib/glitch3d/objects/vertex.rb
|