この作業から始める
発光看板を光らせたいけれど、文字は読ませたい
ベンチの向こうに光る行先表示。冷たい壁と暖色の照明で、夜の駅のワンカットを作りました。
Blender 5.3.0
作品用のモデルやテクスチャのダウンロードは不要です。下の教材で、形を組むところからカメラで撮るところまでを3回に分けて進めます。各段階で手を止めて、形や材質を自分の画面で確認できます。
製品名を押すと各解説書が開きます。Blenderの「編集」→「プリファレンス」→「アドオン」で上記の製品を有効にします。
作業中のファイルを保存し、「ファイル」→「新規」→「全般」を開きます。画面上の「Scripting」を開き、テキストエディターの「新規」を押します。下の「教材コード」を開いて全文をコピーし、テキストエディターに貼り付けます。
import bpy
import importlib
import math
import random
from math import cos, sin, pi, tau
from mathutils import Vector, Quaternion
def product_module(path):
base, _, sub = path.partition('.')
actual = next((a.module for a in bpy.context.preferences.addons if a.module.rsplit('.', 1)[-1] == base), None)
if actual is None:
raise RuntimeError('Enable the required SmartTools extension in Preferences: ' + base)
return importlib.import_module(actual + ('.' + sub if sub else ''))
def product_symbol(path, name):
module = product_module(path)
if hasattr(module, name):
return getattr(module, name)
return importlib.import_module(module.__name__ + '.' + name)
def drawing(scene):
builders=product_module('smart_shader_suite.builders')
def bx(name, loc, dim, m, r=0.04):
bpy.ops.mesh.primitive_cube_add(size=1, location=loc)
o = bpy.context.object
o.dimensions = dim
bpy.ops.object.transform_apply(location=False, rotation=False, scale=True)
return finish(o, name, m, r)
def finish(o, name, m, r=0):
o.name = name
o.data.materials.append(m)
if r:
be = o.modifiers.new('Highlight radius', 'BEVEL')
be.width = r
be.segments = 4
be.harden_normals = True
o.modifiers.new('Planar normals', 'WEIGHTED_NORMAL')
return o
def mat(name, c, metal=0, rough=0.4, em=0):
m = bpy.data.materials.new(name)
m.use_nodes = True
b = m.node_tree.nodes.get('Principled BSDF')
b.inputs['Base Color'].default_value = (*c, 1)
b.inputs['Roughness'].default_value = rough
b.inputs['Metallic'].default_value = metal
if em:
b.inputs['Emission Color'].default_value = (*c, 1)
b.inputs['Emission Strength'].default_value = em
return m
def shader(name, fn, c, **props):
m = bpy.data.materials.new(name)
getattr(builders, fn)(m, dict(base_color=[*c, 1], **props))
assert any((n.type == 'BSDF_PRINCIPLED' for n in m.node_tree.nodes))
return m
def brushed(name, c):
return shader(name, 'build_brushed_metal', c, roughness=0.29, anisotropy=0.48, brush_scale=145, detail_bump=0.014)
def aim(o, p):
o.rotation_euler = (Vector(p) - o.location).to_track_quat('-Z', 'Y').to_euler()
def light(name, pos, target, power, col, w, h=None):
d = bpy.data.lights.new(name, 'AREA')
d.energy = power
d.color = col
d.shape = 'RECTANGLE'
d.size = w
d.size_y = h or w
o = bpy.data.objects.new(name, d)
scene.collection.objects.link(o)
o.location = pos
aim(o, target)
def text_obj(name, body, loc, size, m, rot=(pi / 2, 0, 0), align='CENTER'):
cu = bpy.data.curves.new(name, 'FONT')
cu.body = body
cu.size = size
cu.align_x = align
cu.align_y = 'CENTER'
cu.extrude = 0.001
o = bpy.data.objects.new(name, cu)
scene.collection.objects.link(o)
o.location = loc
o.rotation_euler = rot
cu.materials.append(m)
return o
def shoot(pos, target, scale, lens=None):
cd = bpy.data.cameras.new('Art direction')
cam = bpy.data.objects.new('Art direction', cd)
scene.collection.objects.link(cam)
scene.camera = cam
cam.location = pos
aim(cam, target)
if lens:
cd.lens = lens
else:
cd.type = 'ORTHO'
cd.ortho_scale = scale
bpy.context.view_layer.update()
cd.smart_camlight_settings.rig_target_distance = (Vector(target) - cam.location).length
assert bpy.ops.smart_camlight_suite.create_camera_rig(camera_name=cam.name) == {'FINISHED'}
assert any((c.type == 'TRACK_TO' and c.target for c in cam.constraints))
world = bpy.data.worlds.new('Ambient')
scene.world = world
world.use_nodes = True
world.node_tree.nodes['Background'].inputs[0].default_value = (0.26, 0.34, 0.44, 1)
world.node_tree.nodes['Background'].inputs[1].default_value = 0.27
scene.render.engine = 'CYCLES'
scene.cycles.samples = 24
scene.cycles.use_denoising = True
scene.render.threads_mode = 'FIXED'
scene.render.threads = 5
scene.render.resolution_x = 1120
scene.render.resolution_y = 730
scene.render.resolution_percentage = 100
scene.render.image_settings.color_mode = 'RGB'
black = mat('Graphite', (0.016, 0.022, 0.029), 0.55, 0.28)
gold = brushed('Champagne brass', (0.61, 0.36, 0.13))
comp = product_symbol('smart_composite_suite', 'builders')
tile = mat('Glazed midnight tile', (0.027, 0.122, 0.135), 0.42, 0.29)
floor = mat('Wet basalt', (0.071, 0.09, 0.104), 0.64, 0.22)
amber = mat('Amber enamel', (0.82, 0.34, 0.042), 0.25, 0.34)
lamp = mat('Warm fluorescent', (1, 0.66, 0.32), 0, 0.32, 5)
mint = mat('Signal mint', (0.27, 0.92, 0.83), 0, 0.28, 4)
ink = mat('Ivory type', (0.93, 0.92, 0.73), 0, 0.28, 1.8)
bx('Platform plane', (0, 1, -0.19), (40, 34, 0.38), floor, 0.02)
for i in range(-7, 11):
bx('Station wall panel', (i * 1.35, 3.08, 1.75), (1.33, 0.2, 3.5), tile, 0.025)
bx('Wall coping', (i * 1.35, 2.93, 0.5), (1.31, 0.05, 0.055), gold, 0.012)
for i in range(-5, 9):
x = i * 2.9
bx('Roof girder', (x, 0.8, 3.73), (0.17, 6, 0.21), black, 0.015)
bx('Continuous strip', (x, 0.4, 3.575), (2.6, 0.07, 0.055), lamp, 0.013)
bx('Edge marker', (x, -2.2, 0.02), (2.85, 0.12, 0.025), amber, 0.008)
yield
for x in (-6, -2, 5.5, 10):
bx('Column', (x, 1.75, 1.7), (0.23, 0.25, 3.4), black, 0.027)
bx('Destination lightbox', (1.22, 2.79, 2.17), (4.8, 0.23, 1.03), gold, 0.065)
bx('Glass sign face', (1.22, 2.64, 2.17), (4.65, 0.085, 0.91), black, 0.035)
text_obj('Station number', '07', (-0.45, 2.59, 2.19), 0.7, lamp)
bx('Divider', (0.16, 2.57, 2.18), (0.017, 0.02, 0.68), mint, 0.005)
text_obj('Station name', 'NORTH PIER', (0.39, 2.58, 2.27), 0.42, ink, align='LEFT')
text_obj('Direction', 'NIGHT SERVICE / EASTBOUND', (0.4, 2.58, 1.96), 0.115, mint, align='LEFT')
for x in (0.1, 1.42, 2.74):
bx('Bench seat', (x, 1.28, 0.54), (1.2, 0.54, 0.085), gold, 0.035)
bx('Seat back', (x, 1.51, 0.84), (1.2, 0.075, 0.48), tile, 0.05)
for dx in (-0.41, 0.41):
bx('Bench foot', (x + dx, 1.27, 0.27), (0.05, 0.27, 0.5), black, 0.015)
light('Overhead puddle', (1, 1, 3.5), (1, 1, 0), 220, (0.42, 0.92, 0.87), 4, 1)
light('Offscreen carriage', (-3, -2.8, 2.1), (1, 2, 1.1), 410, (1, 0.56, 0.28), 3.7, 1)
yield
light('Blue night', (5, -0.9, 2.7), (0, 2, 1.0), 190, (0.32, 0.57, 1), 3)
tree = bpy.data.node_groups.new('Night station finish', 'CompositorNodeTree')
scene.compositing_node_group = tree
tree.interface.new_socket(name='Image', in_out='OUTPUT', socket_type='NodeSocketColor')
src = tree.nodes.new('CompositorNodeRLayers')
glare = tree.nodes.new('CompositorNodeGlare')
comp._configure_glare(glare, 'FOG_GLOW', 1.0, 0.37, 'HIGH')
out = tree.nodes.new('NodeGroupOutput')
tree.links.new(src.outputs['Image'], glare.inputs['Image'])
tree.links.new(glare.outputs['Image'], out.inputs['Image'])
assert out.inputs['Image'].is_linked
shoot((-3.5, -6.4, 2.02), (1.0, 2.38, 1.62), 1, 37)
yield
course_key = 'SmartTools lesson / platform'
session = bpy.app.driver_namespace
current = session.get(course_key)
if not current or current[0] != bpy.context.scene:
for required in ['smart_camlight_suite', 'smart_composite_suite', 'smart_shader_suite']:
product_module(required)
scene = bpy.data.scenes.new('Study / platform')
bpy.context.window.scene = scene
current = [scene, drawing(scene), 0]
session[course_key] = current
if current[2] < 3:
next(current[1])
current[2] += 1
current[0]['Lesson step'] = current[2]
bpy.context.view_layer.update()
テキストエディター上部の ▶「スクリプト実行」を1回ずつ、合計3回押します。1回目で教材専用シーンに切り替わります。各回の間に、3Dビューにカーソルを置き「Home」で全体を表示できます。

