ログインしてさらにmixiを楽しもう

コメントを投稿して情報交換!
更新通知を受け取って、最新情報をゲット!

そのPC、レンダリング中につきコミュのVirtuaLight

  • mixiチェック
  • このエントリーをはてなブックマークに追加
今さらですが、バージョン1.4からフリーで開発中です。
最近のHDRIの手法も使えて、これから実験していきたいと思います。

コメント(12)

//Box01.vib 試しに練習その1と解説
// VirtuaLight VIB-Structure

ReadArchive "defshaders.vs"

Camera [ (2,3,-7),(0,1,0),(0,1,0) FieldOfView 40 Format(320, 240) FrameAspectRatio 4/3 ]

Background '.098039, .098039, .392157'*0.9

PointLight [ (-50,50, -50) Intensity i ]
PointLight [ (55,40, -40) Intensity i ]
PointLight [ (-20,40, 55) Intensity i/4 LightingAttributes SPECULAR ]

Shape [ Box((-1,0,1), (1,2,-1)) primitive ]

Shape [ Disk((0,0,0), (0,1,0), 500) ground ]
まず、物体は必ず、原点(0,0,0)に定義されます。
そして、どのように移動したり、回転させたり、
座標位置について確認しましょう。

VirtuaLightの座標は左手で示される親指がX、ひとさし指がY、中指がZとなります。

■ファイルbox01.vibの説明。
// VirtuaLight VIB-Structure //はコメントアウトを示します。

ReadArchive "defshaders.vs" //色、質感をあらかじめ設定したvsファイルです。

Camera [ (2,3,-7),(0,1,0),(0,1,0) FieldOfView 40 Format(320, 240) FrameAspectRatio 4/3 ]  //カメラ[カメラの位置(2,3,-7),カメラが見ているターゲット位置(0,1,0),カメラの向き(0,1,0),レンズの画角40,レンダリングのサイズ320*240pixels


Background '.098039, .098039, .392157'*0.9 //背景の色合い、RGBで表現。*0.9は明るさを調整します。
★ 0.1から10までの数字を入れて背景の色がどのように変化するか確認してみましょう。

PointLight [ (-50,50, -50) Intensity i ]
PointLight [ (55,40, -40) Intensity i ]
PointLight [ (-20,40, 55) Intensity i/4 LightingAttributes SPECULAR ]
//各ライトの位置を示します。Intensityは明るさです。iはdefshaders.vsで
i = '.65,.65,.65'と定義されています。
★ RGBで表現した数値を入力して確認してみましょう。
★ //をPointLightの前に加えて、ライトを消してみましょう。


Shape [ Box((-1,0,1), (1,2,-1)) primitive ]
//箱の一番長い対角線となる始点と終点の座標を示します。primitiveはdefshaders.vsで設定している色です。
Shape [ Disk((0,0,0), (0,1,0), 500) ground ]
//地面となる円盤です。中心位置と半径を示します。groundはdefshaders.vsで設定している色です。
■ファイルdefshaders.vs VIBファイルで定義していない質感などをあらかじめ書き込んでおきます。
---------------------------------------------------------------------
ReadArchive "statics.vib"
ReadArchive "colors.vib"

Declare ground = Shader [ PlainSurface [ Color '.9,.95,.95' Kd 0.9 ] ]

Declare primitive = Shader [ PlainSurface [ Color '.96, .8, .69' Kd 0.85 Ks(0.25,'1,1,1') Kr 0.1 BlinnSpecularBRDF 10 ] ]

Declare infocus = Shader [ PlainSurface [ Color '1, 0, 0' Kd 0.95 ] ]

Declare pink = Shader [ PlainSurface [ Color deep_pink Kd 0.9 ] ]

Declare greenY = Shader [ PlainSurface [ Color emerald_green Kd 0.9 ] ]

Declare blueZ = Shader [ PlainSurface [ Color blue Kd 0.9 ] ]

static i = '.65,.65,.65'
----------------------------------------------------------------------
「Z軸方向から眺める・・・」
■ファイルbox02z.vibで確認してみましょう。
カメラ位置をZ軸のマイナス方向側に置き、そこから見ています。

