Add nicer coloring.

This commit is contained in:
jmsgrogan 2017-10-24 10:42:09 +01:00
parent 565ded39fc
commit 11d306f362
16 changed files with 14 additions and 10 deletions

View file

@ -25,8 +25,8 @@ def generate_models(shape, height, radius):
# Base # Base
radius1 = 0.3 radius1 = 0.3
radius2 = 0.2 radius2 = 0.07
depth = 0.2 depth = 0.5
location = (0.0, 0.0, height/2.0+depth/2.0) location = (0.0, 0.0, height/2.0+depth/2.0)
base = product_gen.generate_lamp_base.generate_cone_base(radius1, base = product_gen.generate_lamp_base.generate_cone_base(radius1,
radius2, radius2,

View file

@ -23,8 +23,8 @@ def generate(shape,
# Set up materials and textures # Set up materials and textures
colormap = {"shade": color, colormap = {"shade": color,
"base": (220.0/255.0, 220.0/255.0, 220.0/255.0), "base": (132.0/255.0, 64.0/255.0, 11.0/255.0),
"chord": (20.0/255.0, 20.0/255.0, 20.0/255.0)} "chord": (5.0/255.0, 5.0/255.0, 5.0/255.0)}
product_gen.generate_lamp.apply_textures(colormap, models) product_gen.generate_lamp.apply_textures(colormap, models)
rendering.setup_scene.setup_scene() rendering.setup_scene.setup_scene()

View file

@ -22,8 +22,8 @@ def setup_scene():
mat = bpy.data.materials.get("backwall-material") mat = bpy.data.materials.get("backwall-material")
if mat is None: if mat is None:
mat = bpy.data.materials.new("backwall-material") mat = bpy.data.materials.new("backwall-material")
mat.diffuse_color = (0.5, 0.5, 0.5) mat.diffuse_color = (0.25, 0.25, 0.25)
mat.specular_color = (0.5, 0.5, 0.5) mat.specular_color = (0.25, 0.25, 0.25)
mat.diffuse_intensity = 1.0 mat.diffuse_intensity = 1.0
mat.specular_intensity = 1.0 mat.specular_intensity = 1.0
bpy.context.scene.objects.active = bpy.data.objects["back_wall"] bpy.context.scene.objects.active = bpy.data.objects["back_wall"]

View file

@ -19,9 +19,12 @@ if __name__ == "__main__":
height = float(shape_params["height"]) height = float(shape_params["height"])
radius = float(shape_params["radius"]) radius = float(shape_params["radius"])
color = [random.random(),
random.random(), colors = [(0.1, 0.1, 0.1),
random.random()] (0.68, 0.68, 0.68),
(0.033, 0.065, 0.376),
(0.019, 0.202, 0.032)]
color = random.choice(colors)
product_gen.generate_product.generate(shape, height, radius, color, output) product_gen.generate_product.generate(shape, height, radius, color, output)
shape_parameters = shape_params shape_parameters = shape_params

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1 @@
{"height": "2.0", "radius": "0.6", "color": [0.1, 0.1, 0.1], "output": "test456", "shape": "cone"}

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 KiB

Binary file not shown.

Binary file not shown.

View file

@ -1 +1 @@
{"shape": "pendant", "radius": 0.5, "height": 1.5, "color": [0.1, 0.1, 0.1]} {"color": [0.1, 0.1, 0.1], "height": 1.5, "radius": 0.5, "shape": "pendant"}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 523 KiB

After

Width:  |  Height:  |  Size: 295 KiB