glitch3d 0.2.3.1 → 0.2.3.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6775b3b3c86229218bb34aa964b3657c5e666b9c
4
- data.tar.gz: 37aaeedca5f9d492f9b92c28b40667733fbaff0a
3
+ metadata.gz: 285f80bfd141184bf964f5ca7708bed223d8fe77
4
+ data.tar.gz: 97d76d9d5fa444da5f01eed306ee2ed23ee7d67f
5
5
  SHA512:
6
- metadata.gz: 10a77625348cfe97db04312ea725c3062637eecd25cda1ddf232ed91d69615f53e706e8d197b4c1f1ab7b2e03fe43c3281a5009830a952cc0c1d1495dda8c648
7
- data.tar.gz: 4173496d16ea6bf9c025f2d39f9435b3a056f3ba672ba4c93679db43b034fa5ced33bd6a694917fcc1a1c7ee95a8495456e71213a3f7c16b52068719307e5658
6
+ metadata.gz: 02cbe99d66f1b7f828c733d6f0a7b591afc11b4259b4ca6346a60eb76ec5e13f7f791a788122e6fb418e21e103bdb9a224388c69ef2a75b907d236661233b746
7
+ data.tar.gz: 6f33a8578b384790942034d8996fa83f81e4e9ab219269154dbd820c9d9902dbd08ca2d3bb2a07d7275aaa7983285fcd6ce9bdce5fc7e27b544355a0961ab68d
data/README.md CHANGED
@@ -1,8 +1,9 @@
1
1
  # Glitch3d
2
2
 
3
- By altering .obj file data you can get something like this :
3
+ Glitch3d is an automated render library that uses glitching techniques applied to 3D meshes.
4
4
 
5
- <img src="https://raw.githubusercontent.com/pskl/glitch3d/master/fixtures/demo.png" width="400">
5
+ # TODO : add image
6
+ <!-- <img src="https://raw.githubusercontent.com/pskl/glitch3d/master/fixtures/demo.png" width="400"> -->
6
7
 
7
8
  This gem uses the Blender Python API to produces renders headlessly.
8
9
 
@@ -5,5 +5,10 @@ require 'glitch3d'
5
5
  include Glitch3d
6
6
 
7
7
  args = Hash[ARGV.join(' ').scan(/--?([^=\s]+)(?:=(\S+))?/)] if args.nil?
8
- source_file = ARGV[0].start_with?('--') ? nil : ARGV[0]
8
+
9
+ if ARGV[0] && !ARGV[0].start_with?('--')
10
+ source_file = ARGV[0]
11
+ else
12
+ source_file = nil
13
+ end
9
14
  process_model(source_file, args)
@@ -1,7 +1,6 @@
1
1
  ######################
2
2
  ## FLUID SIMULATION ##
3
3
  ######################
4
- animate = True
5
4
  context.scene.frame_end = NUMBER_OF_FRAMES
6
5
 
7
6
  # Container
@@ -10,8 +9,10 @@ container = bpy.data.objects['Cube']
10
9
  container.name = 'Container'
11
10
  container.modifiers.new(name='container', type='FLUID_SIMULATION')
12
11
  container.modifiers['container'].settings.type = 'DOMAIN'
13
- container.modifiers['container'].settings.generate_particles = 1
12
+ container.modifiers['container'].settings.generate_particles = 0.1
14
13
  make_object_gradient_fabulous(container, rand_color(), rand_color())
14
+ # make_object_glossy(container)
15
+ container.modifiers['container'].settings.surface_subdivisions = 100
15
16
  container.location = (0, 0, 7)
16
17
 
17
18
  # Emitter of fluid
@@ -26,7 +27,6 @@ emitter.scale = (0.5, 0.5, 0.5)
26
27
  SUBJECT.modifiers.new(name='obstacle', type='FLUID_SIMULATION')
27
28
  SUBJECT.modifiers['obstacle'].settings.type = 'OBSTACLE'
28
29
  SUBJECT.modifiers['obstacle'].settings.volume_initialization = 'BOTH'
29
- SUBJECT.modifiers['obstacle'].settings.surface_subdivisions = 6
30
30
  SUBJECT.modifiers['obstacle'].settings.partial_slip_factor = 0.15
31
31
 
32
32
  # Bake animation
@@ -15,7 +15,6 @@ display1 = bpy.data.objects['Grid']
15
15
  bpy.ops.mesh.primitive_grid_add(x_subdivisions=100, y_subdivisions=100, location=(6, 0, 2))
16
16
  display2 = bpy.data.objects['Grid.001']
17
17
 
18
- bpy.data.groups.new('Displays')
19
18
  bpy.data.groups['Displays'].objects.link(display1)
20
19
  bpy.data.groups['Displays'].objects.link(display2)
21
20
 
@@ -405,25 +405,28 @@ def pitched_array(minimum, maximum, pitch):
405
405
  return list(map(lambda x: (minimum + pitch * x), range(int((maximum - minimum) / pitch))))
406
406
 
407
407
  def still_routine(index = 1):
408
- CAMERA.location = mathutils.Vector(INITIAL_CAMERA_LOCATION) + mathutils.Vector((round(random.uniform(-3, 3), 10),round(random.uniform(-3, 3), 10),round(random.uniform(-3, 3), 10)))
408
+ CAMERA.location = mathutils.Vector(INITIAL_CAMERA_LOCATION) + mathutils.Vector((round(random.uniform(-3, 3), 10),round(random.uniform(-3, 3), 10),round(random.uniform(-1, 1), 10)))
409
409
  randomize_reflectors_colors()
