Monday, August 03, 2009

Structure SynthとSunflowで反射する床を描画する

Structure SynthとSunflowで反射する床を描画するには、以下のスクリプトを実行します。


1 * { x -50 z -50 } 100 * { x 1 } 100 * { z 1 } 1 * { s 0.95 color #f0f0f0 } box::shiny

1 * { x -22.5 y -11.5 } 6 * { x 7.5 } 2 * { y 11.5 } frame8
{ x -19 } wall4
{ x 30.5 } wall4
{ x -21.5 z 19.5 } wall40z
{ x 33 z 19.5 } wall40z
{ x -10 z 10 ry 20 } chair

rule chair {
{ y 1.5 s 2 1 2 color #f0f0e0 } box
{ z -1.25 y 2 s 2 3 0.5 color #f0f0e0 } box
{ x -1.25 y 1.5 z -0.25 s 0.5 2 2.5 color #f0f0e0 } box
{ x 1.25 y 1.5 z -0.25 s 0.5 2 2.5 color #f0f0e0 } box
}

rule frame8 {
{ y 0.75 s 8 0.5 0.5 color #303030 } box
{ y 12.25 s 8 0.5 0.5 color #303030 } box
{ x -3.75 y 6.5 s 0.5 12 0.5 color #303030 } box
{ x 3.75 y 6.5 s 0.5 12 0.5 color #303030 } box
}

rule wall4 {
{ x -2 y 12.25 s 4 23.5 1 color #f0f0f0 } box
}

rule wall40z {
{ x -2 y 12.25 s 1 23.5 40 color #f0f0f0 } box
}


Structure Synthでの出力画像


以下のテンプレートを使用してSunflowのシーンファイルを作成してレンダリングします。


<template defaultExtension="Sunflow scene file (*.sc)" name="Sunflow" runAfter="%SUNFLOW%\sunflow.bat "$FILE" -o "$FILE.png"" >
<description>
shiny template.

Original template by Syntopia.
The Sunflow coloring was added by Tom Beddard ('subblue')
</description>
<primitive name="begin" ><![CDATA[
%photons {
% caustics 10000000 kd 64 0.5
%}

%% common settings
image {
resolution {width} {height}
aa 0 2
}

gi {
type ambocc
bright { "sRGB nonlinear" 1 1 1 }
dark { "sRGB nonlinear" 0 0 0 }
samples 64
maxdist 3.0
}

accel bih
filter mitchell
bucket 32 spiral

%% camera
camera {
type pinhole
eye {CamPosX} {CamPosY} {CamPosZ}
target {CamTargetX} {CamTargetY} {CamTargetZ}
up {CamUpX} {CamUpY} {CamUpZ}
fov {fov}
aspect {aspect}
}


%% scene background - comment out if not needed
background {
% color { "sRGB nonlinear" {BR} {BG} {BB} }
color { "sRGB nonlinear" 0.3 0.5 0.8 }
}


%% geometry
object {
shader none
transform col 0.001 0 0 0 0 0.001 0 0 0 0 0.001 0 0 0 0 1
type generic-mesh
name "Box"
points 8
1 1 1
1 0 1
0 0 1
0 1 1
0 1 0
0 0 0
1 0 0
1 1 0

triangles 12
0 3 2
0 2 1
2 3 4
2 4 5
3 0 7
3 7 4
0 1 6
0 6 7
1 2 5
1 5 6
5 4 7
5 7 6
normals none
uvs none
}
]]></primitive>
<primitive name="end" ><![CDATA[

]]></primitive>
<primitive name="box" ><![CDATA[
shader {
name "shader{uid}"
type diffuse
diff { "sRGB nonlinear" {r} {g} {b} }
}

instance {
name "{uid}"
geometry "Box"
transform col {matrix}
shader "shader{uid}"
}
]]></primitive>
<primitive type="shiny" name="box" ><![CDATA[
shader {
name "shader{uid}"
type shiny
diff { "sRGB nonlinear" {r} {g} {b} }
refl 0.4
}

instance {
name "{uid}"
geometry "Box"
transform col {matrix}
shader "shader{uid}"
}
]]></primitive>

<primitive name="sphere" ><![CDATA[
shader {
name "shader{uid}"
type diffuse
diff { "sRGB nonlinear" {r} {g} {b} }
}

object {
shader "shader{uid}"
type sphere
c {cx} {cy} {cz}
r {rad}
}
]]></primitive>
</template>



Sunflowでの出力画像

No comments:

Post a Comment