http://rman.sakura.ne.jp/sb/log/eid62.html
python2.7でcgkitを扱う。sitex airでレンダリング。Happy Buddha
cgkitの良いところは、RIBで出力した設定を挿入して、レンダラーに合わせて設定できるところ。Airspace(windows only)を使って、shaderやlightの設定を、レンダリングして、スクリプトを参考にcgkitに挿入した。
以下、スクリプトbuddha_air.py
ありがとうございます。
######################################################################
# Main file for rendering the landscape image
######################################################################
# sitex air renderer and python2.7 cgkit
g=Globals(rib="""Option "occlusion" "prepass" [1]
# the prepass uses indirect attributes for the occlusion call
Attribute "indirect" "maxerror" [0.1]
Attribute "indirect" "integer nsamples" 64
Attribute "indirect" "maxhitdist" 6
Attribute "indirect" "maxpixeldist" 10
Imager "background" "color background" [0.2 0.4 0.6]
Option "searchpath" "shader" "C:/Program Files (x86)/AIR//shaders:C:/Program Files (x86)/AIR//usershaders:&"
Imager "VBgEnvironment"
"float Intensity" [1]
"string EnvironmentName" ["C:/Program Files (x86)/AIR/texture/DebevecGroveProbe.tx"]
"string EnvironmentSpace" ["world"]
"float EnvironmentBlur" [0]
#UseFrames 0
Environment "envMap"
"string MapName" ["C:/Program Files (x86)/AIR/texture/DebevecGroveProbe.tx"]
"float MapIntensity" [1]
"float MapBlur" [0.01]
"float MapSamples" [4]
"string MapSpace" ["world"]
"float RotateX" [90]
"float RotateY" [0]
"float RotateZ" [0]
"float ReflectionVisibility" [1]
"float ReflectionIntensity" [1]
"float ReflectionAddBlur" [0]
"float IndirectVisibility" [1]
"float IndirectIntensity" [1]
"float IndirectAddBlur" [0]
"float CameraVisibility" [0]
"float CameraIntensity" [1]
"float CameraAddBlur" [0]
""",
resolution = (320, 240),
#pixelsamples=(4,4),
#shadingrate=0.25,
#pixelfilter=("gaussian",(2,2)),
up = (0,1,0),
background = (0.2,0.2,0.2)
)
######################################################################
# Camera
######################################################################
# Load the external camera (if it exists), otherwise use the camera for
# the final image
if os.path.exists("camera.py"):
load("camera.py")
else:
TargetCamera(
name = "Camera",
pos = (0.0729126, 0.641438, -2.2),
target = (0, 0, 0),
fov = 30
)
GLPointLight(
intensity = 0.1,
pos = (-50,30, -20),
diffuse = (1, 1, 1)
)
# ...and a distant light
dis=RMLightSource(name = "distant_0",shader=RMShader("distantlight",intensity=0.4))
dis.shader.declare('string shadowname="raytrace"')
dis.shader.declare('uniform point from=(-15,30,-30)')
# ...and a env light
env=RMLightSource(name = "env01",shader= RMShader("envlight"))
env.shader.declare('uniform color lightcolor=(.9,.9,1)')
env.shader.declare('uniform color shadowcolor=(.05,.05,0)')
# ...no indirect
# models and darktree shader
r=RIBArchive(
name ="butu_center",
filename = './butu.rib',
pos = (0,0,0)
)
r.rib='Attribute "visibility" "trace" [1]\nAttribute "visibility" "int transmission" [1]\nSurface "DarkTreeSurface"\n "string DarkTreeShader" ["C:/Users/yokamak/Documents/cgkit/DTRep_thumb/tx_stone/pvStone_Tan_Brown.dsts"]\n "float Diffuse" [1]\n "float Specular" [1]\n "float Reflection" [1]\n "float ReflectionSamples" [1]\n "float ReflectionBlur" [0]\n "string ReflectionName" ["raytrace"]\n "string ReflectionSpace" ["current"]\n "float Incandescence" [1]\n "float Use2DCoordinates" [0]\n "float[2] Texture2dSize" [1 1]\n "float[2] Texture2dOrigin" [0 0]\n "float Texture2dAngle" [0]\n "float Pattern3dSize" [1]\n "float[3] Pattern3dOrigin" [0 0 0]\n "string Pattern3dSpace" ["shader"]\n "float BumpScale" [1]\n "float TimeScale" [1]\n "string ColorTweak1Name" ["Color 1"]\n "color ColorTweak1" [0.682 0.556 0.513]\n "string ColorTweak2Name" ["Coor 2"]\n "color ColorTweak2" [0.545 0.466 0.439]\n "string ColorTweak3Name" ["Color 3"]\n "color ColorTweak3" [0.533 0.435 0.419]\n "string ColorTweak4Name" ["Color 4"]\n "color ColorTweak4" [0.654 0.65 0.545]\n "string ColorTweak5Name" ["Color 5"]\n "color ColorTweak5" [0.494 0.411 0.352]\n "string ColorTweak6Name" ["Water"]\n "color ColorTweak6" [0 0.192 0.388]\n "string FloatTweak1Name" ["Diffuse"]\n "float FloatTweak1" [1]\n "string FloatTweak2Name" ["Specular"]\n "float FloatTweak2" [0.75]\n "string FloatTweak3Name" ["Glossiness"]\n "float FloatTweak3" [0.35]\n "string FloatTweak4Name" ["Seed"]\n "float FloatTweak4" [1]\n "string FloatTweak5Name" ["Dark Specular"]\n "float FloatTweak5" [1]\n "string FloatTweak6Name" ["Light Specular"]\n "float FloatTweak6" [0]\n "string FloatTweak7Name" ["Dark Gloss"]\n "float FloatTweak7"\n'
t=RIBArchive(
name ="butu_left",
filename = './butu.rib',
pos = (0.5,0,0)
)
t.rib='Attribute "visibility" "trace" [1]\nAttribute "visibility" "int transmission" [1]\nSurface "DarkTreeSurface"\n "string DarkTreeShader" ["C:/Program Files (x86)/AIR/viztools/darktree/metalGoldTarnish.dsts"]\n "float Diffuse" [1]\n "float Specular" [1]\n "float Reflection" [1]\n "float ReflectionSamples" [1]\n "float ReflectionBlur" [0]\n "string ReflectionName" ["raytrace"]\n "string ReflectionSpace" ["current"]\n "float Incandescence" [1]\n "float Use2DCoordinates" [0]\n "float[2] Texture2dSize" [1 1]\n "float[2] Texture2dOrigin" [0 0]\n "float Texture2dAngle" [0]\n "float Pattern3dSize" [1]\n "float[3] Pattern3dOrigin" [0 0 0]\n "string Pattern3dSpace" ["shader"]\n "float BumpScale" [1]\n "float TimeScale" [1]\n "string ColorTweak1Name" ["Gold 1"]\n "color ColorTweak1" [0.913 0.85 0.615]\n "string ColorTweak2Name" ["Gold 2"]\n "color ColorTweak2" [0.878 0.701 0.349]\n "string ColorTweak3Name" ["Rust 1"]\n "color ColorTweak3" [0.294 0.211 0.172]\n "string FloatTweak1Name" ["Tarnish"]\n "float FloatTweak1" [0]\n "string FloatTweak2Name" ["Reflectivity"]\n "float FloatTweak2" [0.2]\n "string FloatTweak3Name" ["Input Seed"]\n "float FloatTweak3" [133]\n "string FloatTweak4Name" ["Glossiness"]\n "float FloatTweak4" [0.05]\n "string FloatTweak5Name" ["Metal Hightlight"]\n "float FloatTweak5" [0.75]\n "string FloatTweak6Name" [""]\n "float FloatTweak6" [0.5]\n "string FloatTweak7Name" [""]\n "float FloatTweak7" [0.5]\n'
s=RIBArchive(
name ="butu_right",
filename = './butu.rib',
pos = (-0.5,0,0)
)
s.rib='Attribute "visibility" "trace" [1]\nAttribute "visibility" "int transmission" [1]\n Surface "DarkTreeSurface"\n "string DarkTreeShader" ["C:/Users/yokamak/Documents/cgkit/DTRep_thumb/ba_shader/MetallicPaintShader.dsts"]\n "float Diffuse" [1]\n "float Specular" [1]\n "float Reflection" [1]\n "float ReflectionSamples" [1]\n "float ReflectionBlur" [0]\n "string ReflectionName" ["raytrace"]\n "string ReflectionSpace" ["current"]\n "float Incandescence" [1]\n "float Use2DCoordinates" [0]\n "float[2] Texture2dSize" [1 1]\n "float[2] Texture2dOrigin" [0 0]\n "float Texture2dAngle" [0]\n "float Pattern3dSize" [1]\n "float[3] Pattern3dOrigin" [0 0 0]\n "string Pattern3dSpace" ["shader"]\n "float BumpScale" [1]\n "float TimeScale" [1]\n "string ColorTweak1Name" ["Paint Color"]\n "color ColorTweak1" [0.247 0.572 0.929]\n "string ColorTweak2Name" ["Paint Color 2"]\n "color ColorTweak2" [0 0.289 1]\n "string ColorTweak3Name" ["Rust 1"]\n "color ColorTweak3" [0.294 0.211 0.172]\n "string ColorTweak4Name" ["Rust 2"]\n "color ColorTweak4" [0.439 0.239 0.203]\n "string ColorTweak5Name" ["Rust 3"]\n "color ColorTweak5" [0.313 0.266 0.239]\n "string ColorTweak6Name" ["Rust 4"]\n "color ColorTweak6" [0.556 0.301 0.066]\n "string FloatTweak1Name" ["Reflectivity"]\n "float FloatTweak1" [0.35]\n "string FloatTweak2Name" ["Metallic Specular"]\n "float FloatTweak2" [0.55]\n "string FloatTweak3Name" ["CC Specular"]\n "float FloatTweak3" [0.5]\n "string FloatTweak4Name" ["CC Gloss"]\n "float FloatTweak4" [0.9]\n "string FloatTweak5Name" ["Random Seed"]\n "float FloatTweak5" [95]\n "string FloatTweak6Name" ["Glossiness"]\n "float FloatTweak6" [0.15]\n "string FloatTweak7Name" ["Seed"]\n "float FloatTweak7" [6]\n'
pl = RMMaterial(
surface = RMShader("VWood"),
color = (1, 1, 1))
pl2 = RMMaterial(
surface = RMShader("VPhysicalMetal"),
color = (1, 1, 1))
glm=GLMaterial(diffuse=(0.8, 0.7, 0.7))
p01=Plane(
lx = 50,
ly = 50,
pos = (0,0,0.6),
rot= mat3().fromEulerXYZ(0, radians(180), 0)
)
p01.rib='Attribute "visibility" "trace" [1]\nAttribute "visibility" "shadow" [1]\n Surface "VShinyTile2D"\n "float Diffuse" [0.9]\n "float DiffuseRoughness" [0.3]\n "float Specular" [0.5]\n "float SpecularRoughness" [0.01]\n "float SpecularSharpness" [0.8]\n "float Reflection" [4.0]\n "float ReflectionSamples" [2]\n "float ReflectionBlur" [0]\n "string ReflectionName" ["raytrace"]\n "string ReflectionSpace" ["current"]\n "float[2] TileSize" [0.01 0.01]\n "float TileStagger" [0]\n "float TileColorVary" [0.1]\n "float GrooveWidth" [0.001]\n "float GrooveDepth" [0.008]\n "color GrooveColor" [0.98 0.98 0.98]\n "float BumpHeight" [0]\n "float BumpWidth" [0.0005]\n "float[2] TextureSizeXY" [0.25 0.25]\n "float[2] TextureOriginXY" [0 0]\n "float TextureAngle" [0]\n "string Projection" ["st"]\n "string ProjectionSpace" ["shader"]\n "float[16] ProjectionTransform" [1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1]'
#p01.rib='Attribute "visibility" "trace" [1]\nAttribute "visibility" "shadow" [1]\nSurface "VMetal"\n'
p02=Plane(
lx = 50,
ly = 50,
pos = (0,-0.44,0),
rot= mat3().fromEulerXYZ(radians(-90), 0, 0),
material = pl2
)
p02.rib='Attribute "visibility" "trace" [1]\nAttribute "visibility" "shadow" [1]\n'
- -
- -