「ビュー」→「カメラ」→「アクティブカメラ」で上の掲載画像と構図を見比べます。「レンダー」→「画像をレンダリング」(F12)を選び、表示された画像の「画像」→「名前を付けて保存」でPNGを保存します。教材シーンを後から編集するには、.blendファイルも保存します。
「Compositing」を開き、グレアノードを選んでMで一時的に無効にします。F12で照明の輪郭を比較し、同じノードで再びMを押すと掲載時のにじみに戻せます。
途中でファイルを閉じた場合は、新規ファイルで教材を最初から実行してください。
文字の形は元のレンダーに残し、明るい部分から光が広がるように合成しています。
行先表示の文字に発光材質を割り当て、レンダーをコンポジターのグローに通します。数字の芯は読み取れ、明るい縁の周りだけに光が広がります。
レンダー画像に光のにじみ(グロー)を足すコンポジターのグローを設定し、発光文字と蛍光灯のハイライトを仕上げました。
同じホーム、同じカメラで、看板と天井灯の輪郭を比較します。Fog Glowの有無だけを切り替えました。
前の図ではスザンヌの輪郭がくっきりしていますが、後の図では輪郭の周りに丸く光がにじみ、影の縁にも色がかかっています。
実画面で確かめる金属の枠と座面にヘアライン材を使い、暖かい照明を拾わせました。
SmartTools Shader の操作を見る ↗全機能と操作解説ホームの手前からベンチと案内板を同時に捉えるターゲット式のカメラを置きました。
SmartTools CamLight の操作を見る ↗全機能と操作解説2027年1月1日発売予定。表示は税込・買い切り価格です。
発光看板を光らせたいけれど、文字は読ませたい
掲載した単品の合計 ¥3,660
この作品で使った収録製品
SmartTools Composite · SmartTools Shader · SmartTools CamLight
セットで掲載機能を揃える場合 ¥4,980
掲載機能だけなら、単品の合計が¥1,320安くなります。
ほかに含まれる製品例
SmartTools Paint · SmartTools Node