Upgrade lighting setup and change to 600x600 px.
This commit is contained in:
parent
d4ac6705e5
commit
565ded39fc
28 changed files with 157 additions and 91139 deletions
|
@ -1,6 +1,7 @@
|
|||
import bpy
|
||||
from mathutils import Vector
|
||||
import bmesh
|
||||
import math
|
||||
|
||||
def NormalInDirection(normal, direction, limit = 0.99):
|
||||
return abs(direction.dot( normal )) > limit
|
||||
|
@ -13,6 +14,47 @@ def UpOrDown(normal):
|
|||
return True
|
||||
return False
|
||||
|
||||
def generate_pendant_shade(radius1, radius2, depth):
|
||||
|
||||
bpy.ops.mesh.primitive_cylinder_add(radius=radius1,
|
||||
depth=depth)
|
||||
cone = bpy.data.objects["Cylinder"]
|
||||
cone.name = "shade"
|
||||
bpy.ops.object.mode_set(mode='EDIT')
|
||||
|
||||
for idx in range(3):
|
||||
bpy.ops.mesh.subdivide()
|
||||
|
||||
bm = bmesh.from_edit_mesh(cone.data)
|
||||
for i in range( len( bm.verts ) ):
|
||||
bm.verts.ensure_lookup_table()
|
||||
vert = bm.verts[i]
|
||||
theta = math.atan2(vert.co.x, vert.co.y)
|
||||
delta = abs(vert.co.z-depth/2.0)
|
||||
|
||||
mapped_rad = radius2 + delta**2
|
||||
vert.co.x = mapped_rad*math.sin(theta)
|
||||
vert.co.y = mapped_rad*math.cos(theta)
|
||||
|
||||
for face in bm.faces:
|
||||
if UpOrDown(face.normal):
|
||||
face.select = True
|
||||
else:
|
||||
face.select = False
|
||||
faces_select = [f for f in bm.faces if f.select]
|
||||
bmesh.ops.delete(bm, geom=faces_select, context=3)
|
||||
bmesh.update_edit_mesh(cone.data, True)
|
||||
|
||||
# Extrude faces
|
||||
bpy.ops.mesh.select_mode( type = 'FACE' )
|
||||
bpy.ops.mesh.select_all( action = 'SELECT' )
|
||||
bpy.ops.mesh.extrude_region_move(
|
||||
TRANSFORM_OT_translate={"value":(0, 0, 0.01)} )
|
||||
bpy.ops.mesh.extrude_region_shrink_fatten(
|
||||
TRANSFORM_OT_shrink_fatten={"value":-0.05})
|
||||
bpy.ops.object.mode_set(mode='OBJECT')
|
||||
return cone
|
||||
|
||||
def generate_cone_shade(radius1, radius2, depth):
|
||||
|
||||
bpy.ops.mesh.primitive_cone_add(radius1=radius1,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue