Low-poly virus modeling.
1
2from coat import *
3import random
4
5
6ui.toRoom("Retopo")
7
8ui.cmd("$TopToolSelectAndOperate")
9
10
11mesh = Model.fromRetopo()
12
13mesh.dropUndo()
14
15
16mesh.clear()
17
18sphere = Mesh.sphere(radius = 10)
19
20mesh += sphere
21
22
23n = mesh.vertsCount()
24
25verts = []
26
27for i in range(0, 100):
28
29 index = random.randint(0, n)
30
31 pos = mesh.getVertex(index)
32 fail = False
33 for j in range(0, len(verts)):
34
35 if mesh.getVertex(verts[j]).distance(pos) < 5:
36 fail = True
37 break
38
39 if not fail : verts.append(index)
40
41mesh.setSelectedVertices(verts, [])
42
43
44mesh.bevelOverSelectedVertices(0.5)
45
46
47profile = [[4,1], [1,4], [0.5,1], [0.25, 0.5]]
48
49for r in profile:
50
51 mesh.extrudeSelected()
52
53 mesh.moveSelectedFacesAlongFacesNormals(r[0])
54
55 mesh.scaleSelectedFacesClusters(r[1])
56
57mesh.unselectAllFaces()
58
59mesh.subdivide(True)
60mesh.subdivide(True)
61
62mesh.displayOptions(showWireframe=False, showColored=False, smoothView=True)
63