アニメ『Sushitown ~あるスシのくらし~』
NHKの「プレ基礎英語」のアニメです。寿司たちが人間のように喋ります。これを見てると寿司が食べたくなるんです。しかも踊り食いです。ところで寿司屋の湯のみって、魚へんの漢字がいっぱい書いてあるタイプの湯のみが多いですよね。魚へんが並んでると、湯のみまで美味しく見えます。
タイトル絵は、円柱に魚へんの漢字のテキストを貼り付けた画像です。円柱なのでお茶は飲めません。(そのうち湯のみにします)
ではUVマッピングするためのUnwrapから始めます。下は円柱にちょうどよい継ぎ目を入れてUnwrapするスクリプトです。
~$ cat -n cylinder-unwrap.sh
1 #!/bin/bash
2 cat <<EOL>/tmp/tmp.py
3
4 import bpy,bmesh
5
6 bpy.ops.object.delete()
7 bpy.ops.mesh.primitive_cylinder_add()
8 bpy.ops.object.mode_set(mode='EDIT')
9 bpy.ops.mesh.select_mode(type='EDGE')
10
11 mesh=bmesh.from_edit_mesh(bpy.context.object.data)
12
13 bpy.ops.mesh.select_all(action='DESELECT')
14 mesh.edges[0].select = True
15 for i in range(0,32):
16 mesh.edges[i*3+1].select = True
17 mesh.edges[i*3+2].select = True
18
19 bpy.context.scene.objects.active = bpy.context.scene.objects.active
20 bpy.ops.mesh.mark_seam()
21
22 bpy.ops.mesh.select_all(action='SELECT')
23 bpy.ops.uv.unwrap()
24
25 EOL
26 blender -P /tmp/tmp.py
起動したら、UVEDITORを起動します。
外部ツールで塗り絵するので、exportします。
Gimpを起動して、薄い青色に塗りました。
続いて魚へんの漢字を並べて貼り付けます。
作った塗り絵は適当に名前をつけて(/tmp/blender/agari.png)保存します。
以下のスクリプトで、マッピングされた円柱ができます。
~$ cat -n agari.sh
1 #!/bin/bash
2 cat <<EOL>/tmp/tmp.py
3
4 import bpy,bmesh,math,os
5
6 bpy.ops.object.delete()
7 bpy.ops.mesh.primitive_cylinder_add()
8 bpy.ops.object.mode_set(mode='EDIT')
9 bpy.ops.mesh.select_mode(type='EDGE')
10
11 mesh=bmesh.from_edit_mesh(bpy.context.object.data)
12
13 bpy.ops.mesh.select_all(action='DESELECT')
14 mesh.edges[0].select = True
15 for i in range(0,32):
16 mesh.edges[i*3+1].select = True
17 mesh.edges[i*3+2].select = True
18
19 bpy.context.scene.objects.active = bpy.context.scene.objects.active
20 bpy.ops.mesh.mark_seam()
21
22 mat=bpy.data.materials.new('Material.001')
23 mat.emit=1
24 tex1 = bpy.data.textures.new('Tex1', type='IMAGE')
25 fname=os.path.expanduser('/tmp/blender/agari.png')
26 tex1.image = bpy.data.images.load(fname)
27 bpy.context.object.data.materials.append(mat)
28
29 mt=mat.texture_slots.add()
30 mat.texture_slots[0].texture=tex1
31 mt.texture_coords='OBJECT'
32
33 bpy.data.materials['Material.001'].texture_slots[0].texture = tex1
34 bpy.data.materials['Material.001'].texture_slots[0].texture_coords='UV'
35 bpy.ops.mesh.select_all(action='SELECT')
36 bpy.ops.uv.unwrap()
37
38 cy=bpy.data.objects['Cylinder']
39 cy.rotation_mode='XYZ'
40 cy.rotation_euler=(0, 0, math.pi/2)
41
42 EOL
43 blender -P /tmp/tmp.py


コメント