diff --git a/src/product_gen/__pycache__/generate_product.cpython-35.pyc b/src/product_gen/__pycache__/generate_product.cpython-35.pyc index b006e0b..2248e5a 100644 Binary files a/src/product_gen/__pycache__/generate_product.cpython-35.pyc and b/src/product_gen/__pycache__/generate_product.cpython-35.pyc differ diff --git a/src/product_gen/__pycache__/generate_shades.cpython-35.pyc b/src/product_gen/__pycache__/generate_shades.cpython-35.pyc index 58fb9a3..393df69 100644 Binary files a/src/product_gen/__pycache__/generate_shades.cpython-35.pyc and b/src/product_gen/__pycache__/generate_shades.cpython-35.pyc differ diff --git a/src/product_gen/generate_product.py b/src/product_gen/generate_product.py index 7c53936..6d22ad8 100644 --- a/src/product_gen/generate_product.py +++ b/src/product_gen/generate_product.py @@ -4,10 +4,12 @@ import bpy import product_gen.generate_lamp import rendering.setup_scene import rendering.setup_renderer +from shapes.shape_description import _styles def generate(shape_parameters, output_prefix, is_final=False): - rendering.setup_renderer.setup_renderer(shape_parameters) + rendering.setup_renderer.setup_renderer(shape_parameters, + is_final) rendering.setup_scene.initialize_scene(shape_parameters) @@ -18,19 +20,13 @@ def generate(shape_parameters, output_prefix, is_final=False): product_gen.generate_lamp.optimize_for_render(models) # Set up materials and textures - color = (0.1, 0.1, 0.1) - - colors = [(0.1, 0.1, 0.1), - (0.68, 0.68, 0.68), - (0.033, 0.065, 0.376), - (0.019, 0.202, 0.032)] - color = random.choice(colors) + style = _styles[shape_parameters["style"]] if "bio" not in shape_parameters["shape"]: - colormap = {"shade": color, - "base": (132.0/255.0, 64.0/255.0, 11.0/255.0), - "chord": (5.0/255.0, 5.0/255.0, 5.0/255.0)} + colormap = {"shade": style["shade"], + "base": style["base"], + "chord": style["chord"]} else: - colormap = {"shade": color} + colormap = {"shade": style["shade"]} product_gen.generate_lamp.apply_textures(colormap, models) @@ -39,15 +35,8 @@ def generate(shape_parameters, output_prefix, is_final=False): # Do rendering prefix = os.getcwd() + "/" + output_prefix + "/" + output_prefix if is_final: - bpy.context.scene.render.filepath = prefix + "_kitchen.png" - bpy.ops.render.render(write_still=True) - - bpy.context.scene.render.filepath = prefix + "_hall.png" - bpy.ops.render.render(write_still=True) - - bpy.context.scene.render.filepath = prefix + "_landing.png" - bpy.ops.render.render(write_still=True) - + bpy.context.scene.render.filepath = prefix + "_highres.png" + bpy.ops.render.render(write_still=True) else: bpy.context.scene.render.filepath = prefix + ".png" bpy.ops.render.render(write_still=True) diff --git a/src/product_gen/generate_shades.py b/src/product_gen/generate_shades.py index 935677f..8f913ad 100644 --- a/src/product_gen/generate_shades.py +++ b/src/product_gen/generate_shades.py @@ -122,7 +122,6 @@ def generate_mesh_shade(shape_parameters): radius1-shape_parameters["fixture_radius"], morph_type=shape_parameters["division_pattern"]) rad += shape_parameters["fixture_radius"] - print(radius1, rad, shape_parameters["fixture_radius"]) vert.co.x += rad if vert.co.x>max_rad: max_rad = vert.co.x diff --git a/src/rendering/__pycache__/setup_renderer.cpython-35.pyc b/src/rendering/__pycache__/setup_renderer.cpython-35.pyc index dff92fa..cdaa08a 100644 Binary files a/src/rendering/__pycache__/setup_renderer.cpython-35.pyc and b/src/rendering/__pycache__/setup_renderer.cpython-35.pyc differ diff --git a/src/rendering/__pycache__/setup_scene.cpython-35.pyc b/src/rendering/__pycache__/setup_scene.cpython-35.pyc index 0f7582e..8ffb209 100644 Binary files a/src/rendering/__pycache__/setup_scene.cpython-35.pyc and b/src/rendering/__pycache__/setup_scene.cpython-35.pyc differ diff --git a/src/rendering/setup_renderer.py b/src/rendering/setup_renderer.py index 2a608fe..90b84cc 100644 --- a/src/rendering/setup_renderer.py +++ b/src/rendering/setup_renderer.py @@ -1,13 +1,12 @@ import bpy -def setup_renderer(shape_parameters, engine="CYCLES"): +def setup_renderer(shape_parameters, is_final=False, engine="CYCLES"): # Set up and do the render this_scene = bpy.context.scene if engine=="CYCLES": this_scene.render.engine = 'CYCLES' - this_scene.cycles.device = 'CPU' - this_scene.cycles.samples = 12.0 + this_scene.cycles.samples = 100.0 this_scene.cycles.caustics_reflective = False this_scene.cycles.caustics_refractive = False this_scene.cycles.max_bounces = 0.0 @@ -17,9 +16,17 @@ def setup_renderer(shape_parameters, engine="CYCLES"): this_scene.render.border_min_y = 0.33 this_scene.render.border_min_x = 0.25 this_scene.render.border_max_x = 0.65 - this_scene.render.resolution_x = 600.0 - this_scene.render.resolution_y = 600.0 + if is_final: + this_scene.render.resolution_x = 1200.0 + this_scene.render.resolution_y = 1200.0 + else: + this_scene.render.resolution_x = 600.0 + this_scene.render.resolution_y = 600.0 this_scene.render.tile_x = 32 this_scene.render.tile_y = 32 - this_scene.render.resolution_percentage = 50.0 + + if is_final: + this_scene.render.resolution_percentage = 70.0 + else: + this_scene.render.resolution_percentage = 100.0 this_scene.render.image_settings.compression = 60.0 \ No newline at end of file diff --git a/src/rendering/setup_scene.py b/src/rendering/setup_scene.py index 5ae69b2..fb4c21a 100644 --- a/src/rendering/setup_scene.py +++ b/src/rendering/setup_scene.py @@ -43,7 +43,10 @@ def setup_scene(shape_parameters): xloc = 1.5 + (3.0*radius + height)/2.0 zloc = -0.4 - height - bpy.data.objects["Camera"].location = (xloc, 0.0000, zloc) + if shape_parameters["shape"] == "bio" or shape_parameters["shape"] == "led": + bpy.data.objects["Camera"].location = (13, 0.0000, -3.0) + else: + bpy.data.objects["Camera"].location = (xloc, 0.0000, zloc) fov = 65.0 bpy.data.objects["Camera"].data.angle = fov*(math.pi/180.0) diff --git a/src/shapes/__pycache__/shape_description.cpython-35.pyc b/src/shapes/__pycache__/shape_description.cpython-35.pyc index f510404..144771a 100644 Binary files a/src/shapes/__pycache__/shape_description.cpython-35.pyc and b/src/shapes/__pycache__/shape_description.cpython-35.pyc differ diff --git a/src/shapes/shape_description.py b/src/shapes/shape_description.py index 2944a2e..86f7e6a 100644 --- a/src/shapes/shape_description.py +++ b/src/shapes/shape_description.py @@ -10,24 +10,28 @@ _shape_description = {"shape": "pendant", "fixture_radius": 0.3, "fixture_length": 0.3, "stem_length": 0.5, - "style": "dark"} + "style": "initial"} -_styles = {"dark" : {"shade": (0.1, 0.1, 0.1), - "chord": (0.05, 0.05, 0.05), - "base": (0.05, 0.05, 0.05), +_styles = { "dark" : {"shade": (0.68, 0.68, 0.6), + "chord": (5.0/255.0, 5.0/255.0, 5.0/255.0), + "base": (132.0/255.0, 64.0/255.0, 11.0/255.0), "use_wall": True, "wall": (0.9, 0.9, 0.9)}, - "billard": {"shade": (0.1, 0.1, 0.1), - "chord": (0.05, 0.05, 0.05), - "base": (0.05, 0.05, 0.05), + "initial" : {"shade": (0.1, 0.1, 0.1), + "chord": (5.0/255.0, 5.0/255.0, 5.0/255.0), + "base": (132.0/255.0, 64.0/255.0, 11.0/255.0), "use_wall": True, "wall": (0.9, 0.9, 0.9)}, - "light": {"shade": (0.1, 0.1, 0.1), - "chord": (0.05, 0.05, 0.05), - "base": (0.05, 0.05, 0.05), + "billard": {"shade": (0.033, 0.065, 0.376), + "chord": (5.0/255.0, 5.0/255.0, 5.0/255.0), + "base": (132.0/255.0, 64.0/255.0, 11.0/255.0), "use_wall": True, - "wall": (0.9, 0.9, 0.9)}, - } + "wall": (0.9, 0.9, 0.9)}, + "light": {"shade": (0.019, 0.202, 0.032), + "chord": (5.0/255.0, 5.0/255.0, 5.0/255.0), + "base": (132.0/255.0, 64.0/255.0, 11.0/255.0), + "use_wall": True, + "wall": (0.9, 0.9, 0.9)}, } _division_types = ["linear", "logistic", @@ -44,11 +48,10 @@ def get_random_shape_description(shape, bbox, feature_min): shape_description = copy.deepcopy(_shape_description) shape_description["shape"] = shape feature_radius = feature_min[0] + random.random()*(bbox[0]-feature_min[0]) - #feature_height = 0.8*feature_radius feature_height = feature_min[1] + random.random()*(bbox[1]-feature_min[1]) shape_description["height"] = feature_height shape_description["radius"] = feature_radius shape_description["division_pattern"] = random.choice(_division_types) - shape_description["style"] = random.choice(list(_styles.keys())) + shape_description["style"] = "initial" return shape_description \ No newline at end of file diff --git a/src/utility/apply_texture.py b/src/utility/apply_texture.py index b0f57e6..a81949e 100644 --- a/src/utility/apply_texture.py +++ b/src/utility/apply_texture.py @@ -4,6 +4,7 @@ import ast import random import json import product_gen.generate_product +from shapes.shape_description import _styles from argparse import ArgumentParser @@ -24,10 +25,12 @@ if __name__ == "__main__": shape_parameters["height"] = float(shape_params["height"]) shape_parameters["radius"] = float(shape_params["radius"]) shape_parameters["fixture_radius"] = float(shape_params["fixture_radius"]) - shape_parameters["division_offsets"] = [float(x) for x in shape_params["division_offsets"]] - shape_parameters["style"] = shape_params["style"] - shape_parameters["division_patterns"] = shape_params["division_patterns"] - shape_parameters["division_radii"] = [float(x) for x in shape_params["division_radii"]] + shape_parameters["fixture_length"] = float(shape_params["fixture_length"]) + shape_parameters["stem_length"] = float(shape_params["stem_length"]) + shape_parameters["style"] = random.choice(list(_styles.keys())) + shape_parameters["division_pattern"] = shape_params["division_pattern"] + shape_parameters["division_param1"] = float(shape_params["division_param1"]) + shape_parameters["division_param2"] = float(shape_params["division_param2"]) product_gen.generate_product.generate(shape_parameters, output) diff --git a/src/utility/final_render.py b/src/utility/final_render.py index d604219..545a861 100644 --- a/src/utility/final_render.py +++ b/src/utility/final_render.py @@ -24,9 +24,11 @@ if __name__ == "__main__": shape_parameters["height"] = float(shape_params["height"]) shape_parameters["radius"] = float(shape_params["radius"]) shape_parameters["fixture_radius"] = float(shape_params["fixture_radius"]) - shape_parameters["division_offsets"] = [float(x) for x in shape_params["division_offsets"]] + shape_parameters["fixture_length"] = float(shape_params["fixture_length"]) + shape_parameters["stem_length"] = float(shape_params["stem_length"]) shape_parameters["style"] = shape_params["style"] - shape_parameters["division_patterns"] = shape_params["division_patterns"] - shape_parameters["division_radii"] = [float(x) for x in shape_params["division_radii"]] + shape_parameters["division_pattern"] = shape_params["division_pattern"] + shape_parameters["division_param1"] = float(shape_params["division_param1"]) + shape_parameters["division_param2"] = float(shape_params["division_param2"]) product_gen.generate_product.generate(shape_parameters, output, is_final=True) diff --git a/src/utility/test789/test789.blend b/src/utility/test789/test789.blend index 7df6d4e..98cb08b 100644 Binary files a/src/utility/test789/test789.blend and b/src/utility/test789/test789.blend differ diff --git a/src/utility/test789/test789.blend1 b/src/utility/test789/test789.blend1 index 6f33a89..eaa1fa2 100644 Binary files a/src/utility/test789/test789.blend1 and b/src/utility/test789/test789.blend1 differ diff --git a/src/utility/test789/test789.json b/src/utility/test789/test789.json index 721d409..05df0ab 100644 --- a/src/utility/test789/test789.json +++ b/src/utility/test789/test789.json @@ -1 +1 @@ -{"shape": "cone", "fixture_length": 0.3, "stem_length": 0.5, "style": "billard", "radius": 1.298856337538413, "division_pattern": "logistic", "division_param1": 1.0, "division_param2": 1.0, "output": "test789", "height": 2.2653976569924654, "fixture_radius": 0.3} \ No newline at end of file +{"division_param2": 1.0, "radius": 1.8509219558134604, "stem_length": 0.5, "division_param1": 1.0, "division_pattern": "hyperbolic_tan", "output": "test789", "shape": "bio", "style": "dark", "height": 1.3296018884322776, "fixture_radius": 0.3, "fixture_length": 0.3} \ No newline at end of file diff --git a/src/utility/test789/test789.png b/src/utility/test789/test789.png index 675c9bd..c0466be 100644 Binary files a/src/utility/test789/test789.png and b/src/utility/test789/test789.png differ diff --git a/src/utility/test91011/test91011.blend b/src/utility/test91011/test91011.blend new file mode 100644 index 0000000..842338c Binary files /dev/null and b/src/utility/test91011/test91011.blend differ diff --git a/src/utility/test91011/test91011.blend1 b/src/utility/test91011/test91011.blend1 new file mode 100644 index 0000000..2217a04 Binary files /dev/null and b/src/utility/test91011/test91011.blend1 differ diff --git a/src/utility/test91011/test91011.json b/src/utility/test91011/test91011.json new file mode 100644 index 0000000..ca25b79 --- /dev/null +++ b/src/utility/test91011/test91011.json @@ -0,0 +1 @@ +{"stem_length": 0.5, "division_param1": 1.0, "fixture_length": 0.3, "output": "test91011", "height": 2.3703425509577607, "division_pattern": "sinusoid", "division_param2": 1.0, "style": "light", "shape": "cone", "radius": 1.1040660329988414, "fixture_radius": 0.3} \ No newline at end of file diff --git a/src/utility/test91011/test91011.png b/src/utility/test91011/test91011.png new file mode 100644 index 0000000..841946f Binary files /dev/null and b/src/utility/test91011/test91011.png differ