Camera [ (0,3,-6),(0,1,0),(0,1,0) FieldOfView 40 Format(320, 240) FrameAspectRatio 4/3 ]

★(0,3,-6)の数値だけを変更してみましょう。
-------------------------------------------
// VirtuaLight VIB-Structure

ReadArchive "defshaders.vs"

Camera [ (0,3,-6),(0,1,0),(0,1,0) FieldOfView 40 Format(320, 240) FrameAspectRatio 4/3 ]

Background '.098039, .098039, .392157'*0.9

PointLight [ (-50,50, -50) Intensity i ]
PointLight [ (55,40, -40) Intensity i ]
PointLight [ (-20,40, 55) Intensity i/4 LightingAttributes SPECULAR ]

Shape [ Box((-1,0,1), (1,2,-1)) primitive ]

Shape [ Disk((0,0,0), (0,1,0), 500) ground ]
---------------------------------------------------


「移動と回転」
■ファイルbox03.vibで確認してみましょう。
物体の定義を以下のようにしています。
Declare cube = Shape [ Box ((-1, -1, -1), (1, 1, 1)) ]
cube [ Rotate(0, -45, 0) Translate(0, 2, 0)]

ここで使っているcubeは、ユーザが定義した語です。予約語と重ならないようにしましょう。

Rotate(0, -45, 0) Translate(0, 2, 0)
cubeをY軸を中心に-45度回転。原点位置からY軸方向に2移動しています。
-------------------------------------------------
// VirtuaLight VIB-Structure

ReadArchive "defshaders.vs"

Camera [ (2,3,-7),(0,1,0),(0,1,0) FieldOfView 40 Format(320, 240) FrameAspectRatio 4/3 ]

Background '.098039, .098039, .392157'*0.9

PointLight [ (-50,50, -50) Intensity i ]
PointLight [ (55,40, -40) Intensity i ]
PointLight [ (-20,40, 55) Intensity i/4 LightingAttributes SPECULAR ]

Declare cube = Shape [ Box ((-1, -1, -1), (1, 1, 1)) ]

cube [ Rotate(0, -45, 0) Translate(0, 2, 0)]

Shape [ Disk((0,0,0), (0,1,0), 500) ground ]
-----------------------------------------------------
「物体のグループ化」
■ファイルbox04.vibで確認してみましょう。
物体の定義を以下のようにしています。
Declare cube = Shape [ Box ((-1, -1, -1), (1, 1, 1)) ]
Declare cube2 = Shape [ Cylinder((0,0,0), (0,3.5,0), .75) ]

Solid [cube+cube2 Rotate(0, 0, -45) Translate(0, 2, 0)]
cubeとcube2を合体させています。Z軸を中心に-45度回転。原点位置からY軸方向に2移動しています。
--------------------------------------
// VirtuaLight VIB-Structure

ReadArchive "defshaders.vs"

Camera [ (2,3,-7),(0,1,0),(0,1,0) FieldOfView 40 Format(320, 240) FrameAspectRatio 4/3 ]

Background '.098039, .098039, .392157'*0.9

PointLight [ (-50,50, -50) Intensity i ]
PointLight [ (55,40, -40) Intensity i ]
PointLight [ (-20,40, 55) Intensity i/4 LightingAttributes SPECULAR ]

Declare cube = Shape [ Box ((-1, -1, -1), (1, 1, 1)) ]
Declare cube2 = Shape [ Cylinder((0,0,0), (0,3.5,0), .75) ]

Solid [cube+cube2 Rotate(0, 0, -45) Translate(0, 2, 0)]

Shape [ Disk((0,0,0), (0,1,0), 500) ground ]
★課題「座標軸をつくろう」
■ファイルaxis01.vibで確認してみましょう。

Shape [ Sphere((0, 0.25, 0), 0.25) primitive ] //原点位置に茶色の半径0.25の球
Shape [ Sphere((1, 0.25, 0), 0.25) pink ] //X軸1の位置にピンクの球
Shape [ Sphere((0, 1.25, 0), 0.25) greenY ] //Y軸1.25の位置に緑色の球
Shape [ Sphere((0, 0.25, 1), 0.25) blueZ ] //Z軸1の位置に青の球
------------------------------------------------------
// VirtuaLight VIB-Structure


