Mesh lights in reasonable condition now.

This commit is contained in:
jmsgrogan 2017-10-25 12:26:10 +01:00
parent 83d88728c5
commit 7925c4b926
13 changed files with 40 additions and 30 deletions

View file

@ -27,7 +27,7 @@ def generate_models(shape_parameters):
location) location)
# Chord # Chord
radius = 0.05 radius = 0.05
height = 6.0 height = 10.0
location = (0.0, 0.0, height/2.0) location = (0.0, 0.0, height/2.0)
chord = product_gen.generate_lamp_base.generate_chord(height, chord = product_gen.generate_lamp_base.generate_chord(height,
radius, radius,

View file

@ -117,7 +117,7 @@ def generate_mesh_shade(shape_parameters):
if abs(vert.co.z)<shape_parameters["stem_length"]: if abs(vert.co.z)<shape_parameters["stem_length"]:
rad = shape_parameters["fixture_radius"] rad = shape_parameters["fixture_radius"]
else: else:
rad = morph_shape(1.8*(abs(vert.co.z)-shape_parameters["stem_length"]), rad = morph_shape(1.0*(abs(vert.co.z)-shape_parameters["stem_length"]),
depth-shape_parameters["stem_length"], depth-shape_parameters["stem_length"],
radius1-shape_parameters["fixture_radius"], radius1-shape_parameters["fixture_radius"],
morph_type=shape_parameters["division_pattern"]) morph_type=shape_parameters["division_pattern"])

View file

@ -12,6 +12,7 @@ def setup_renderer(shape_parameters, engine="CYCLES"):
this_scene.cycles.caustics_refractive = False this_scene.cycles.caustics_refractive = False
this_scene.cycles.max_bounces = 0.0 this_scene.cycles.max_bounces = 0.0
this_scene.render.use_border = False this_scene.render.use_border = False
this_scene.render.use_simplify = True
this_scene.render.border_max_y = 0.75 this_scene.render.border_max_y = 0.75
this_scene.render.border_min_y = 0.33 this_scene.render.border_min_y = 0.33
this_scene.render.border_min_x = 0.25 this_scene.render.border_min_x = 0.25

View file

@ -11,35 +11,44 @@ def initialize_scene(shape_parameters):
def setup_scene(shape_parameters): def setup_scene(shape_parameters):
# Set up world # Set up world
bpy.context.scene.world.use_sky_paper = True use_backwall = False
bpy.context.scene.world.horizon_color = (0.99, 0.8, 0.8) if not use_backwall:
#bpy.context.scene.world.light_settings.use_environment_light = True bpy.context.scene.world.use_sky_paper = True
bpy.context.scene.world.horizon_color = (1.0, 1.0, 1.0)
# Add back wall #bpy.context.scene.world.light_settings.use_environment_light = True
bpy.ops.mesh.primitive_plane_add(radius=20, location=(-10.0, 0.0, 0.0))
bpy.ops.transform.rotate(value=math.pi/2.0, axis=(0.0,1.0,0.0))
bpy.data.objects["Plane"].name = "back_wall"
mat = bpy.data.materials.get("backwall-material")
if mat is None:
mat = bpy.data.materials.new("backwall-material")
mat.diffuse_color = (0.25, 0.25, 0.25)
mat.specular_color = (0.25, 0.25, 0.25)
mat.diffuse_intensity = 1.0
mat.specular_intensity = 1.0
bpy.context.scene.objects.active = bpy.data.objects["back_wall"]
if bpy.context.active_object.data.materials:
# assign to 1st material slot
bpy.context.active_object.data.materials[0] = mat
else: else:
# no slots
bpy.context.active_object.data.materials.append(mat) # Add back wall
bpy.ops.mesh.primitive_plane_add(radius=20, location=(-10.0, 0.0, 0.0))
bpy.ops.transform.rotate(value=math.pi/2.0, axis=(0.0,1.0,0.0))
bpy.data.objects["Plane"].name = "back_wall"
mat = bpy.data.materials.get("backwall-material")
if mat is None:
mat = bpy.data.materials.new("backwall-material")
mat.diffuse_color = (0.25, 0.25, 0.25)
mat.specular_color = (0.25, 0.25, 0.25)
mat.diffuse_intensity = 1.0
mat.specular_intensity = 1.0
bpy.context.scene.objects.active = bpy.data.objects["back_wall"]
if bpy.context.active_object.data.materials:
# assign to 1st material slot
bpy.context.active_object.data.materials[0] = mat
else:
# no slots
bpy.context.active_object.data.materials.append(mat)
# Set up cameras # Set up cameras
bpy.data.objects["Camera"].location = (8.5, 0.0, -2) radius = shape_parameters["radius"]
height = shape_parameters["height"]
xloc = 1.5 + (3.0*radius + height)/2.0
zloc = -0.4 - height
bpy.data.objects["Camera"].location = (xloc, 0.0000, zloc)
fov = 65.0 fov = 65.0
bpy.data.objects["Camera"].data.angle = fov*(math.pi/180.0) bpy.data.objects["Camera"].data.angle = fov*(math.pi/180.0)
bpy.data.objects["Camera"].rotation_mode = 'XYZ' bpy.data.objects["Camera"].rotation_mode = 'XYZ'
bpy.data.objects["Camera"].rotation_euler[0] = 1.5 bpy.data.objects["Camera"].rotation_euler[0] = 1.9326
bpy.data.objects["Camera"].rotation_euler[1] = 0.0 bpy.data.objects["Camera"].rotation_euler[1] = 0.0
bpy.data.objects["Camera"].rotation_euler[2] = 1.5708 bpy.data.objects["Camera"].rotation_euler[2] = 1.5708

View file

@ -23,12 +23,12 @@ if __name__ == "__main__":
os.makedirs(os.getcwd() + "/" + output) os.makedirs(os.getcwd() + "/" + output)
# Global bounding box # Global bounding box
bbox_xmax = 5.0 bbox_xmax = 3.0
bbox_ymax = 4.0 bbox_ymax = 3.0
# Minimum feature sizes # Minimum feature sizes
feature_xmin = 2.0 feature_xmin = 1.0
feature_ymin = 0.5 feature_ymin = 1.0
shape_parameters = sd.get_random_shape_description(shape, shape_parameters = sd.get_random_shape_description(shape,
[bbox_xmax, bbox_ymax], [bbox_xmax, bbox_ymax],
[feature_xmin, feature_ymin]) [feature_xmin, feature_ymin])

Binary file not shown.

Binary file not shown.

View file

@ -1 +1 @@
{"division_param1": 1.0, "division_param2": 1.0, "stem_length": 0.5, "fixture_length": 0.3, "style": "billard", "radius": 3.687568125159161, "output": "test789", "shape": "mesh", "division_pattern": "circle", "fixture_radius": 0.3, "height": 3.6552215108138246} {"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}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 141 KiB

After

Width:  |  Height:  |  Size: 19 KiB