Rendering学習日記

日々、3DCGの世界は進歩しています。勉強して理解したことをまとめていきます。RenderMan互換レンダラーやグローバル・イルミネーション。いろんなことに好奇心を持って、面白くなる。目指せShader書き!!
ありがとうございます。

Guile RMan #12 RiReadArchive

Aqsis1.6とguile-rmanでのスクリプトの書き方、ReadArchiveの書式がわかりました。

(RiReadArchive "cone.rib" (list ))

パラメータ部分をlistにしときます。
simple4.jpg
以下は、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)

  • -
  • -

Guile RMan #13 サンプルテスト

Aqsis1.6とguile-rmanでのサンプルが動くように調整しました。
sphere_two.jpg
以下、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
  • -
  • -
<< 5/5