410
410
  map(move_ocean, OCEAN)
411
411
  map(make_object_glossy, OCEAN)
412
412
  rotate(SUBJECT, index)
413
413
  CAMERA.rotation_euler.y += math.radians(round(random.uniform(-30, +30)))
414
- for l in bpy.data.groups['Lines'].objects:
415
- rotation = rand_rotation()
416
- l.rotation_euler = rotation
417
- for prop in props:
418
- prop.location = rand_location()
419
- prop.rotation_euler = rand_rotation()
420
- for obj in WIREFRAMES:
421
- # obj.location = rand_location()
422
- obj.location += mathutils.Vector((1,1,1))
423
- obj.rotation_euler = rand_rotation()
424
- for display in bpy.data.groups['Displays'].objects:
425
- display.location = rand_location()
426
- rotate(display, index)
414
+ if bpy.data.groups['Lines'].objects:
415
+ for l in bpy.data.groups['Lines'].objects:
416
+ rotation = rand_rotation()
417
+ l.rotation_euler = rotation
418
+ if props:
419
+ for prop in props:
420
+ prop.location = rand_location()
421
+ prop.rotation_euler = rand_rotation()
422
+ if WIREFRAMES:
423
+ for obj in WIREFRAMES:
424
+ obj.location += mathutils.Vector((random.uniform(0,1),random.uniform(0,1),random.uniform(0,1)))
425
+ obj.rotation_euler = rand_rotation()
426
+ if bpy.data.groups['Displays'].objects:
427
+ for display in bpy.data.groups['Displays'].objects:
428
+ display.location = rand_location()
429
+ rotate(display, index)
427
430
 
428
431
  def animation_routine(frame):
429
432
  assert len(CAMERA_PATH) >= NUMBER_OF_FRAMES
@@ -445,8 +448,9 @@ def animation_routine(frame):
445
448
  for obj in WIREFRAMES:
446
449
  obj.location += mathutils.Vector((0.1, 0.1, 0.1))
447
450
  obj.rotation_euler.rotate(mathutils.Euler((math.radians(2), math.radians(2), math.radians(5)), 'XYZ'))
448
- # for display in bpy.data.groups['Displays'].objects:
449
- # display.rotation_euler.x += math.radians(2)
451
+ if bpy.data.groups['Displays'].objects:
452
+ for display in bpy.data.groups['Displays'].objects:
453
+ display.rotation_euler.x += math.radians(2)
450
454
 
451
455
  def create_line(name, point_list, thickness = 0.002, location = (0, -10, 0)):
452
456
  # setup basic line data
@@ -1,6 +1,6 @@
1
1
  # Rendering script
2
2
  # Run by calling the blender executable with -b -P <script_name>
3
- # Use `debug()` to pry into the script
3
+ # Use `pry()` to pry into the script
4
4
  # DISCLAIMER: all of this could be done in a much more intelligent way (with more Python knowledge)
5
5
  # This is just what works for now for the needs of my current project
6
6
 
@@ -29,6 +29,7 @@ debug = (args.debug == 'True')
29
29
  path = str(args.path)
30
30
  animate = (args.animate == 'True')
31
31
  shots_number = int(args.shots_number)
32
+
32
33
  #####################################
33
34
  #####################################
34
35
  #####################################
@@ -49,6 +50,7 @@ WIREFRAMES = []
49
50
  VORONOIED = []
50
51
  OCEAN = []
51
52
  bpy.data.groups.new('Lines')
53
+ bpy.data.groups.new('Displays')
52
54
  LINES = bpy.data.groups['Lines'].objects
53
55
  for primitive in PRIMITIVES:
54
56
  bpy.data.groups.new(primitive.lower().title())
@@ -96,8 +98,8 @@ make_object_glossy(SUBJECT, YELLOW, 0.01)
96
98
  let_there_be_light(context.scene)
97
99
 
98
100
  if debug == False:
99
- exec(open(os.path.join(path + '/glitch3d/bpy/canvas', 'dreamatorium.py')).read())
100
- # exec(open(os.path.join(path + '/glitch3d/bpy/canvas', 'aether.py')).read())
101
+ # exec(open(os.path.join(path + '/glitch3d/bpy/canvas', 'dreamatorium.py')).read())
102
+ exec(open(os.path.join(path + '/glitch3d/bpy/canvas', 'aether.py')).read())
101
103
 
102
104
  print('Rendering images with resolution: ' + str(context.scene.render.resolution_x) + ' x ' + str(context.scene.render.resolution_y))
103
105
 
@@ -126,9 +128,11 @@ if debug == False:
126
128
  print("-------------------------- " + str(index) + " --------------------------")
127
129
  still_routine(index)
128
130
  look_at(SUBJECT)
131
+ bpy.context.scene.frame_set(int(context.scene.frame_end/(index+1)))
129
132
  shoot(output_name(model_path, index))
130
133
 
131
134
 
132
135
  print('FINISHED ¯\_(ツ)_/¯')
133
136
 
137
+ look_at(SUBJECT)
134
138
  shoot(output_name(model_path))
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Glitch3d
3
- VERSION = '0.2.3.1'
3
+ VERSION = '0.2.3.2'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glitch3d
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3.1
4
+ version: 0.2.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - pskl