2014年2月28日金曜日

【Blender】What Particles can be used for in Blender, beginner tutorial

Blenderのパーティクルのチュートリアル。




【Blender】TIP - Modeling with the Poke Tool

Poke Toolの使い方のチュートリアル。エディットモードでALT+Pで、

四角い面をクロスに分割してくれる。さらに追加された頂点部分だけを

操作できるので、面白い形状が作成できそうですね。










2014年2月13日木曜日

Blenderで音楽に合わせてオブジェクトを変化させるスクリプト

Blenderで音楽にあわせてオブジェクトが変化するアニメーションの
作成スクリプト。

http://www.morere.eu/local/cache-code/7006f73d4d11f359e51f8add3d0e82f4.txt

結構簡単なスクリプトでできるんですね。
参考になりそうです。
bpy.ops.graph.sound_bakeってところでmp3のファイルを解析してるんですね。

---------
import bpy
rows = 5
columns = 5
r = 0
c = 0
def spiral(X, Y):
    x = y = 0
    dx = 0
    dy = -1
    for i in range(max(X, Y)**2):
        if (-X/2 < x <= X/2) and (-Y/2 < y <= Y/2):
            print(x,y)
            bpy.ops.mesh.primitive_cube_add(location = (x, y, 0))
            bpy.context.scene.cursor_location = bpy.context.active_object.location
            bpy.context.scene.cursor_location.z -= 1
            bpy.ops.object.origin_set(type='ORIGIN_CURSOR')    
            ####
            bpy.context.active_object.scale.x = 0.5
            bpy.context.active_object.scale.y = 0.5
            bpy.context.active_object.scale.z = 3.5
            bpy.ops.object.transform_apply(scale=True)
    
            bpy.ops.anim.keyframe_insert_menu(type='Scaling')
            bpy.context.active_object.animation_data.action.fcurves[0].lock = True
            bpy.context.active_object.animation_data.action.fcurves[1].lock = True
            bpy.context.area.type = 'GRAPH_EDITOR'
    
            step = 19000/(rows*columns)
            bpy.ops.graph.sound_bake(filepath="/home/yann/Documents/articles_lpmag/article_blender_soundvisualizer/blend/Grace_Valhalla_-_99__.mp3", low=i*step, high=i*step + step)
    
            bpy.context.active_object.animation_data.action.fcurves[2].lock = True
        
            if x == y or (x < 0 and x == -y) or (x > 0 and x == 1-y):
                dx, dy = -dy, dx
        
            x, y = x+dx, y+dy
        
spiral(rows, columns)
bpy.context.area.type = 'TEXT_EDITOR'
----------

2014年2月11日火曜日

Blenderでバッチにてレンダリング(Windows)

Blenderでバッチ処理にてレンダリングするスクリプトを作ってみたのでメモ。

バッチファイル実行前に、コントロールパネル>システムのプロパティの詳細設定タブ>
環境変数で、blender.exeがあるフォルダ(C:\Program Files\Blender Foundation\Blender)にパスを追加してます。




こんな感じで変数値に『;C:\Program Files\Blender Foundation\Blender』を追加しました。

次に、レンダリング用のバッチファイルです。

※使用は個人の責任でお願いします。レンダリング後の
ファイルはrenderedフォルダに移動していますので、
同名のファイルは上書きされます!

---------------
render.bat
---------------
@echo off
set RENDERED_PATH=../rendered

echo "<<<<JPEG Rendering Start>>>>-------------------"
for %%A in (*.blend) do (
echo %%~fA
echo %%~nA_####.jpg
set FILE_NAME = %%~nA_####.jpg
blender -b %%~fA -o %RENDERED_PATH%/%%~nA_####.jpg -F JPEG -f 1
move %%~fA ../rendered/%%~nA.blend
)
echo "<<<<JPEG Rendering End>>>>-------------------"
---------------

フォルダ構成はこんな感じ。
レンダリング対象のブレンダーのファイルを配置しておく、renderフォルダと
レンダリング済みのファイルが配置されるrenderedがあります。


renderフォルダに、レンダリング対象のファイルを複数配置し、
render.batを実行します。
ブレンダーファイルは、レンダリングするだけの状態で、出力時の
解像度とかカメラ位置とかを決めて保存しておいてください。

render.batを実行するとこんな感じでBlenderがバックグラウンドで実行されます。
render.batは同一フォルダにあるブレンダーファイルをすべて
レンダリングしrenderedにjpgを出力し、処理済のブレンダーファイルを
renderedフォルダに移動します。



実行後にレンダリング結果のjpgとレンダリング済みのブレンダーファイルが
renderedフォルダに配置されます。

※renderedフォルダに同一ファイルが存在する場合は上書きされるので
注意してください。



こんな感じになります。


アニメーションのレンダリングとかはオプションが違ってくるので、
別のバッチファイルを用意しておけばよいかな。

2014年2月8日土曜日

VVVVって面白そうですね。

最近、VVVVって言語に魅かれてます。

BlenderでモデリングしてVVVVでアニメーションとか面白そうですなぁ。