LoginSignup
1
1

More than 1 year has passed since last update.

Blnderでステンドグラス

Last updated at Posted at 2022-12-23

概要

YouTubeのささらBchさんの「【ステンドグラス】Blender M01-100」のアレンジです。

下記のようなステンドグラス化したスザンヌを作成します。

ポイントは、カラーランプのカラーモードをHSVにすると2色設定するだけでいろいろな色になるところです。

参考:Blenderで虹を作る

作成方法

細かい手順を説明するよりPythonで実行した方が簡単で間違いもないので、Pythonで作成します。
下記をコピペして実行してください。

import bpy

bpy.ops.mesh.primitive_monkey_add()
bpy.ops.object.modifier_add(type='WIREFRAME')
obj = bpy.context.object
mat = bpy.data.materials.new(name="frame")
obj.active_material = mat
mat.use_nodes = True
ndpb = mat.node_tree.nodes["Principled BSDF"]
ndpb.inputs[0].default_value = (0, 0, 0, 1)

bpy.ops.mesh.primitive_monkey_add()
obj = bpy.context.object
mat = bpy.data.materials.new(name="frame")
obj.active_material = mat
mat.use_nodes = True
ndpb = mat.node_tree.nodes["Principled BSDF"]
ndoi = mat.node_tree.nodes.new("ShaderNodeObjectInfo")
ndoi.location = -500, -110
ndcr = mat.node_tree.nodes.new("ShaderNodeValToRGB")
ndcr.location = -300, -110
ndcr.color_ramp.color_mode = 'HSV'
ndcr.color_ramp.hue_interpolation = 'CW'
ndcr.color_ramp.elements[0].color = (1, 0, 0, 1)
ndcr.color_ramp.elements[1].color = (1, 0, 0.01, 1)

mat.node_tree.links.new(ndoi.outputs[5], ndcr.inputs[0])
mat.node_tree.links.new(ndcr.outputs[0], ndpb.inputs[19])

bpy.ops.object.editmode_toggle()
bpy.ops.mesh.edge_split(type='EDGE')
bpy.ops.mesh.separate(type='LOOSE')
bpy.ops.object.editmode_toggle()

参考:BlenderでPythonを実行する方法

作成したマテリアルは、下記のようになります。

補足

下記のようにマテリアルでワイヤーフレームを表示させることもできます。

image.png

以上

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1