<< Guile RMan is a set of bindings for the RenderMan API 戻る Guile RMan #3 RiPolygon and RiPoints >>

Guile RMan #2 shadowmap

Essential RenderManを参考にguile-rmanでやってみた。
Points、Polygon、Patchの表記がわからないので、Diskを地面にしました。
witshadow.jpg

1 影なし


noshadow.scmで保存

#!/usr/bin/guile -s
!#

(use-modules (rman rispec))
(use-modules (rman utilities))

(RiBegin "noshadow.rib")
(RiDisplay "npshadow.tif" "file" "rgb")
(RiFormat 640 480 1)
(RiProjection "perspective" '("fov" 30))
(RiTranslate 0 0 6)
(RiRotate -48 1 0 0)
(RiRotate -20 0 1 0)
(RiPixelFilter RiBoxFilter 1 1)
(RiWorldBegin)
(RiLightSource "ambientlight" (list "intensity" 0.1))
(RiLightSource "spotlight" (list "intensity" 10 "from" (Point 0 4 0)
"to" (Point 0 0 0 )
"coneangle" 0.45
"conedeltaangle" 0.05))
(RiAttributeBegin)
(RiColor (Color 1.0 0 0))
(RiSurface "plastic")
(RiTransformBegin)
(RiSphere 1 -1 1 360)
(RiTransformEnd)
(RiTransformBegin)
(RiColor (Color 0 1 0))
(RiSurface "matte")
(RiRotate -90 1 0 0)
(RiDisk -0.5 5 360)
;;(RiPatch "bilinear" (list "P" #f32(-5 -1 -5 5 -1 -5 -5 -1 5 5 -1 5)))
(RiTransformEnd)
(RiAttributeEnd)
(RiWorldEnd)
(RiEnd)

2 shadowmapを生成する


makeshadow.scmで保存

#!/usr/bin/guile -s
!#

(use-modules (rman rispec))
(use-modules (rman utilities))

(RiBegin "makeshadow.rib")
(RiHider "hidden" (list "string depthfilter" "midpoint"))
(RiDisplay "zbuffer.zfile" "zfile" "z")
(RiFormat 512 512 1)
(RiProjection "perspective" '("fov" 40))
(RiTranslate 0 0 4)
(RiRotate -90 1 0 0)
(RiWorldBegin)
(RiAttributeBegin)
(RiColor (Color 1.0 0 0))

(RiTransformBegin)
(RiSphere 1 -1 1 360)
(RiTransformEnd)
(RiTransformBegin)
(RiColor (Color 0 1 0))

(RiRotate -90 1 0 0)

(RiDisk -0.5 5 360)
(RiTransformEnd)
(RiAttributeEnd)
(RiWorldEnd)
(RiMakeShadow "zbuffer.zfile" "map.shad")
(RiEnd)


3 影つき


withshadow.scmで保存

#!/usr/bin/guile -s
!#

(use-modules (rman rispec))
(use-modules (rman utilities))

(RiBegin "withshadow.rib")
(RiHider "hidden" (list "string depthfilter" "midpoint"))
(RiDisplay "witshadow.tif" "file" "rgb")
(RiFormat 640 480 1)
(RiProjection "perspective" '("fov" 30))
(RiTranslate 0 0 6)
(RiRotate -48 1 0 0)
(RiRotate -20 0 1 0)
(RiPixelFilter RiBoxFilter 1 1)
(RiWorldBegin)
(RiLightSource "ambientlight" (list "intensity" 0.1))
(RiLightSource "shadowspot" (list "string shadowname" "map.shad" "intensity" 10
"from" (Point 0 4 0)
"to" (Point 0 0 0 )
"coneangle" 0.45
"conedeltaangle" 0.05))
(RiAttributeBegin)
(RiColor (Color 1.0 0 0))
(RiSurface "plastic")
(RiTransformBegin)
(RiSphere 1 -1 1 360)
(RiTransformEnd)
(RiTransformBegin)
(RiColor (Color 0 1 0))
(RiSurface "matte")
(RiRotate -90 1 0 0)
(RiDisk -0.5 5 360)
(RiTransformEnd)
(RiAttributeEnd)
(RiWorldEnd)
(RiEnd)

CentOS6.3 64bitで動作確認。
CentOS X86_64でswig2.0.11、guile2.0.9、guile-lib0.2.2をmake install、guile-rmanもmake installしaqsis1.6でレンダリングできました。rib出力はRifGetDeclarationで不可。
ありがとうございます。
  • -
  • -

<< Guile RMan is a set of bindings for the RenderMan API 戻る Guile RMan #3 RiPolygon and RiPoints >>