Turn off GPU

This commit is contained in:
jmsgrogan 2017-10-25 10:19:55 +01:00
parent c4e4b090b6
commit 2604e3889a
3 changed files with 27 additions and 7 deletions

View file

@ -8,7 +8,7 @@ def generate_models(shape_parameters):
# Shade # Shade
if shape_parameters["shape"] == "mesh": if shape_parameters["shape"] == "mesh":
shade = gs.generate_mesh_shade(shape_parameters) shade = gs.generate_mesh_shade(shape_parameters)
elif shape_parameters["shape"] == "led": elif shape_parameters["shape"] == "led" or "bio":
shade = gs.generate_led_shade(shape_parameters) shade = gs.generate_led_shade(shape_parameters)
else: # default pendant else: # default pendant
shade = gs.generate_pendant_shade(shape_parameters) shade = gs.generate_pendant_shade(shape_parameters)

View file

@ -6,7 +6,7 @@ def setup_renderer(shape_parameters, engine="CYCLES"):
this_scene = bpy.context.scene this_scene = bpy.context.scene
if engine=="CYCLES": if engine=="CYCLES":
this_scene.render.engine = 'CYCLES' this_scene.render.engine = 'CYCLES'
this_scene.cycles.device = 'GPU' this_scene.cycles.device = 'CPU'
this_scene.cycles.samples = 12.0 this_scene.cycles.samples = 12.0
this_scene.cycles.caustics_reflective = False this_scene.cycles.caustics_reflective = False
this_scene.cycles.caustics_refractive = False this_scene.cycles.caustics_refractive = False

View file

@ -1,17 +1,37 @@
import numpy as np import numpy as np
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
height = 10 height = 3
radius = 2 radius = 2
base_radius = 0.5 base_radius = 0.5
base_length = 1.0 base_length = 0.3
def morph_shape(x, L, H, morph_type="linear"):
y = np.ones(x.shape[0])
if morph_type == "linear":
y = (x/L)*H
elif morph_type == "logistic":
k = 10.0
v = 1.0
y = H/(1.0 + np.power(np.exp(-k*(x-L/4.0)), v))
elif morph_type == "sinusoid":
y = np.sin((x/L)*np.pi/2.0)
elif morph_type == "hyperbolic_tan":
y = np.tanh((x/L)*np.pi/2.0)
elif morph_type == "circle":
y = np.tanh((x/L)*np.pi/2.0)
return y
x_base = np.linspace(0, base_length, 10) x_base = np.linspace(0, base_length, 10)
y_base = base_radius*np.ones(x_base.shape[0]) y_base = base_radius*np.ones(x_base.shape[0])
x_lamp = np.linspace(base_length, height, 100) x_lamp = np.linspace(base_length, height, 100)
y_lamp = base_radius + ((x_lamp)/height)*(radius-base_radius) y_lamp = base_radius + morph_shape(x_lamp-base_length,
height-base_length,
radius-base_radius,
"hyperbolic_tan")
x = np.append(x_base, x_lamp) x = np.append(x_base, x_lamp)
y = np.append(y_base, y_lamp) y = np.append(y_base, y_lamp)
plt.plot(x, y) plt.plot(x, y)
@ -19,5 +39,5 @@ plt.plot(x, y)
axes = plt.gca() axes = plt.gca()
axes.set_xlim([0, 1.1*base_length+height]) axes.set_xlim([0, 1.1*base_length+height])
axes.set_ylim([0,1.1*radius]) axes.set_ylim([0,1.1*radius])
plt.axis('equal')
plt.show() plt.show()