<< simpleFaceシェーダ 戻る RibFilter その5 環境マップ生成2 >>

RibFilter その4 環境マップ生成

RMRサイトのサンプルを参考にRibFilterで環境マップとポイントライト3つ分のシャドーマップを出力してみた。
envr01.jpg

元RIBは以下の通りに設定

#env01.rib
Display "envr_kyu.tiff" "file" "rgb"
Projection "perspective" "fov" [25 ]
Rotate 24.094801 1 0 0
Rotate -26.5651 0 1 0
Translate 2.5 2.5 5
WorldBegin
LightSource "ambientlight" 1 "intensity" [0.05 ]
LightSource "pointlight" 2 "intensity" [40 ] "from" [-4 -5 -7]
LightSource "pointlight" 3 "intensity" [40 ] "from" [3.5 6.5 -6]
LightSource "pointlight" 4 "intensity" [10 ] "from" [4 7 6]
AttributeBegin
Attribute "identifier" "name" [ "_EV_n1" ]
Surface "shinymetal" "string texturename" ["env"]
Translate 0 0 0
Sphere 1 -1 1 360
AttributeEnd
Surface "plastic"
TransformBegin
Scale 20 20 20
Color [1 0 0]
Polygon "P" [-0.5 -0.5 0.5 0.5 -0.5 0.5 0.5 -0.5 -0.5 -0.5 -0.5 -0.5 ]
Color [0 0 1]
Polygon "P" [-0.5 -0.5 0.5 -0.5 -0.5 -0.5 -0.5 0.5 -0.5 -0.5 0.5 0.5 ]
Color [0 1 0]
Polygon "P" [0.5 0.5 -0.5 0.5 0.5 0.5 -0.5 0.5 0.5 -0.5 0.5 -0.5 ]
Color [1 0 1]
Polygon "P" [0.5 0.5 -0.5 0.5 -0.5 -0.5 0.5 -0.5 0.5 0.5 0.5 0.5 ]
Color [1 1 0]
Polygon "P" [0.5 -0.5 0.5 -0.5 -0.5 0.5 -0.5 0.5 0.5 0.5 0.5 0.5 ]
Color [0.6 0.6 0.6]
Polygon "P" [-0.5 0.5 -0.5 -0.5 -0.5 -0.5 0.5 -0.5 -0.5 0.5 0.5 -0.5 ]
TransformEnd
WorldEnd

球体に周囲の環境を映り込ませる。
pointlightは、shadowpointに変換された。
シャドーマップ生成RIBが3つ
env01.rib.sdwRib.2
env01.rib.sdwRib.3
env01.rib.sdwRib.4

T02001 {ERROR} Can't open texture "env" [ Object: _EV_n1 Shader: shinymetal] (System Error: No such file or directory)
と出るが、無視してシャドーマップ作成。

次に環境マップ生成、シャドーマップを利用して6面作成する。
影も映ります。こんな感じ・・・
FrameBegin 1
#env01.rib

Display "env01.rib.envImg.1px" "file" "rgb"
Format 128 128 1
ShadingRate 1.000000
Option "limits" "zthreshold" [0.5 0.5 0.5]
Option "shadow" "bias0" [0.15] "bias1" [0.2]
Option "limits" "texturememory" [4096]
Projection "perspective" "fov" [92]
Rotate -90 0 1 0
Translate 0 0 0
Translate -0 -0 -0
WorldBegin
LightSource "ambientlight" 1 "intensity" [0.05 ]
LightSource "shadowpoint" 2 "intensity" [40 ] "from" [-4 -5 -7] "width" [2] "float samples" [32] "string sfpx" ["env01.rib.sdwMap.2px"] "string sfpy" ["env01.rib.sdwMap.2py"] "string sfpz" ["env01.rib.sdwMap.2pz"] "string sfnx" ["env01.rib.sdwMap.2nx"] "string sfny" ["env01.rib.sdwMap.2ny"] "string sfnz" ["env01.rib.sdwMap.2nz"]
LightSource "shadowpoint" 3 "intensity" [40 ] "from" [3.5 6.5 -6] "width" [2] "float samples" [32] "string sfpx" ["env01.rib.sdwMap.3px"] "string sfpy" ["env01.rib.sdwMap.3py"] "string sfpz" ["env01.rib.sdwMap.3pz"] "string sfnx" ["env01.rib.sdwMap.3nx"] "string sfny" ["env01.rib.sdwMap.3ny"] "string sfnz" ["env01.rib.sdwMap.3nz"]
LightSource "shadowpoint" 4 "intensity" [10 ] "from" [4 7 6] "width" [2] "float samples" [32] "string sfpx" ["env01.rib.sdwMap.4px"] "string sfpy" ["env01.rib.sdwMap.4py"] "string sfpz" ["env01.rib.sdwMap.4pz"] "string sfnx" ["env01.rib.sdwMap.4nx"] "string sfny" ["env01.rib.sdwMap.4ny"] "string sfnz" ["env01.rib.sdwMap.4nz"]
AttributeBegin
Attribute "identifier" "name" [ "_EV_n1" ]
Surface "shinymetal" "string texturename" ["env"]
Translate 0 0 0
AttributeEnd
Surface "plastic"
TransformBegin
Scale 20 20 20
Color [1 0 0]
Polygon "P" [-0.5 -0.5 0.5 0.5 -0.5 0.5 0.5 -0.5 -0.5 -0.5 -0.5 -0.5 ]
Color [0 0 1]
Polygon "P" [-0.5 -0.5 0.5 -0.5 -0.5 -0.5 -0.5 0.5 -0.5 -0.5 0.5 0.5 ]
Color [0 1 0]
Polygon "P" [0.5 0.5 -0.5 0.5 0.5 0.5 -0.5 0.5 0.5 -0.5 0.5 -0.5 ]
Color [1 0 1]
Polygon "P" [0.5 0.5 -0.5 0.5 -0.5 -0.5 0.5 -0.5 0.5 0.5 0.5 0.5 ]
Color [1 1 0]
Polygon "P" [0.5 -0.5 0.5 -0.5 -0.5 0.5 -0.5 0.5 0.5 0.5 0.5 0.5 ]
Color [0.6 0.6 0.6]
Polygon "P" [-0.5 0.5 -0.5 -0.5 -0.5 -0.5 0.5 -0.5 -0.5 0.5 0.5 -0.5 ]
TransformEnd
WorldEnd
FrameEnd
・・・・・

最後にレンダリング
env01.rib.scnRib
コメントアウトとサイズを加える。
#Option "limits" "zthreshold" [0.5 0.5 0.5]
#Option "shadow" "bias0" [0.15] "bias1" [0.2]
#Option "limits" "texturememory" [4096]
Format 640 480 1
Display "envr01.tiff" "file" "rgb"

ポイントライトの影が出たのはうれしい。なかなか面白いところ、ほかにも実験してみます。
ありがとうございます。
  • -
  • -

<< simpleFaceシェーダ 戻る RibFilter その5 環境マップ生成2 >>