1/4 >>
はじめてのFujiyama Renderer その1
Fujiyama Rendererをさわる。
CentOS6.3 x86_64でビルドした。
Python APIを利用する。
fujiyama.pyはbinフォルダに置いた。
座標空間は右手系 Y up。
fujiyama.pyを利用するには
$ export PYTHONPATH=$PYTHONPATH:/usr/lib/python2.6/site-packages/:$HOME/Fujiyama-Renderer/bin/
レンダリングはscenesフォルダから
scenes]$ python cube01.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#export PYTHONPATH=$PYTHONPATH:/usr/lib/python2.6/site-packages/:$HOME/Fujiyama-Renderer/bin/
import fujiyama
si = fujiyama.SceneInterface()
#plugins
si.OpenPlugin('ConstantShader')
si.OpenPlugin('PlasticShader')
si.OpenPlugin('GlassShader')
#Camera
si.NewCamera('cam1', 'PerspectiveCamera')
si.SetProperty3('cam1', 'translate', 0, 2, 6)
si.SetProperty3('cam1', 'rotate', -11.309932474020213, 0, 0)
#Light
si.NewLight('light1', 'PointLight')
si.SetProperty3('light1', 'translate', 10, 12, 10)
#Shader
si.NewShader('floor_shader', 'PlasticShader')
si.SetProperty3('floor_shader', 'diffuse', .2, .25, .3)
si.SetProperty1('floor_shader', 'ior', 2)
si.NewShader('cube_shader', 'PlasticShader')
si.SetProperty3('cube_shader', 'diffuse', .9, .2, .2)
si.NewShader('cube_shader3', 'PlasticShader')
si.SetProperty3('cube_shader3', 'diffuse', .1, .2, .8)
si.NewShader('cube_shader2', 'PlasticShader')
si.SetProperty3('cube_shader2', 'diffuse', .1, .95, .1)
si.NewShader('dome_shader', 'ConstantShader')
si.SetProperty3('dome_shader', 'diffuse', .8, .8, .8)
#Mesh
si.NewMesh('dome_mesh', '../mesh/dome.mesh')
si.NewMesh('floor_mesh', '../mesh/floor.mesh')
si.NewMesh('cube_mesh', '../mesh/cube.mesh')
#ObjectInstance
si.NewObjectInstance('cube1', 'cube_mesh')
si.AssignShader('cube1', 'cube_shader3')
si.SetProperty3('cube1', 'translate', 1.2,.6, 0)
si.SetProperty3('cube1', 'scale', .8,.8, .8)
si.NewObjectInstance('cube2', 'cube_mesh')
si.AssignShader('cube2', 'cube_shader2')
si.SetProperty3('cube2', 'translate', 0,.6, 0)
si.NewObjectInstance('cube3', 'cube_mesh')
si.AssignShader('cube3', 'cube_shader')
si.SetProperty3('cube3', 'translate', -1.2,.6, 0)
si.NewObjectInstance('floor1', 'floor_mesh')
si.AssignShader('floor1', 'floor_shader')
si.NewObjectInstance('dome1', 'dome_mesh')
si.AssignShader('dome1', 'dome_shader')
#FrameBuffer
si.NewFrameBuffer('fb1', 'rgba')
#Properties
si.ShowPropertyList('Renderer')
#Renderer
si.NewRenderer('ren1')
si.AssignCamera('ren1', 'cam1')
si.AssignFrameBuffer('ren1', 'fb1')
si.SetProperty2('ren1', 'resolution', 640, 480)
#si.SetProperty2('ren1', 'resolution', 160, 120)
si.SetProperty1('ren1', 'raymarch_step', .01)
si.SetProperty1('ren1', 'raymarch_shadow_step', .02)
si.SetProperty1('ren1', 'raymarch_reflect_step', .02)
#Rendering
si.RenderScene('ren1')
#Output
si.SaveFrameBuffer('fb1', '../cube01.fb')
#Run commands
si.Run()
#si.Print()
画像を見るには
$ fbview cube01.fb
OpenEXRに変換は
$ fb2exr cube01.fb cube01.exr
Light設定が変更
'translate'になった。
はじめてのFujiyama Renderer その2
Python API fujiyama.pyを利用。
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#export PYTHONPATH=$PYTHONPATH:/usr/lib/python2.6/site-packages/:$HOME/Fujiyama-Renderer/bin/
from math import *
import fujiyama
si = fujiyama.SceneInterface()
#plugins
si.OpenPlugin('ConstantShader')
si.OpenPlugin('PlasticShader')
si.OpenPlugin('GlassShader')
#Camera
si.NewCamera('cam1', 'PerspectiveCamera')
si.SetProperty3('cam1', 'translate', 0, 2, 6)
si.SetProperty3('cam1', 'rotate', -11.309932474020213, 0, 0)
#Light
si.NewLight('light1', 'PointLight')
si.SetProperty3('light1', 'position', 10, 12, 10)
#Shader
si.NewShader('floor_shader', 'PlasticShader')
si.SetProperty3('floor_shader', 'diffuse', .2, .25, .3)
si.SetProperty1('floor_shader', 'ior', 2)
si.NewShader('cube_shader', 'PlasticShader')
si.SetProperty3('cube_shader', 'diffuse', .9, .2, .2)
#si.NewShader('cube_shader3', 'PlasticShader')
#si.SetProperty3('cube_shader3', 'diffuse', .1, .2, .8)
#si.NewShader('cube_shader2', 'PlasticShader')
#si.SetProperty3('cube_shader2', 'diffuse', .1, .95, .1)
si.NewShader('dome_shader', 'ConstantShader')
si.SetProperty3('dome_shader', 'diffuse', .8, .8, .8)
#Mesh
si.NewMesh('dome_mesh', '../mesh/dome.mesh')
si.NewMesh('floor_mesh', '../mesh/floor.mesh')
si.NewMesh('cube_mesh', '../mesh/cube.mesh')
#ObjectInstance
N1=5
J=1
for i in range(5):
si.NewShader('cube_shader'+str(i), 'PlasticShader')
si.SetProperty3('cube_shader'+str(i), 'diffuse', 0.5*(1+sin(2*pi/N1*J)),0.5, 0.5*(1+cos(2*pi/N1*J)))
si.NewObjectInstance('cube'+str(i), 'cube_mesh')
si.AssignShader('cube'+str(i), 'cube_shader'+str(i))
si.SetProperty3('cube'+str(i), 'translate', i-2,.6, 0)
si.SetProperty3('cube'+str(i), 'scale', .8,.8, .8)
J+=1
si.NewObjectInstance('floor1', 'floor_mesh')
si.AssignShader('floor1', 'floor_shader')
si.NewObjectInstance('dome1', 'dome_mesh')
si.AssignShader('dome1', 'dome_shader')
#FrameBuffer
si.NewFrameBuffer('fb1', 'rgba')
#Properties
si.ShowPropertyList('Renderer')
#Renderer
si.NewRenderer('ren1')
si.AssignCamera('ren1', 'cam1')
si.AssignFrameBuffer('ren1', 'fb1')
si.SetProperty2('ren1', 'resolution', 640, 480)
#si.SetProperty2('ren1', 'resolution', 160, 120)
si.SetProperty1('ren1', 'raymarch_step', .01)
si.SetProperty1('ren1', 'raymarch_shadow_step', .02)
si.SetProperty1('ren1', 'raymarch_reflect_step', .02)
#Rendering
si.RenderScene('ren1')
#Output
si.SaveFrameBuffer('fb1', '../cube03.fb')
#Run commands
si.Run()
#si.Print()
はじめてのFujiyama Renderer その3
地道に試してみる。si.Print()はシーンファイルの出力です。
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#export PYTHONPATH=$PYTHONPATH:/usr/lib/python2.6/site-packages/:$HOME/Fujiyama-Renderer/bin/
from math import *
import fujiyama
si = fujiyama.SceneInterface()
#plugins
si.OpenPlugin('ConstantShader')
si.OpenPlugin('PlasticShader')
si.OpenPlugin('GlassShader')
#Camera
si.NewCamera('cam1', 'PerspectiveCamera')
si.SetProperty3('cam1', 'translate', 0, 2, 6)
si.SetProperty3('cam1', 'rotate', -11.309932474020213, 0, 0)
#Light
si.NewLight('light1', 'PointLight')
si.SetProperty3('light1', 'position', 10, 12, 10)
#Shader
si.NewShader('floor_shader', 'PlasticShader')
si.SetProperty3('floor_shader', 'diffuse', .2, .25, .3)
si.SetProperty1('floor_shader', 'ior', 2)
si.NewShader('cube_shader', 'PlasticShader')
si.SetProperty3('cube_shader', 'diffuse', .9, .2, .2)
#si.NewShader('cube_shader3', 'PlasticShader')
#si.SetProperty3('cube_shader3', 'diffuse', .1, .2, .8)
#si.NewShader('cube_shader2', 'PlasticShader')
#si.SetProperty3('cube_shader2', 'diffuse', .1, .95, .1)
si.NewShader('dome_shader', 'ConstantShader')
si.SetProperty3('dome_shader', 'diffuse', .8, .8, .8)
#Mesh
si.NewMesh('dome_mesh', '../mesh/dome.mesh')
si.NewMesh('floor_mesh', '../mesh/floor.mesh')
si.NewMesh('cube_mesh', '../mesh/cube.mesh')
#ObjectInstance
N1=16
J=1
while J<=N1:
si.NewShader('cube_shader'+str(J), 'PlasticShader')
si.SetProperty3('cube_shader'+str(J), 'diffuse', 0.5*(1+sin(2*pi/N1*J)),0.5, 0.5*(1+cos(2*pi/N1*J)))
si.NewObjectInstance('cube'+str(J), 'cube_mesh')
si.AssignShader('cube'+str(J), 'cube_shader'+str(J))
si.SetProperty3('cube'+str(J), 'translate', 1.7*sin(2*pi/N1*J),.4, 1.7*cos(2*pi/N1*J))
si.SetProperty3('cube'+str(J), 'rotate', 0,360/N1*J, 0)
si.SetProperty3('cube'+str(J), 'scale', .5,.5, .5)
J+=1
si.NewObjectInstance('floor1', 'floor_mesh')
si.AssignShader('floor1', 'floor_shader')
si.NewObjectInstance('dome1', 'dome_mesh')
si.AssignShader('dome1', 'dome_shader')
#FrameBuffer
si.NewFrameBuffer('fb1', 'rgba')
#Properties
si.ShowPropertyList('Renderer')
#Renderer
si.NewRenderer('ren1')
si.AssignCamera('ren1', 'cam1')
si.AssignFrameBuffer('ren1', 'fb1')
si.SetProperty2('ren1', 'resolution', 640, 480)
#si.SetProperty2('ren1', 'resolution', 160, 120)
si.SetProperty1('ren1', 'raymarch_step', .01)
si.SetProperty1('ren1', 'raymarch_shadow_step', .02)
si.SetProperty1('ren1', 'raymarch_reflect_step', .02)
#Rendering
si.RenderScene('ren1')
#Output
si.SaveFrameBuffer('fb1', '../cube04.fb')
#Run commands
si.Run()
#si.Print()
Thank you for your support.
ありがとうございます。
はじめてのFujiyama Renderer その4
Stanford Happy buddhaをレンダリングする。
jpegに変換するとねむくなるのでgimpでトーンカーブ調整する。
Glass shaderを利用
ありがとうございます。
はじめてのFujiyama Renderer その5
毛並表現わかりました。
$ curvegen hoge.mesh hoge.crv
でファーを生成する。
ありがとうございます。
はじめてのFujiyama Renderer その6
カメラ周りの視野変換をRenderManで使うplacecam.cを参考に組んでみた。調整が必要ですが何とか動いています。
以下は、Pov-Rayのシーンサンプルを参考に組んでみました。fovの設定もわかりました。
#!/usr/bin/env python
# 2 teapots and 2 bunnies with 1 sphere light
# Copyright (c) 2011-2013 Hiroshi Tsubokawa
#export PYTHONPATH=$PYTHONPATH:/usr/lib/python2.6/site-packages/:$HOME/Fujiyama-Renderer/bin/
import fujiyama
si = fujiyama.SceneInterface()
#plugins
si.OpenPlugin('ConstantShader')
si.OpenPlugin('PlasticShader')
#Camera
si.NewCamera('cam1', 'PerspectiveCamera')
#si.SetSampleProperty3('cam1', 'translate', 0, 8, 8, 0)
#si.SetSampleProperty3('cam1', 'rotate', -45, 0, 0, 0)
#Calculate python fujicam.py 0 2 -10 0 1 0
si.SetSampleProperty3('cam1', 'rotate',-5.71, 0.00, 0.00,0)
si.SetSampleProperty3('cam1', 'rotate',0.00, 180.00, 0.00,0)
si.SetSampleProperty3('cam1', 'translate', 0.00, 2.00, -10.00,0)
si.SetProperty1('cam1', 'fov', 25)
#Light
si.NewLight('light1', 'SphereLight')
si.SetProperty3('light1', 'translate', -10, 10, -10)
si.SetProperty3('light1', 'scale', .5, .5, .5)
si.SetProperty1('light1', 'intensity', 1)
si.NewLight('light2', 'SphereLight')
si.SetProperty3('light2', 'translate', 10, 10, -10)
si.SetProperty3('light2', 'scale', .5, .5, .5)
si.SetProperty1('light2', 'intensity', 1)
si.SetProperty1('light1', 'sample_count', 16)
#Texture
si.NewTexture('tex1', '../mip/pisa.mip')
#Shader
si.NewShader('dome_shader', 'ConstantShader')
si.AssignTexture('dome_shader', 'texture', 'tex1')
si.NewShader('floor_shader', 'PlasticShader')
si.SetProperty3('floor_shader', 'diffuse', .2, .25, .3)
intensity = 0
si.NewShader('sphere_shader', 'PlasticShader')
si.SetProperty3('sphere_shader', 'diffuse', intensity, intensity, intensity)
si.SetProperty1('sphere_shader', 'ior', 40)
#Mesh
si.NewMesh('dome_mesh', '../mesh/dome.mesh')
si.NewMesh('floor_mesh', '../mesh/floor.mesh')
si.NewMesh('sphere_mesh', '../mesh/sphere.mesh')
#ObjectInstance
si.NewObjectInstance('dome1', 'dome_mesh')
si.SetProperty3('dome1', 'rotate', 0, 0, 0)
si.SetProperty3('dome1', 'scale', -.5, .5, .5)
si.AssignShader('dome1', 'dome_shader')
distance = 1.5
si.NewObjectInstance('floor1', 'floor_mesh')
si.SetProperty3('floor1', 'scale', 5, 5, 5)
si.AssignShader('floor1', 'floor_shader')
si.NewObjectInstance('sphere1', 'sphere_mesh')
si.AssignShader('sphere1', 'sphere_shader')
si.SetProperty3('sphere1', 'translate', 0, 1, 0)
#si.SetProperty3('sphere1', 'scale', .5, .5, .5)
#ObjectGroup
si.NewObjectGroup('group1')
si.AddObjectToGroup('group1', 'sphere1')
si.AssignObjectGroup('sphere1', 'shadow_target', 'group1')
si.AssignObjectGroup('floor1', 'shadow_target', 'group1')
#FrameBuffer
si.NewFrameBuffer('fb1', 'rgba')
#Renderer
si.NewRenderer('ren1')
si.AssignCamera('ren1', 'cam1')
si.AssignFrameBuffer('ren1', 'fb1')
si.SetProperty2('ren1', 'resolution', 640, 480)
#si.SetProperty2('ren1', 'resolution', 160, 120)
si.SetProperty2('ren1', 'pixelsamples', 12, 12)
#Rendering
si.RenderScene('ren1')
#Output
si.SaveFrameBuffer('fb1', '../povsphere01.fb')
#Run commands
si.Run()
#si.Print()
はじめてのFujiyama Renderer その7
domeに張り付けた景色を回転させるシーンを作ってみた。pythonの繰り返しを利用している。10度ずつ回転させて36枚の静止画を生成してみます。
#!/usr/bin/env python
# povsphere02.py
# Copyright (c) 2011-2013 Hiroshi Tsubokawa
#export PYTHONPATH=$PYTHONPATH:/usr/lib/python2.6/site-packages/:$HOME/Fujiyama-Renderer/bin/
import fujiyama
rot=0
for f in range(1,37):
si = fujiyama.SceneInterface()
#plugins
si.OpenPlugin('ConstantShader')
si.OpenPlugin('PlasticShader')
#Camera
si.NewCamera('cam1', 'PerspectiveCamera')
#si.SetSampleProperty3('cam1', 'translate', 0, 8, 8, 0)
#si.SetSampleProperty3('cam1', 'rotate', -45, 0, 0, 0)
#Calculate python fujicam.py 0 2 -10 0 1 0
si.SetSampleProperty3('cam1', 'rotate',-5.71, 0.00, 0.00,0)
si.SetSampleProperty3('cam1', 'rotate',0.00, 180.00, 0.00,0)
si.SetSampleProperty3('cam1', 'translate', 0.00, 2.00, -10.00,0)
si.SetProperty1('cam1', 'fov', 25)
#Light
si.NewLight('light1', 'SphereLight')
si.SetProperty3('light1', 'translate', -10, 10, -10)
si.SetProperty3('light1', 'scale', .5, .5, .5)
si.SetProperty1('light1', 'intensity', 1)
si.NewLight('light2', 'SphereLight')
si.SetProperty3('light2', 'translate', 10, 10, -10)
si.SetProperty3('light2', 'scale', .5, .5, .5)
si.SetProperty1('light2', 'intensity', 1)
si.SetProperty1('light1', 'sample_count', 16)
#Texture
si.NewTexture('tex1', '../mip/pisa.mip')
#Shader
si.NewShader('dome_shader', 'ConstantShader')
si.AssignTexture('dome_shader', 'texture', 'tex1')
si.NewShader('floor_shader', 'PlasticShader')
si.SetProperty3('floor_shader', 'diffuse', .2, .25, .3)
intensity = 0
si.NewShader('sphere_shader', 'PlasticShader')
si.SetProperty3('sphere_shader', 'diffuse', intensity, intensity, intensity)
si.SetProperty1('sphere_shader', 'ior', 40)
#Mesh
si.NewMesh('dome_mesh', '../mesh/dome.mesh')
si.NewMesh('floor_mesh', '../mesh/floor.mesh')
si.NewMesh('sphere_mesh', '../mesh/sphere.mesh')
#ObjectInstance
si.NewObjectInstance('dome1', 'dome_mesh')
si.SetProperty3('dome1', 'rotate', 0, rot, 0)
si.SetProperty3('dome1', 'scale', -3, 3, 3)
si.AssignShader('dome1', 'dome_shader')
rot=rot+10
si.NewObjectInstance('floor1', 'floor_mesh')
si.SetProperty3('floor1', 'scale', 50, 50, 50)
si.AssignShader('floor1', 'floor_shader')
si.NewObjectInstance('sphere1', 'sphere_mesh')
si.AssignShader('sphere1', 'sphere_shader')
si.SetProperty3('sphere1', 'translate', 0, 1, 0)
#si.SetProperty3('sphere1', 'scale', .5, .5, .5)
#ObjectGroup
si.NewObjectGroup('group1')
si.AddObjectToGroup('group1', 'sphere1')
si.AssignObjectGroup('sphere1', 'shadow_target', 'group1')
si.AssignObjectGroup('floor1', 'shadow_target', 'group1')
#FrameBuffer
si.NewFrameBuffer('fb1', 'rgba')
#Renderer
si.NewRenderer('ren1')
si.AssignCamera('ren1', 'cam1')
si.AssignFrameBuffer('ren1', 'fb1')
#si.SetProperty2('ren1', 'resolution', 640, 480)
si.SetProperty2('ren1', 'resolution', 320, 240)
si.SetProperty2('ren1', 'pixelsamples', 12, 12)
#Rendering
si.RenderScene('ren1')
#Output
si.SaveFrameBuffer('fb1', ("../sphere%03d" % f) + ".fb")
#Run commands
si.Run()
#si.Print()
ムービーはこちら
http://rman.sakura.ne.jp/pict/out_1.mp4
出力したイメージを変換して動画にするpythonスクリプト例
#fbpict.py
from subprocess import check_call
for i in range(1,37):
name="sphere"
check_call(["fb2exr", (name+"%03d" % i)+".fb", (name+"%03d" % i)+".exr"])
check_call(["exrtopng", (name+"%03d" % i)+".exr", (name+"%03d" % i)+".png"])
check_call(["ffmpeg", "-i", name+"%03d.png","-s", "320x240" ,"-vcodec", "mjpeg", "-sameq", "out.avi"])
ターミナルを複数起動してフレームごとにレンダリングさせるための
pythonスクリプト例。9スレッドで36フレームをそれぞれ4フレームずつレンダリングした。合計約28分。複数のFujiyama Rendererを立ち上げて実行できます。
あらかじめ、.bashrcにPYTHONPATHを記入しておいた方が良いです。
export PYTHONPATH=$PYTHONPATH:/usr/lib/python2.6/site-packages/:$HOME/Fujiyama-Renderer/bin/
>
#start.py
from subprocess import check_call
check_call(["gnome-terminal", "-e", "python povsphere02a.py"])
check_call(["gnome-terminal", "-e", "python povsphere02b.py"])
check_call(["gnome-terminal", "-e", "python povsphere02c.py"])
check_call(["gnome-terminal", "-e", "python povsphere02d.py"])
check_call(["gnome-terminal", "-e", "python povsphere02e.py"])
check_call(["gnome-terminal", "-e", "python povsphere02f.py"])
check_call(["gnome-terminal", "-e", "python povsphere02g.py"])
check_call(["gnome-terminal", "-e", "python povsphere02h.py"])
check_call(["gnome-terminal", "-e", "python povsphere02i.py"])
ありがとうございます。Pythonの勉強になりますね。
はじめてのFujiyama Renderer その8 視野変換
とりあえず、カメラ位置と注視点位置から視野変換するPythonスクリプトをRenderMan資料placecam.cを参考に求めてみました。ありがとうございます。
まちがっているところもあるかもしれませんが、それっぽくカメラ位置が求められています。
Fujiyama Rendere0.1.1では、変換の順序は、プロパティを設定する順序に
影響しません。記述の順番は関係しません。
順序を設定するためのプロパティは'transform_order'、
'rotate_order'になり、デフォルトではそれぞれ、ORDER_SRTと
ORDER_XYZになっています。
変換はスケール、回転、移動の順に行われています。
回転はx,y,z軸回転の順に行われています。
以下のfujicam.py、Pythonスクリプトを実行し、出力された変換をコピペでシーンに張り付けてください。なおroll、coneangleは未対応です。
#!/usr/bin/env python
#fujicam.py
import sys
import os
from math import *
PI=3.1415926535897932
def usage():
print "usage: placecam pos_x pos_y pos_z aim_x aim_y aim_z"
print " [coneangle] [roll_angle]"
print " Calculate Fujiyama Renderer transforms needed for camera transform"
print " from light position to aim point with the given roll angle."
sys.exit(1)
def RiRotate(xangle, yangle, zangle):
if (fabs(xangle) > 0.001 or fabs(yangle) > 0.001 or fabs(zangle) > 0.001):
print "rotate %0.2f %0.2f %0.2f" % (xangle, yangle, zangle)
def RiTranslate(dx, dy, dz):
print "translate %0.2f %0.2f %0.2f" % (dx, dy, dz)
"""
/*
* AimZ(): rotate the world so the direction vector points in
* positive z by rotating about the y axis, then x. The cosine
* of each rotation is given by components of the normalized
* direction vector. Before the y rotation the direction vector
* might be in negative z, but not afterward.
*/
"""
def AimZ(direction):
global PI
if (direction[0]==0 and direction[1]==0 and direction[2]==0):
return
#/*
# * The initial rotation about the y axis is given by the projection of
# * the direction vector onto the x,z plane: the x and z components
# * of the direction.
# */
xzlen = sqrt(direction[0]*direction[0]+direction[2]*direction[2])
if (xzlen == 0):
if (direction[1] < 0):
yrot = 180
else:
yrot=0
else:
yrot = 180-180*acos(direction[2]/xzlen)/PI
# /*
# * The second rotation, about the x axis, is given by the projection on
# * the y,z plane of the y-rotated direction vector: the original y
# * component, and the rotated x,z vector from above.
# */
yzlen = sqrt(direction[1]*direction[1]+xzlen*xzlen)
xrot = 180*acos(xzlen/yzlen)/PI; #/* yzlen should never be 0 */
if (direction[1] > 0):
RiRotate(xrot, 0.0, 0.0)
else:
RiRotate(-xrot, 0.0, 0.0)
# /* The last rotation declared gets performed first */
if (direction[0] > 0):
RiRotate( 0.0, -yrot, 0.0)
else:
RiRotate( 0.0, yrot, 0.0)
def PlaceCamera(position, direction, roll):
RiRotate(0.0, 0.0, -roll)
AimZ(direction)
RiTranslate(position[0], position[1], position[2])
def main():
global PI
if len(sys.argv) < 7:
usage()
pos=[0,0,0]
aim=[0,0,0]
dir=[0,0,0]
pos[0] = float(sys.argv[1])
pos[1] = float(sys.argv[2])
pos[2] = float(sys.argv[3])
aim[0] = float(sys.argv[4])
aim[1] = float(sys.argv[5])
aim[2] = float(sys.argv[6])
if len(sys.argv) > 7:
coneangle = float(sys.argv[7])
else:
coneangle = 0.0
if len(sys.argv) > 8:
roll = float(sys.argv[8])
else:
roll = 0.0
print "position: %0.2f, %0.2f, %0.2f"% (pos[0], pos[1], pos[2])
print "aim: %0.2f, %0.2f, %0.2f"% (aim[0], aim[1], aim[2])
print "coneangle: %0.4f"% coneangle
print "roll: %0.2f\n" % roll
if (coneangle != 0.0):
fov = coneangle * 360.0 / PI
print "Projection \"perspective\" \"fov\" [%0.2f]" % fov
dir[0] = aim[0] - pos[0]
dir[1] = aim[1] - pos[1]
dir[2] = aim[2] - pos[2]
PlaceCamera(pos, dir, roll)
if __name__ == "__main__":
main()
いろいろと試したくなります。ありがとうございます。
2013/8/24 : coneangle箇所修正
はじめてのFujiyama Renderer その9
外部モジュールを作成した。
以下、colorinc.py 未完成ですが、いろいろやってみる。
#! /usr/bin/env python
#colorinc.py
import fujiyama
si = fujiyama.SceneInterface()
#plugins
si.OpenPlugin('ConstantShader')
si.OpenPlugin('PlasticShader')
si.OpenPlugin('GlassShader')
si.NewShader('Blue_shader', 'PlasticShader')
si.SetProperty3('Blue_shader', 'diffuse', 0, 0.6, 1)
si.NewShader('Red_shader', 'PlasticShader')
si.SetProperty3('Red_shader', 'diffuse', 1, 0, 0)
si.NewShader('Green_shader', 'PlasticShader')
si.SetProperty3('Green_shader', 'diffuse', 0, 1, 0.5)
si.NewShader('Violet_shader', 'PlasticShader')
si.SetProperty3('Violet_shader', 'diffuse', 1, 0.2, 1)
si.NewShader('Orange_shader', 'PlasticShader')
si.SetProperty3('Orange_shader', 'diffuse', 1, 0.6, 0.2)
si.NewShader('Yellow_shader', 'PlasticShader')
si.SetProperty3('Yellow_shader', 'diffuse', 1,1,0)
si.NewShader('Cyan_shader', 'PlasticShader')
si.SetProperty3('Cyan_shader', 'diffuse', 0, 1, 1)
si.NewShader('Magenta_shader', 'PlasticShader')
si.SetProperty3('Magenta_shader', 'diffuse', 1, 0, 1)
si.NewShader('White_shader', 'PlasticShader')
si.SetProperty3('White_shader', 'diffuse', 1, 1, 1)
si.NewShader('Black_shader', 'PlasticShader')
si.SetProperty3('Black_shader', 'diffuse', 0, 0, 0)
si.NewShader('DimGray_shader', 'PlasticShader')
si.SetProperty3('DimGray_shader', 'diffuse',0.329412,0.329412,0.329412)
si.NewShader('Gray_shader', 'PlasticShader')
si.SetProperty3('Gray_shader', 'diffuse',0.752941,0.752941,0.752941)
si.NewShader('LightGray_shader', 'PlasticShader')
si.SetProperty3('LightGray_shader', 'diffuse',0.658824,0.658824,0.658824)
si.NewShader('VLightGray_shader', 'PlasticShader')
si.SetProperty3('VLightGray_shader', 'diffuse',0.80,0.80,0.80)
si.NewShader('Aquamarine_shader', 'PlasticShader')
si.SetProperty3('Aquamarine_shader', 'diffuse',0.439216,0.858824,0.576471)
si.NewShader('BlueViolet_shader', 'PlasticShader')
si.SetProperty3('BlueViolet_shader', 'diffuse',0.62352,0.372549,0.623529)
si.NewShader('Brown_shader', 'PlasticShader')
si.SetProperty3('Brown_shader', 'diffuse',0.647059,0.164706,0.164706)
si.NewShader('CadetBlue_shader', 'PlasticShader')
si.SetProperty3('CadetBlue_shader', 'diffuse',0.372549,0.623529,0.623529)
si.NewShader('Coral_shader', 'PlasticShader')
si.SetProperty3('Coral_shader', 'diffuse',1.0,0.498039,0.0)
si.NewShader('CornflowerBlue_shader', 'PlasticShader')
si.SetProperty3('CornflowerBlue_shader', 'diffuse',0.258824,0.258824,0.435294)
si.NewShader('DarkGreen_shader', 'PlasticShader')
si.SetProperty3('DarkGreen_shader', 'diffuse',0.184314,0.309804,0.184314)
si.NewShader('DarkOliveGreen_shader', 'PlasticShader')
si.SetProperty3('DarkOliveGreen_shader', 'diffuse',0.309804,0.309804,0.184314)
si.NewShader('DarkOrchid_shader', 'PlasticShader')
si.SetProperty3('DarkOrchid_shader', 'diffuse',0.6,0.196078,0.8)
si.NewShader('DarkSlateBlue_shader', 'PlasticShader')
si.SetProperty3('DarkSlateBlue_shader', 'diffuse',0.119608,0.137255,0.556863)
si.NewShader('DarkSlateGray_shader', 'PlasticShader')
si.SetProperty3('DarkSlateGray_shader', 'diffuse',0.184314,0.309804,0.309804)
si.NewShader('DarkTurquoise_shader', 'PlasticShader')
si.SetProperty3('DarkTurquoise_shader', 'diffuse',0.439216,0.576471,0.858824)
si.NewShader('Firebrick_shader', 'PlasticShader')
si.SetProperty3('Firebrick_shader', 'diffuse',0.556863,0.137255,0.137255)
si.NewShader('ForestGreen_shader', 'PlasticShader')
si.SetProperty3('ForestGreen_shader', 'diffuse',0.137255,0.556863,0.137255)
si.NewShader('Gold_shader', 'PlasticShader')
si.SetProperty3('Gold_shader', 'diffuse',0.8,0.498039,0.196078)
si.NewShader('Goldenrod_shader', 'PlasticShader')
si.SetProperty3('Goldenrod_shader', 'diffuse',0.858824,0.858824,0.439216)
si.NewShader('GreenYellow_shader', 'PlasticShader')
si.SetProperty3('GreenYellow_shader', 'diffuse',0.576471,0.858824,0.439216)
si.NewShader('IndianRed_shader', 'PlasticShader')
si.SetProperty3('IndianRed_shader', 'diffuse',0.309804,0.184314,0.184314)
si.NewShader('Khaki_shader', 'PlasticShader')
si.SetProperty3('Khaki_shader', 'diffuse',0.623529,0.623529,0.372549)
"""
LightBlue=vector3(0.74902,0.847059,0.847059)
LightSteelBlue=vector3(0.560784,0.560784,0.737255)
LimeGreen=vector3(0.196078,0.8,0.196078)
Maroon=vector3(0.556863,0.137255,0.419608)
MediumAquamarine=vector3(0.196078,0.8,0.6)
MediumBlue=vector3(0.196078,0.196078,0.8)
MediumForestGreen=vector3(0.419608,0.556863,0.137255)
MediumGoldenrod=vector3(0.917647,0.917647,0.678431)
MediumOrchid=vector3(0.576471,0.439216,0.858824)
MediumSeaGreen=vector3(0.258824,0.435294,0.258824)
MediumTurquoise=vector3(0.439216,0.858824,0.858824)
MediumVioletRed=vector3(0.858824,0.439216,0.576471)
MidnightBlue=vector3(0.184314,0.184314,0.309804)
Navy=vector3(0.137255,0.137255,0.556863)
NavyBlue=vector3(0.137255,0.137255,0.556863)
Orange=vector3(1,0.5,0.0)
Orchid=vector3(0.858824,0.439216,0.858824)
PaleGreen=vector3(0.560784,0.737255,0.560784)
Pink=vector3(0.737255,0.560784,0.560784)
Plum=vector3(0.917647,0.678431,0.917647)
Salmon=vector3(0.435294,0.258824,0.258824)
SeaGreen=vector3(0.137255,0.556863,0.419608)
Sienna=vector3(0.556863,0.419608,0.137255)
SkyBlue=vector3(0.196078,0.6,0.8)
SteelBlue=vector3(0.137255,0.419608,0.556863)
Tan=vector3(0.858824,0.576471,0.439216)
Thistle=vector3(0.847059,0.74902,0.847059)
Turquoise=vector3(0.678431,0.917647,0.917647)
Violet=vector3(0.309804,0.184314,0.309804)
VioletRed=vector3(0.8,0.196078,0.6)
Wheat=vector3(0.847059,0.847059,0.74902)
YellowGreen=vector3(0.6,0.8,0.196078)
SummerSky=vector3(0.22,0.69,0.87)
RichBlue=vector3(0.35,0.35,0.67)
Brass=vector3( 0.71,0.65,0.26)
Copper=vector3(0.72,0.45,0.20)
Bronze=vector3(0.55,0.47,0.14)
Bronze2=vector3(0.65,0.49,0.24)
Silver=vector3(0.90,0.91,0.98)
BrightGold=vector3(0.85,0.85,0.10)
OldGold=vector3( 0.81,0.71,0.23)
Feldspar=vector3(0.82,0.57,0.46)
Quartz=vector3(0.85,0.85,0.95)
NeonPink=vector3(1.00,0.43,0.78)
DarkPurple=vector3(0.53,0.12,0.47)
NeonBlue=vector3(0.30,0.30,1.00)
CoolCopper=vector3(0.85,0.53,0.10)
MandarinOrange=vector3(0.89,0.47,0.20)
LightWood=vector3(0.91,0.76,0.65)
MediumWood=vector3(0.65,0.50,0.39)
DarkWood=vector3(0.52,0.37,0.26)
SpicyPink=vector3(1.00,0.11,0.68)
SemiSweetChoc=vector3(0.42,0.26,0.15)
BakersChoc=vector3(0.36,0.20,0.09)
Flesh=vector3(0.96,0.80,0.69)
NewTan=vector3(0.92,0.78,0.62)
NewMidnightBlue=vector3(0.00,0.00,0.61)
VeryDarkBrown=vector3(0.35,0.16,0.14)
DarkBrown=vector3(0.36,0.25,0.20)
DarkTan=vector3(0.59,0.41,0.31)
GreenCopper=vector3(0.32,0.49,0.46)
DkGreenCopper=vector3(0.29,0.46,0.43)
DustyRose=vector3(0.52,0.39,0.39)
HuntersGreen=vector3(0.13,0.37,0.31)
Scarlet=vector3(0.55,0.09,0.09)
Med_Purple=vector3( 0.73,0.16,0.96)
Light_Purple=vector3(0.87,0.58,0.98)
Very_Light_Purple=vector3(0.94,0.81,0.99)
"""
さらにcolorinc.pyをインポートするシーン例
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#export PYTHONPATH=$PYTHONPATH:/usr/lib/python2.6/site-packages/:$HOME/Fujiyama-Renderer/bin/
from colorinc import si
import fujiyama
#si = fujiyama.SceneInterface()
#plugins
si.OpenPlugin('ConstantShader')
si.OpenPlugin('PlasticShader')
si.OpenPlugin('GlassShader')
#Camera
si.NewCamera('cam1', 'PerspectiveCamera')
si.SetProperty3('cam1', 'rotate', -26.57, 0.00, 0.00)
#si.SetProperty3('cam1', 'rotate', 0.00, 180.00, 0.00)
si.SetProperty3('cam1', 'translate', 0.00, 5.00, 10.00)
#Light
"""
si.NewLight('lighta', 'PointLight')
si.SetProperty3('lighta', 'translate', -5, 4, 5)
si.SetProperty1('lighta', 'intensity', 0.03)
si.NewLight('lightb', 'SphereLight')
si.SetProperty3('lightb', 'translate', 5, 4, 5)
si.SetProperty3('lightb', 'scale', .5, .5, .5)
si.SetProperty1('lightb', 'intensity', 0.03)
"""
#Light
si.NewLight( 'light0', 'PointLight')
si.SetProperty3( 'light0', 'translate', 0.900771, 12, 4.09137)
si.SetProperty1( 'light0', 'intensity', 0.03125)
si.NewLight( 'light1', 'PointLight')
si.SetProperty3( 'light1', 'translate', 2.02315, 12, 5.28021)
si.SetProperty1( 'light1' ,'intensity', 0.03125)
si.NewLight( 'light2', 'PointLight')
si.SetProperty3( 'light2', 'translate', 10.69, 12, 13.918)
si.SetProperty1( 'light2', 'intensity', 0.03125)
si.NewLight( 'light3', 'PointLight')
si.SetProperty3( 'light3', 'translate', 4.28027, 12, 7.58462)
si.SetProperty1( 'light3', 'intensity', 0.03125)
si.NewLight( 'light4', 'PointLight')
si.SetProperty3( 'light4', 'translate', 12.9548, 12, 1.19914)
si.SetProperty1( 'light4', 'intensity', 0.03125)
si.NewLight( 'light5', 'PointLight')
si.SetProperty3( 'light5', 'translate', 6.55808, 12, 2.31772)
si.SetProperty1( 'light5', 'intensity', 0.03125)
si.NewLight( 'light6', 'PointLight')
si.SetProperty3( 'light6', 'translate', 0.169064, 12, 10.9623)
si.SetProperty1( 'light6', 'intensity', 0.03125)
si.NewLight( 'light7', 'PointLight')
si.SetProperty3( 'light7', 'translate', 1.25002, 12, 4.51314)
si.SetProperty1( 'light7', 'intensity', 0.03125)
si.NewLight( 'light8', 'PointLight')
si.SetProperty3( 'light8', 'translate', 2.46758, 12, 5.73382)
si.SetProperty1( 'light8', 'intensity', 0.03125)
si.NewLight( 'light9', 'PointLight')
si.SetProperty3( 'light9', 'translate', 3.55644, 12, 6.84334)
si.SetProperty1( 'light9','intensity', 0.03125)
si.NewLight( 'light10', 'PointLight')
si.SetProperty3( 'light10', 'translate', 4.76112, 12, 8.00264)
si.SetProperty1( 'light10', 'intensity', 0.03125)
si.NewLight( 'light11', 'PointLight')
si.SetProperty3( 'light11', 'translate', 13.3267,12, 9.10333)
si.SetProperty1( 'light11', 'intensity', 0.03125)
si.NewLight( 'light12', 'PointLight')
si.SetProperty3( 'light12', 'translate', 14.4155, 12, 2.68084)
si.SetProperty1( 'light12', 'intensity', 0.03125)
si.NewLight( 'light13', 'PointLight')
si.SetProperty3( 'light13', 'translate', 8.10755, 12, 3.79629)
si.SetProperty1( 'light13', 'intensity', 0.03125)
si.NewLight( 'light14', 'PointLight')
si.SetProperty3( 'light14', 'translate', 9.21103, 12, 4.9484)
si.SetProperty1( 'light14', 'intensity', 0.03125)
si.NewLight( 'light15', 'PointLight')
si.SetProperty3( 'light15', 'translate', 2.83469, 12, 6.09221)
si.SetProperty1( 'light15', 'intensity', 0.03125)
si.NewLight( 'light16', 'PointLight')
si.SetProperty3( 'light16', 'translate', 4.00945, 12, 7.18302)
si.SetProperty1( 'light16', 'intensity', 0.03125)
si.NewLight( 'light17', 'PointLight')
si.SetProperty3( 'light17', 'translate', 12.6072, 12, 0.832089)
si.SetProperty1( 'light17', 'intensity', 0.03125)
si.NewLight( 'light18', 'PointLight')
si.SetProperty3( 'light18', 'translate', 6.21169, 12, 1.98055)
si.SetProperty1( 'light18', 'intensity', 0.03125)
si.NewLight( 'light19', 'PointLight')
si.SetProperty3( 'light19', 'translate', 7.39599, 12, 10.5563)
si.SetProperty1( 'light19', 'intensity', 0.03125)
si.NewLight( 'light20', 'PointLight')
si.SetProperty3( 'light20', 'translate', 8.52421, 12, 4.15086)
si.SetProperty1( 'light20', 'intensity', 0.03125)
si.NewLight( 'light21', 'PointLight')
si.SetProperty3( 'light21', 'translate', 9.5891, 12, 5.39715)
si.SetProperty1( 'light21', 'intensity', 0.03125)
si.NewLight( 'light22', 'PointLight')
si.SetProperty3( 'light22', 'translate', 3.18967, 12, 13.9542)
si.SetProperty1( 'light22', 'intensity', 0.03125)
si.NewLight( 'light23','PointLight')
si.SetProperty3( 'light23', 'translate', 4.41432, 12, 0.082813)
si.SetProperty1( 'light23', 'intensity', 0.03125)
si.NewLight( 'light24', 'PointLight')
si.SetProperty3( 'light24', 'translate', 5.48803, 12, 1.21856)
si.SetProperty1( 'light24', 'intensity', 0.03125)
si.NewLight( 'light25', 'PointLight')
si.SetProperty3( 'light25', 'translate', 6.57647, 12, 2.31432)
si.SetProperty1( 'light25', 'intensity', 0.03125)
si.NewLight( 'light26', 'PointLight')
si.SetProperty3( 'light26', 'translate', 0.265098, 12, 10.9453)
si.SetProperty1( 'light26', 'intensity', 0.03125)
si.NewLight( 'light27', 'PointLight')
si.SetProperty3( 'light27', 'translate', 8.84422, 12, 12.1117)
si.SetProperty1( 'light27', 'intensity', 0.03125)
si.NewLight( 'light28', 'PointLight')
si.SetProperty3( 'light28', 'translate', 10.0154, 12, 5.67625)
si.SetProperty1( 'light28', 'intensity', 0.03125)
si.NewLight( 'light29', 'PointLight')
si.SetProperty3( 'light29', 'translate', 11.0907, 12, 14.4043)
si.SetProperty1( 'light29', 'intensity', 0.03125)
si.NewLight( 'light30', 'PointLight')
si.SetProperty3( 'light30', 'translate', 4.71726, 12, 7.98851)
si.SetProperty1( 'light30', 'intensity', 0.03125)
si.NewLight( 'light31', 'PointLight')
si.SetProperty3( 'light31', 'translate', 13.3907, 12, 9.08986)
si.SetProperty1( 'light31', 'intensity', 0.03125)
#Shader
si.NewShader('floor_shader', 'PlasticShader')
si.SetProperty3('floor_shader', 'diffuse', .2, .25, .3)
si.SetProperty1('floor_shader', 'ior', 2)
si.NewShader('dome_shader', 'ConstantShader')
si.SetProperty3('dome_shader', 'diffuse', .8, .8, .8)
#Mesh
si.NewMesh('dome_mesh', '../mesh/dome.mesh')
si.NewMesh('floor_mesh', '../mesh/floor.mesh')
si.NewMesh('cube_mesh', '../mesh/cube.mesh')
#ObjectInstance
si.NewObjectInstance('cube1', 'cube_mesh')
si.AssignShader('cube1', 'DarkTurquoise_shader')
si.SetProperty3('cube1', 'translate', 0,0, 0)
si.NewObjectInstance('cube2', 'cube_mesh')
si.AssignShader('cube2', 'Firebrick_shader')
si.SetProperty3('cube2', 'translate', -2,0, 0)
si.NewObjectInstance('cube3', 'cube_mesh')
si.AssignShader('cube3', 'ForestGreen_shader')
si.SetProperty3('cube3', 'translate', 2,0, 0)
si.SetProperty3('cube3', 'rotate', 0,45, 0)
si.NewObjectInstance('cube4', 'cube_mesh')
si.AssignShader('cube4', 'Gold_shader')
si.SetProperty3('cube4', 'translate', -2,0, -2)
si.NewObjectInstance('cube5', 'cube_mesh')
si.AssignShader('cube5', 'Goldenrod_shader')
si.SetProperty3('cube5', 'translate', 0,0, -2)
si.NewObjectInstance('cube6', 'cube_mesh')
si.AssignShader('cube6', 'GreenYellow_shader')
si.SetProperty3('cube6', 'translate', 2,0, -2)
si.NewObjectInstance('floor1', 'floor_mesh')
si.AssignShader('floor1', 'Blue_shader')
si.SetProperty3('Blue_shader', 'reflect', 0.5, 0.5, 0.5)
si.SetProperty3('floor1', 'translate', 0,-0.5, 0)
si.SetProperty3('floor1', 'scale', 10, 10, 10)
si.NewObjectInstance('dome1', 'dome_mesh')
si.AssignShader('dome1', 'dome_shader')
#FrameBuffer
si.NewFrameBuffer('fb1', 'rgba')
#Properties
si.ShowPropertyList('Renderer')
#Renderer
si.NewRenderer('ren1')
si.AssignCamera('ren1', 'cam1')
si.AssignFrameBuffer('ren1', 'fb1')
si.SetProperty2('ren1', 'resolution', 512, 300)
#si.SetProperty2('ren1', 'resolution', 160, 120)
si.SetProperty1('ren1', 'raymarch_step', .01)
si.SetProperty1('ren1', 'raymarch_shadow_step', .02)
si.SetProperty1('ren1', 'raymarch_reflect_step', .02)
#Rendering
si.RenderScene('ren1')
#Output
si.SaveFrameBuffer('fb1', '../boxcolor01.fb')
#Run commands
si.Run()
#si.Print()
カメラの画角調整 20度
si.SetProperty1('cam1', 'fov', 20)
ありがとうございます。
はじめてのFujiyama Renderer その10
Thank you for your support.
#!/usr/bin/env python
# 1 happy with 1 dome light with an HDRI
# Copyright (c) 2011-2013 Hiroshi Tsubokawa
from colorinc import si
import fujiyama
#si = fujiyama.SceneInterface()
#plugins
si.OpenPlugin('ConstantShader')
si.OpenPlugin('PlasticShader')
#Camera
si.NewCamera('cam1', 'PerspectiveCamera')
si.SetSampleProperty3('cam1', 'translate', 0, 1, 8.5, 0)
rot = 120
#Light
si.NewLight('light1', 'DomeLight')
si.SetProperty3('light1', 'rotate', 0, rot, 0)
si.SetProperty1('light1', 'sample_count', 256)
#Texture
si.NewTexture('tex1', '../mip/pisa.mip')
si.AssignTexture('light1', 'environment_map', 'tex1');
#Shader
si.NewShader('happy_shader', 'PlasticShader')
si.SetProperty3('happy_shader', 'diffuse', .8, .8, .8)
si.NewShader('dome_shader', 'ConstantShader')
si.AssignTexture('dome_shader', 'texture', 'tex1')
si.NewShader('sphere_shader1', 'PlasticShader')
si.SetProperty3('sphere_shader1', 'diffuse', 0, 0, 0)
si.SetProperty1('sphere_shader1', 'ior', 40)
si.NewShader('sphere_shader2', 'PlasticShader')
si.SetProperty3('sphere_shader2', 'diffuse', 1, 1, 1)
si.SetProperty3('sphere_shader2', 'reflect', 0, 0, 0)
si.NewShader('floor_shader', 'PlasticShader')
#si.SetProperty3('floor_shader', 'diffuse', .8, .85, .8)
#si.SetProperty3('floor_shader', 'reflect', 0, 0, 0)
#Mesh
#si.NewMesh('happy_mesh', '../../mesh/happy.mesh')
si.NewMesh('dome_mesh', '../mesh/dome.mesh')
si.NewMesh('sphere_mesh', '../mesh/sphere.mesh')
si.NewMesh('floor_mesh', '../mesh/floor.mesh')
#ObjectInstance
#si.NewObjectInstance('happy1', 'happy_mesh')
#si.AssignShader('happy1', 'happy_shader')
si.NewObjectInstance('floor1', 'floor_mesh')
si.AssignShader('floor1', 'floor_shader')
si.SetProperty3('floor_shader', 'reflect', 0, 0, 0)
si.NewObjectInstance('dome1', 'dome_mesh')
si.SetProperty3('dome1', 'rotate', 0, rot, 0)
si.SetProperty3('dome1', 'scale', -.5, .5, .5)
si.AssignShader('dome1', 'dome_shader')
si.NewObjectInstance('sphere1', 'sphere_mesh')
si.AssignShader('sphere1', 'sphere_shader1')
si.SetProperty3('sphere1', 'translate', -1.5, .52, 0)
si.SetProperty3('sphere1', 'scale', .5, .53, .5)
si.NewObjectInstance('sphere2', 'sphere_mesh')
si.AssignShader('sphere2', 'Blue_shader')
si.SetProperty3('sphere2', 'translate', 1.5, .52, 0)
si.SetProperty3('sphere2', 'scale', .5, .53, .5)
#ObjectGroup
#si.NewObjectGroup('group1')
#si.AddObjectToGroup('group1', 'happy1')
#si.AssignObjectGroup('happy1', 'shadow_target', 'group1')
si.NewObjectGroup('group2')
#si.AddObjectToGroup('group2', 'floor1')
si.AddObjectToGroup('group2', 'sphere1')
si.AddObjectToGroup('group2', 'sphere2')
si.AssignObjectGroup('sphere1', 'shadow_target', 'group2')
si.AssignObjectGroup('sphere2', 'shadow_target', 'group2')
si.AssignObjectGroup('floor1', 'shadow_target', 'group2')
si.NewObjectGroup('group3')
si.AddObjectToGroup('group3', 'dome1')
si.AssignObjectGroup('sphere1', 'reflect_target', 'group3')
si.NewObjectGroup('group4')
si.AddObjectToGroup('group4', 'dome1')
#si.AddObjectToGroup('group4', 'happy1')
#si.AssignObjectGroup('happy1', 'reflect_target', 'group4')
#FrameBuffer
si.NewFrameBuffer('fb1', 'rgba')
#Renderer
si.NewRenderer('ren1')
si.AssignCamera('ren1', 'cam1')
si.AssignFrameBuffer('ren1', 'fb1')
si.SetProperty2('ren1', 'resolution', 640, 480)
#si.SetProperty2('ren1', 'resolution', 160, 120)
#si.SetProperty2('ren1', 'pixelsamples', 9, 9)
#Rendering
si.RenderScene('ren1')
#Output
si.SaveFrameBuffer('fb1', '../dome_floor1.fb')
#Run commands
si.Run()
#si.Print()
1/4 >>