ReadArchive "defshaders.vs"

Camera [ (0,3,-6),(0,1,0),(0,1,0) FieldOfView 30 Format(320, 240) FrameAspectRatio 4/3 ]

Background '.098039, .098039, .392157'*0.9

PointLight [ (-50,50, -50) Intensity i ]
PointLight [ (55,40, -40) Intensity i ]
PointLight [ (-20,40, 55) Intensity i/4 LightingAttributes SPECULAR ]

Shape [ Sphere((0, 0.25, 0), 0.25) primitive ]
Shape [ Sphere((1, 0.25, 0), 0.25) pink ]
Shape [ Sphere((0, 1.25, 0), 0.25) greenY ]
Shape [ Sphere((0, 0.25, 1), 0.25) blueZ ]
----------------------------------------------------
★課題「座標軸をつくろう」2
■ファイルaxis02.vibで確認してみましょう。
軸を各方向に追加しました。
Shape [ Cylinder((0,0,0), (0,5,0), .08) primitive ] //長さ5、半径0.08のY軸
Shape [ Cylinder((0,0.25,0), (5,0.25,0), .08) primitive ] //X軸
Shape [ Cylinder((0,0.25,0), (0,0.25,5), .08) primitive ] //Z軸

なお、カメラ位置を(1,4,-6)に変更して、奥にあるZ軸が見えるようにしました。
---------------------------------------------------
// VirtuaLight VIB-Structure

ReadArchive "defshaders.vs"

Camera [ (1,4,-6),(0,1,0),(0,1,0) FieldOfView 40 Format(320, 240) FrameAspectRatio 4/3 ]

Background '.098039, .098039, .392157'*0.9

PointLight [ (-50,50, -50) Intensity i ]
PointLight [ (55,40, -40) Intensity i ]
PointLight [ (-20,40, 55) Intensity i/4 LightingAttributes SPECULAR ]

//Shape [ Box((-1,0,1), (1,2,-1)) primitive ]
Shape [ Sphere((0, 0.25, 0), 0.25) primitive ]
Shape [ Sphere((1, 0.25, 0), 0.25) pink ]
Shape [ Sphere((0, 1.25, 0), 0.25) greenY ]
Shape [ Sphere((0, 0.25, 1), 0.25) blueZ ]
Shape [ Cylinder((0,0,0), (0,5,0), .08) primitive ]
Shape [ Cylinder((0,0.25,0), (5,0.25,0), .08) primitive ]
Shape [ Cylinder((0,0.25,0), (0,0.25,5), .08) primitive ]
★課題「座標軸をつくろう」3
■ファイルaxis03.vibで確認してみましょう。
Shape [ Sphere((0, 0.25, 0), 0.25) primitive ]
Shape [ Sphere((1, 0.25, 0), 0.25) pink ]
Shape [ Sphere((2, 0.25, 0), 0.25) pink ] //追加 X2
Shape [ Sphere((3, 0.25, 0), 0.25) pink ] //追加 X3
Shape [ Sphere((4, 0.25, 0), 0.25) pink ] //追加 X4
Shape [ Sphere((0, 1.25, 0), 0.25) greenY ]
Shape [ Sphere((0, 2.25, 0), 0.25) greenY ] //追加 Y2
Shape [ Sphere((0, 3.25, 0), 0.25) greenY ] //追加 Y3
Shape [ Sphere((0, 4.25, 0), 0.25) greenY ] //追加 Y4
Shape [ Sphere((0, 0.25, 1), 0.25) blueZ ]
Shape [ Sphere((0, 0.25, 2), 0.25) blueZ ] //追加 Z2
Shape [ Sphere((0, 0.25, 3), 0.25) blueZ ] //追加 Z3
Shape [ Sphere((0, 0.25, 4), 0.25) blueZ ] //追加 Z4
Shape [ Cylinder((0,0,0), (0,5,0), .08) primitive ]
Shape [ Cylinder((0,0.25,0), (5,0.25,0), .08) primitive ]
Shape [ Cylinder((0,0.25,0), (0,0.25,5), .08) primitive ]

