<< MacRenderManへの出力 戻る Reflectシェーダよる環境マッピング >>

MacRenderManでShaderをコンパイル

googleコードだったか、PythonではしるShaderManで作成したシェーダをMacRenderManのShaderAppでコンパイルしようとしてみた。変数の宣言で難あり、書き換えたらなんとかコンパイルでき、レンダリングもできました。
gari.JPG

シェーダはこちら。

surface garigari (float Km = 1;)
{
point Nf1,Nf6;
color Id6,Itr6;
point PP1,temp_PP2;
float temp_f2;

Nf6 = faceforward( normalize(N), I );
Id6 = 0.8 * diffuse(Nf6);

Itr6 = 0;
if (0 != 0) {
illuminance(P, Nf6, PI)
Itr6 += Cl;
Itr6 *= 0;
}

temp_PP2 = (point(0.0,0.0,0.0) == point(0.0,0.0,0.0)) ? P : point(0.0,0.0
,0.0);
temp_PP2=transform("shader", temp_PP2);
temp_f2 = 2.0*noise(temp_PP2*10)-1.0;


PP1 = P;

Nf1 = normalize( ntransform("shader", N) );
PP1 += vtransform("shader", "current", Km * temp_f2 * vector Nf1);
N = calculatenormal(PP1);
P = PP1;

Ci = (color(0,0.5,1) * (Id6 + Itr6 + color(0,0,0))+temp_f2)+0;
Oi = 1;
}


こちらで実験してみた。レンダリング用のRIB。MacOS8.6、G3の300MHzで36秒でした。

#Option "searchpath" "shader" "@:c:/cutter/RmanNotes/"
Display "gari.tif" "file" "rgb"
#Display "gari" "framebuffer" "rgb"
Projection "perspective" "fov" 90
Format 640 480 1
PixelSamples 2 2
ShadingRate 0.5
#PixelFilter "box" 1 1

Translate 0 0 3.5

WorldBegin
LightSource "ambientlight" 1 "intensity" [0.2]
LightSource "distantlight" 2 "from" [1 1 -2] "to" [0 0 0] "intensity" [2]
Color 0.2 0.4 0.6

#Surface "likemouse3" "float repeatC" 20 "float fuzz" 0.0 "color layer_color" [1 0 0]
#Surface "kinta3" "float repeatC" 16 "color layer_color2" [1 0 1]
Attribute "displacementbound" "sphere" [0.8] "coordinatesystem" ["shader"]
Surface "garigari" "float Km" 0.8
#Polygon "P" [-2 2 0 -2 -2 0 2 -2 0 2 2 0] "st" [0 0 0 1 1 1 1 0]
#Rotate 90 1 0 0
Sphere 2 -2 2 360

WorldEnd
  • -
  • -

<< MacRenderManへの出力 戻る Reflectシェーダよる環境マッピング >>