Fujiyama Renderer 0.2.1がリリースされました。既にmulti threadsでのレンダリングで速くなっている。
バンプ・マッピングができるようになりました。
sphere_uv.plyを利用してます。TextureはFujiyama RendererのDownloadsからのリンクを利用しました。以下はPython APIを利用、例です。ありがとうございます。
#!/usr/bin/env python
# 4 textured spheres with 1 dome light with an HDRI
# Copyright (c) 2011-2013 Hiroshi Tsubokawa
import fujiyama
si = fujiyama.SceneInterface()
#Plugins
si.OpenPlugin('ConstantShader')
si.OpenPlugin('PlasticShader')
#Camera
si.NewCamera('cam1', 'PerspectiveCamera')
si.SetProperty3('cam1', 'translate', 0, 0, 10)
# Rotation of dome light and dome object used for background iamge.
rot = 110
#Texture
si.NewTexture('env_tex1', '../mip/pisa.mip')
si.NewTexture('rock_tex1', '../mip/rock.mip')
si.NewTexture('rust_tex1', '../mip/rust.mip')
si.NewTexture('concrete_tex1', '../mip/concrete.mip')
si.NewTexture('pattern_tex1', '../mip/pattern.mip')
#Light
si.NewLight('light1', 'DomeLight')
si.SetProperty3('light1', 'rotate', 0, rot, 0)
# You chang the number of samples on the env map. the default is 16.
#si.SetProperty1('light1', 'sample_count', 256)
si.SetProperty1('light1', 'sample_count', 32)
si.AssignTexture('light1', 'environment_map', 'env_tex1');
#Shader
si.NewShader('sphere_shader1', 'PlasticShader')
si.AssignTexture('sphere_shader1', 'diffuse_map', 'rock_tex1')
si.AssignTexture('sphere_shader1', 'bump_map', 'rock_tex1')
si.SetProperty1('sphere_shader1', 'bump_amplitude', 1)
si.NewShader('sphere_shader2', 'PlasticShader')
si.AssignTexture('sphere_shader2', 'diffuse_map', 'rust_tex1')
si.AssignTexture('sphere_shader2', 'bump_map', 'rust_tex1')
si.SetProperty1('sphere_shader2', 'bump_amplitude', 1)
si.NewShader('sphere_shader3', 'PlasticShader')
si.AssignTexture('sphere_shader3', 'diffuse_map', 'concrete_tex1')
si.AssignTexture('sphere_shader3', 'bump_map', 'concrete_tex1')
si.SetProperty1('sphere_shader3', 'bump_amplitude', 1)
si.NewShader('sphere_shader4', 'PlasticShader')
si.AssignTexture('sphere_shader4', 'diffuse_map', 'pattern_tex1')
si.AssignTexture('sphere_shader4', 'bump_map', 'pattern_tex1')
si.SetProperty1('sphere_shader4', 'bump_amplitude', -1)
si.SetProperty3('sphere_shader4', 'diffuse', .5, .5, .5)
si.SetProperty1('sphere_shader4', 'ior', 10)
si.NewShader('dome_shader', 'ConstantShader')
si.AssignTexture('dome_shader', 'texture', 'env_tex1')
#Mesh
si.NewMesh('sphere_mesh', '../mesh/sphere_uv.mesh')
si.NewMesh('dome_mesh', '../mesh/dome.mesh')
#ObjectInstance
si.NewObjectInstance('sphere1', 'sphere_mesh')
si.SetProperty3('sphere1', 'translate', -1.7, 1.2, 0)
si.AssignShader('sphere1', 'sphere_shader1')
si.NewObjectInstance('sphere2', 'sphere_mesh')
si.SetProperty3('sphere2', 'translate', 1.7, 1.2, 0)
si.SetProperty3('sphere2', 'rotate', 0, 20, 0)
si.AssignShader('sphere2', 'sphere_shader2')
si.NewObjectInstance('sphere3', 'sphere_mesh')
si.SetProperty3('sphere3', 'translate', -1.7, -1.2, 0)
si.SetProperty3('sphere3', 'rotate', 0, 20, 0)
si.AssignShader('sphere3', 'sphere_shader3')
si.NewObjectInstance('sphere4', 'sphere_mesh')
si.SetProperty3('sphere4', 'translate', 1.7, -1.2, 0)
si.AssignShader('sphere4', 'sphere_shader4')
si.NewObjectInstance('dome1', 'dome_mesh')
si.SetProperty3('dome1', 'rotate', 0, rot, 0)
si.SetProperty3('dome1', 'scale', -.5, .5, .5)
si.AssignShader('dome1', 'dome_shader')
#ObjectGroup
# Create shadow_target for sphere1.
# Since 'DomeLight' has infinite distance, we need to exclude
# 'dome1' object which is for just background image.
si.NewObjectGroup('shadow_target1')
si.AddObjectToGroup('shadow_target1', 'sphere1')
si.AssignObjectGroup('sphere1', 'shadow_target', 'shadow_target1')
# and each sphere reacts to only 'dome1' and itself, not to the other spheres
si.NewObjectGroup('reflect_target1')
si.AddObjectToGroup('reflect_target1', 'dome1')
si.AddObjectToGroup('reflect_target1', 'sphere1')
si.AssignObjectGroup('sphere1', 'reflect_target', 'reflect_target1')
si.NewObjectGroup('shadow_target2')
si.AddObjectToGroup('shadow_target2', 'sphere2')
si.AssignObjectGroup('sphere2', 'shadow_target', 'shadow_target2')
si.NewObjectGroup('reflect_target2')
si.AddObjectToGroup('reflect_target2', 'dome1')
si.AddObjectToGroup('reflect_target2', 'sphere2')
si.AssignObjectGroup('sphere2', 'reflect_target', 'reflect_target2')
si.NewObjectGroup('shadow_target3')
si.AddObjectToGroup('shadow_target3', 'sphere3')
si.AssignObjectGroup('sphere3', 'shadow_target', 'shadow_target3')
si.NewObjectGroup('reflect_target3')
si.AddObjectToGroup('reflect_target3', 'dome1')
si.AddObjectToGroup('reflect_target3', 'sphere3')
si.AssignObjectGroup('sphere3', 'reflect_target', 'reflect_target3')
si.NewObjectGroup('shadow_target4')
si.AddObjectToGroup('shadow_target4', 'sphere4')
si.AssignObjectGroup('sphere4', 'shadow_target', 'shadow_target4')
si.NewObjectGroup('reflect_target4')
si.AddObjectToGroup('reflect_target4', 'dome1')
si.AddObjectToGroup('reflect_target4', 'sphere4')
si.AssignObjectGroup('sphere4', 'reflect_target', 'reflect_target4')
#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)
#Rendering
si.RenderScene('ren1')
#Output
si.SaveFrameBuffer('fb1', '../bump_mapping.fb')
#Run commands
si.Run()
#si.Print()
他、Point Cloudsを試しました。こちらもサンプルPython APIを利用してます。
Aqsis1.6とguile-rmanでのスクリプトの書き方、ReadArchiveの書式がわかりました。
(RiReadArchive "cone.rib" (list ))
パラメータ部分をlistにしときます。
以下は、Nupatchのcone.ribを保存します。
NuPatch 11 4 [-2 -2 -1
0 1 2 3 4 5 6 7 8 9 10 10] 0 8 4 4 [0 0 0 0 2.23607 2.23607 2.23607 2.23607] 0 2.23607 "Pw" [0.783612 -1 -0.783612 1 1.10819 -1 6.51994e-017 1
0.783612 -1 0.783612 1 3.21127e-016 -1 1.10819 1 -0.783612 -1 0.783612 1
-1.10819 -1 2.72688e-016 1 -0.783612 -1 -0.783612 1 -5.95213e-016 -1 -1.10819 1
0.783612 -1 -0.783612 1 1.10819 -1 6.51994e-017 1 0.783612 -1 0.783612 1
0.522408 -0.333333 -0.522408 1 0.738796 -0.333333 6.3877e-017 1 0.522408 -0.333333 0.522408 1
2.14085e-016 -0.333333 0.738796 1 -0.522408 -0.333333 0.522408 1 -0.738796 -0.333333 2.02203e-016 1
-0.522408 -0.333333 -0.522408 1 -3.96809e-016 -0.333333 -0.738796 1 0.522408 -0.333333 -0.522408 1
0.738796 -0.333333 6.3877e-017 1 0.522408 -0.333333 0.522408 1 0.261204 0.333333 -0.261204 1
0.369398 0.333333 6.25547e-017 1 0.261204 0.333333 0.261204 1 1.07042e-016 0.333333 0.369398 1
-0.261204 0.333333 0.261204 1 -0.369398 0.333333 1.31718e-016 1 -0.261204 0.333333 -0.261204 1
-1.98404e-016 0.333333 -0.369398 1 0.261204 0.333333 -0.261204 1 0.369398 0.333333 6.25547e-017 1
0.261204 0.333333 0.261204 1 0 1 6.12323e-017 1 0 1 6.12323e-017 1
0 1 6.12323e-017 1 0 1 6.12323e-017 1 0 1 6.12323e-017 1
0 1 6.12323e-017 1 0 1 6.12323e-017 1 0 1 6.12323e-017 1
0 1 6.12323e-017 1 0 1 6.12323e-017 1 0 1 6.12323e-017 1]
NuPatch 11 4 [-2 -2 -1
0 1 2 3 4 5 6 7 8 9 10 10] 0 8 4 4 [0 0 0 0 2.23607 2.23607 2.23607 2.23607] 0 2.23607 "Pw" [0.783612 -1 -0.783612 1 1.10819 -1 6.51994e-017 1
0.783612 -1 0.783612 1 3.21127e-016 -1 1.10819 1 -0.783612 -1 0.783612 1
-1.10819 -1 2.72688e-016 1 -0.783612 -1 -0.783612 1 -5.95213e-016 -1 -1.10819 1
0.783612 -1 -0.783612 1 1.10819 -1 6.51994e-017 1 0.783612 -1 0.783612 1
0.522408 -0.333333 -0.522408 1 0.738796 -0.333333 6.3877e-017 1 0.522408 -0.333333 0.522408 1
2.14085e-016 -0.333333 0.738796 1 -0.522408 -0.333333 0.522408 1 -0.738796 -0.333333 2.02203e-016 1
-0.522408 -0.333333 -0.522408 1 -3.96809e-016 -0.333333 -0.738796 1 0.522408 -0.333333 -0.522408 1
0.738796 -0.333333 6.3877e-017 1 0.522408 -0.333333 0.522408 1 0.261204 0.333333 -0.261204 1
0.369398 0.333333 6.25547e-017 1 0.261204 0.333333 0.261204 1 1.07042e-016 0.333333 0.369398 1
-0.261204 0.333333 0.261204 1 -0.369398 0.333333 1.31718e-016 1 -0.261204 0.333333 -0.261204 1
-1.98404e-016 0.333333 -0.369398 1 0.261204 0.333333 -0.261204 1 0.369398 0.333333 6.25547e-017 1
0.261204 0.333333 0.261204 1 0 1 6.12323e-017 1 0 1 6.12323e-017 1
0 1 6.12323e-017 1 0 1 6.12323e-017 1 0 1 6.12323e-017 1
0 1 6.12323e-017 1 0 1 6.12323e-017 1 0 1 6.12323e-017 1
0 1 6.12323e-017 1 0 1 6.12323e-017 1 0 1 6.12323e-017 1]
NuPatch 11 4 [-2 -2 -1
0 1 2 3 4 5 6 7 8 9 10 10] 0 8 4 4 [0 0 0 0 1 1 1 1] 0 1 "Pw" [0 -1 0 1 0 -1 0 1
0 -1 0 1 0 -1 0 1 0 -1 0 1
0 -1 0 1 0 -1 0 1 0 -1 0 1
0 -1 0 1 0 -1 0 1 0 -1 0 1
0.261204 -1 -0.261204 1 0.369398 -1 -9.12038e-018 1 0.261204 -1 0.261204 1
1.58307e-016 -1 0.369398 1 -0.261204 -1 0.261204 1 -0.369398 -1 1.62571e-016 1
-0.261204 -1 -0.261204 1 -2.49669e-016 -1 -0.369398 1 0.261204 -1 -0.261204 1
0.369398 -1 -9.12038e-018 1 0.261204 -1 0.261204 1 0.522408 -1 -0.522408 1
0.738796 -1 -1.82408e-017 1 0.522408 -1 0.522408 1 3.16613e-016 -1 0.738796 1
-0.522408 -1 0.522408 1 -0.738796 -1 3.25142e-016 1 -0.522408 -1 -0.522408 1
-4.99337e-016 -1 -0.738796 1 0.522408 -1 -0.522408 1 0.738796 -1 -1.82408e-017 1
0.522408 -1 0.522408 1 0.783612 -1 -0.783612 1 1.10819 -1 -2.73611e-017 1
0.783612 -1 0.783612 1 4.7492e-016 -1 1.10819 1 -0.783612 -1 0.783612 1
-1.10819 -1 4.87713e-016 1 -0.783612 -1 -0.783612 1 -7.49006e-016 -1 -1.10819 1
0.783612 -1 -0.783612 1 1.10819 -1 -2.73611e-017 1 0.783612 -1 0.783612 1]
NuPatch 11 4 [-2 -2 -1
0 1 2 3 4 5 6 7 8 9 10 10] 0 8 4 4 [0 0 0 0 1 1 1 1] 0 1 "Pw" [0 -1 0 1 0 -1 0 1
0 -1 0 1 0 -1 0 1 0 -1 0 1
0 -1 0 1 0 -1 0 1 0 -1 0 1
0 -1 0 1 0 -1 0 1 0 -1 0 1
0.261204 -1 -0.261204 1 0.369398 -1 -9.12038e-018 1 0.261204 -1 0.261204 1
1.58307e-016 -1 0.369398 1 -0.261204 -1 0.261204 1 -0.369398 -1 1.62571e-016 1
-0.261204 -1 -0.261204 1 -2.49669e-016 -1 -0.369398 1 0.261204 -1 -0.261204 1
0.369398 -1 -9.12038e-018 1 0.261204 -1 0.261204 1 0.522408 -1 -0.522408 1
0.738796 -1 -1.82408e-017 1 0.522408 -1 0.522408 1 3.16613e-016 -1 0.738796 1
-0.522408 -1 0.522408 1 -0.738796 -1 3.25142e-016 1 -0.522408 -1 -0.522408 1
-4.99337e-016 -1 -0.738796 1 0.522408 -1 -0.522408 1 0.738796 -1 -1.82408e-017 1
0.522408 -1 0.522408 1 0.783612 -1 -0.783612 1 1.10819 -1 -2.73611e-017 1
0.783612 -1 0.783612 1 4.7492e-016 -1 1.10819 1 -0.783612 -1 0.783612 1
-1.10819 -1 4.87713e-016 1 -0.783612 -1 -0.783612 1 -7.49006e-016 -1 -1.10819 1]
続いて、次のスクリプトをguileで実行します。
simple4.scmで保存します。
#!/usr/bin/guile -s
!#
(use-modules (rman rispec))
(use-modules (rman utilities))
(RiBegin "")
(RiOption "Render" (list "integer multipass" 1))
(RiHider "hidden" (list "depthfilter" "midpoint"))
(RiDisplay "simple4.tif" "file" "rgb")
(RiFormat 512 384 1)
(RiProjection "perspective" '("fov" 30))
(RiTranslate 0 0 3)
(RiRotate -40 1 0 0)
(RiRotate -20 0 1 0)
(RiPixelFilter RiGaussianFilter 2 2)
(RiWorldBegin)
(RiLightSource "ambientlight" (list "intensity" 0.3))
(RiAttributeBegin)
(RiAttribute "autoshadows" (list "string shadowmapname" "autoshadow.shad" "integer res" 1024))
(RiTranslate 5 5 -5)
(RiRotate -45 0.0 1.0 0.0)
(RiRotate 35 1.0 0.0 0.0)
(define light1 (RiLightSource "shadowspot" (list "intensity" 300
"coneangle" 0.5
"string shadowname" "autoshadow.shad"
"float blur" 0.008 )))
(RiAttributeEnd)
(RiIlluminate light1 1 )
(RiAttributeBegin)
(RiTransformBegin)
(RiColor (Color 0.8 0.8 0.8))
(RiSurface "plastic")
(RiPolygon 4 (list "P" #f32(-1 -0.5 -1 -1 -0.5 1 1 -0.5 1 1 -0.5 -1)))
(RiTransformEnd)
(RiTransformBegin)
(RiColor (Color 0.8 0.4 0.2))
(RiSurface "plastic")
;;(RiRotate -90 1 0 0)
(RiScale 0.5 0.5 0.5)
(RiTranslate 0 0.2 0)
(RiReadArchive "cone.rib" (list ))
(RiTransformEnd)
(RiAttributeEnd)
(RiWorldEnd)
(RiEnd)
Aqsis1.6とguile-rmanでのサンプルが動くように調整しました。
以下、test0.scmを実行します。
Some deprecated features have been used. Set the environment variable GUILE_WARN_DEPRECATED to "detailed" and rerun the program to get more information. Set it to "no" to suppress this message.
export GUILE_WARN_DEPRECATED="detailed"
を.bashrcに書き加えた方が良いです。
#!/usr/bin/guile -s
!#
(use-modules (rman rispec))
(use-modules (rman utilities))
(define (progress percent frame)
(display "Percent: ")
(display percent)
(display " Frame: ")
(display frame)
(newline))
(define (subdiv ptr lod)
(display "Ptr: ")
(display ptr)
(display " Lod: ")
(display lod)
(newline))
(define (free ptr)
(display "Ptr: ")
(display ptr)
(newline))
(define bound #f32(0.0 0.0 0.0 10.0 10.0 10.0))
(define data '(some data))
(RiBegin "test0.rib")
(RiDisplay "sphere_two.tif" "file" "rgb")
(RiFormat 320 240 1)
(RiProjection "perspective" '("fov" 45.0))
(RiTranslate 0 0 6)
(RiProgressHandler progress)
(RiWorldBegin)
(let ((o1 (Object (RiSphere 1 -1 1 360))))
(RiLightSource "ambientlight" '("intensity" 0.2))
(RiLightSource "distantlight" '("intensity" 1.2
"from" #f32(0 0 -6)
"to" #f32(0 0 0)))
(RiColor #f32(1.0 0.0 0.0))
(RiSurface "plastic")
(RiTranslate -2.0 0 0)
(RiObjectInstance o1)
(RiColor #f32(0.0 1.0 0.0))
(RiSurface "plastic")
(RiTranslate 4.0 0 0)
(RiObjectInstance o1)
(RiProcedural data bound subdiv free))
(RiWorldEnd)
(RiEnd)
一歩一歩ですね。ありがとうございます。
RIB出力するようになれば完璧です。
以下は課題?。
configure:11571: checking for RiBegin in -laqsis_core
configure:11606: gcc -o conftest -g -O2 conftest.c -laqsis_core >&5
/usr/lib64/libaqsis_ribparse.so.1: undefined reference to `boost::iostreams::detail::zlib_base::inflate(int)'
collect2: ld returned 1 exit status