各軸に球体を追加しました

なお、カメラ位置を(2,4,-10)に変更しました。
------------------------------------------------------
// VirtuaLight VIB-Structure

ReadArchive "defshaders.vs"

Camera [ (2,4,-10),(0,1,0),(0,1,0) FieldOfView 40 Format(320, 240) FrameAspectRatio 4/3 ]

Background '.098039, .098039, .392157'*0.9

PointLight [ (-50,50, -50) Intensity i ]
PointLight [ (55,40, -40) Intensity i ]
PointLight [ (-20,40, 55) Intensity i/4 LightingAttributes SPECULAR ]

//Shape [ Box((-1,0,1), (1,2,-1)) primitive ]
Shape [ Sphere((0, 0.25, 0), 0.25) primitive ]
Shape [ Sphere((1, 0.25, 0), 0.25) pink ]
Shape [ Sphere((2, 0.25, 0), 0.25) pink ]
Shape [ Sphere((3, 0.25, 0), 0.25) pink ]
Shape [ Sphere((4, 0.25, 0), 0.25) pink ]
Shape [ Sphere((0, 1.25, 0), 0.25) greenY ]
Shape [ Sphere((0, 2.25, 0), 0.25) greenY ]
Shape [ Sphere((0, 3.25, 0), 0.25) greenY ]
Shape [ Sphere((0, 4.25, 0), 0.25) greenY ]
Shape [ Sphere((0, 0.25, 1), 0.25) blueZ ]
Shape [ Sphere((0, 0.25, 2), 0.25) blueZ ]
Shape [ Sphere((0, 0.25, 3), 0.25) blueZ ]
Shape [ Sphere((0, 0.25, 4), 0.25) blueZ ]
Shape [ Cylinder((0,0,0), (0,5,0), .08) primitive ]
Shape [ Cylinder((0,0.25,0), (5,0.25,0), .08) primitive ]
Shape [ Cylinder((0,0.25,0), (0,0.25,5), .08) primitive ]

Shape [ Disk((0,0,0), (0,1,0), 500) ground ]
★課題「座標軸をつくろう」4
「グループ化」
■ファイルaxis04.vibで確認してみましょう。
以下のように、定義し、全体を回転、移動させました。

Declare A = Shape [ Sphere((0, 0.25, 0), 0.25) primitive ]
Declare B = Shape [ Sphere((1, 0.25, 0), 0.25) pink ]
Declare C = Shape [ Sphere((2, 0.25, 0), 0.25) pink ]
Declare D = Shape [ Sphere((3, 0.25, 0), 0.25) pink ]
Declare E = Shape [ Sphere((4, 0.25, 0), 0.25) pink ]
Declare F = Shape [ Sphere((0, 1.25, 0), 0.25) greenY ]
Declare G = Shape [ Sphere((0, 2.25, 0), 0.25) greenY ]
Declare H= Shape [ Sphere((0, 3.25, 0), 0.25) greenY ]
Declare I = Shape [ Sphere((0, 4.25, 0), 0.25) greenY ]
Declare J = Shape [ Sphere((0, 0.25, 1), 0.25) blueZ ]
Declare K = Shape [ Sphere((0, 0.25, 2), 0.25) blueZ ]
Declare L = Shape [ Sphere((0, 0.25, 3), 0.25) blueZ ]
Declare M = Shape [ Sphere((0, 0.25, 4), 0.25) blueZ ]
Declare N = Shape [ Cylinder((0,0,0), (0,5,0), .08) primitive ]
Declare O = Shape [ Cylinder((0,0.25,0), (5,0.25,0), .08) primitive ]
Declare P = Shape [ Cylinder((0,0.25,0), (0,0.25,5), .08) primitive ]

Solid [ A+B+C+D+E+F+G+H+I+J+K+L+M+N+O+P Rotate(-45, 0, 0) Translate(0,1,0)] //回転と移動

★XYZのマイナス方向も加えて、軸を作ってみましょう。
--------------------------------------------------
// VirtuaLight VIB-Structure

ReadArchive "defshaders.vs"

Camera [ (2,4,-10),(0,1,0),(0,1,0) FieldOfView 40 Format(320, 240) FrameAspectRatio 4/3 ]

Background '.098039, .098039, .392157'*0.9

PointLight [ (-50,50, -50) Intensity i ]
PointLight [ (55,40, -40) Intensity i ]
PointLight [ (-20,40, 55) Intensity i/4 LightingAttributes SPECULAR ]

//Shape [ Box((-1,0,1), (1,2,-1)) primitive ]


Declare A = Shape [ Sphere((0, 0.25, 0), 0.25) primitive ]
Declare B = Shape [ Sphere((1, 0.25, 0), 0.25) pink ]
Declare C = Shape [ Sphere((2, 0.25, 0), 0.25) pink ]
Declare D = Shape [ Sphere((3, 0.25, 0), 0.25) pink ]
Declare E = Shape [ Sphere((4, 0.25, 0), 0.25) pink ]
Declare F = Shape [ Sphere((0, 1.25, 0), 0.25) greenY ]
Declare G = Shape [ Sphere((0, 2.25, 0), 0.25) greenY ]
Declare H= Shape [ Sphere((0, 3.25, 0), 0.25) greenY ]
Declare I = Shape [ Sphere((0, 4.25, 0), 0.25) greenY ]
Declare J = Shape [ Sphere((0, 0.25, 1), 0.25) blueZ ]
Declare K = Shape [ Sphere((0, 0.25, 2), 0.25) blueZ ]
Declare L = Shape [ Sphere((0, 0.25, 3), 0.25) blueZ ]
Declare M = Shape [ Sphere((0, 0.25, 4), 0.25) blueZ ]
Declare N = Shape [ Cylinder((0,0,0), (0,5,0), .08) primitive ]
Declare O = Shape [ Cylinder((0,0.25,0), (5,0.25,0), .08) primitive ]
Declare P = Shape [ Cylinder((0,0.25,0), (0,0.25,5), .08) primitive ]

Solid [ A+B+C+D+E+F+G+H+I+J+K+L+M+N+O+P Rotate(-45, 0, 0) Translate(0,1,0)]

Shape [ Disk((0,0,0), (0,1,0), 500) ground ]
-------------------------------------------------
訂正 最後の行に以下の地面を書き加えていない記事がありました。

Shape [ Disk((0,0,0), (0,1,0), 500) ground ]
VirtuaLightのインストール方法を解説します。

Windows XPの場合・・・・

?解凍したフォルダをそのまま,Cドライブにコピーしてください。フォルダ名を「vlight」にしました。

? マイコンピュータを右クリックしてプロパティを開けます。
または,右クリックで「管理」を開けます。
「コンピュータの管理」を右クリックして「プロパティ」を開けます。
「詳細設定」をクリック,「環境変数」の「設定」をクリックします。

?「システム環境変数」の「Path」をクリックします。

? 「編集」を押します。
「変数名」の書いてあるところの最後に,次の言葉を追加します。

;C:\vlight\bin

OKボタンを押します。

? 続いて「新規」のボタンをクリックします。

新たに VLIGHT_ROOT 変数を作成します。次のようにします。

変数名  VLIGHT_ROOT

変数名  C:\VLIGHT

? 以上を行ったら,OKボタンを押して,ウインドウを閉じていきます。

? BINフォルダにある,VLightGUI.exeをダブルクリックして,ExamplesのLevel1から、Box.vibをOpenしてみましょう。

? レンダリングして、うまく画像が出力されたら成功です。
VirtuaLightの入手先

http://www.3dvirtualight.com/

インターフェイスのマニュアル訳
http://hp.vector.co.jp/authors/VA020045/virtualight/virtualight.html

ちなみに、HDR画像の生成もできるから、面白いかも。
HDR Shopでいじってみましょう。

ログインすると、みんなのコメントがもっと見れるよ

mixiユーザー
ログインしてコメントしよう!

そのPC、レンダリング中につき 更新情報

そのPC、レンダリング中につきのメンバーはこんなコミュニティにも参加しています

星印の数は、共通して参加しているメンバーが多いほど増えます。