Rendering学習日記

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

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 #3 RiPolygon and RiPoints

guile-rmanでのRiPolygonの表記がわかりました。RiPointsもわかりましたが"width"設定がわからないところ。
rect.jpg
以下はサンプルです。points.scmで保存しました。

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

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

(RiBegin "points.rib")
(RiDisplay "points.tif" "file" "rgb")
(RiFormat 640 480 1)
(RiProjection "perspective" '("fov" 30))
(RiTranslate 0 0 3)
; (RiProgressHandler progress)
(RiPixelFilter RiBoxFilter 1 1)
(RiWorldBegin)
(RiLightSource "ambientlight" (list "intensity" 0.2))
(RiLightSource "distantlight" (list "intensity" 1.2 ))
(RiAttributeBegin)
(RiColor (Color 1 0 0))
(RiSurface "plastic")
(RiTransformBegin)
(RiTranslate -0.5 -0.5 0)
;;(RiRotate -90 1 0 0)
;;(RiDisk 0 0.5 270)
;;(RiCone 1 0.5 150)
;;(RiCone 1.5 0.5 360)
(RiPolygon 4 (list "P" #f32(0 0 0 0 1 0 1 1 0 1 0 0)))
;;(RiPoints 4 (list "P" #f32(0 0 0 0 1 0 1 1 0 1 0 0) "width" 0.25)) ;;"Cs" #f32(1 0 0 0 1 0 0 0 1 1 1 0) "width" #f32(0.25 0.25 0.25 0.25)
(RiTransformEnd)
(RiAttributeEnd)
(RiWorldEnd)
(RiEnd)


(RiPoints 1 (list "P" #f32(0 0 0)))
で原点に点を表示します。
points.jpg
  • -
  • -

Guile RMan #4 RiPoints

guile-rmanでのRiPointsでは"constantwidth"を使う。ありがとうございます。
points4.jpg

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

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

(RiBegin "points4.rib")
(RiDisplay "points4.tif" "file" "rgb")
(RiFormat 640 480 1)
(RiProjection "perspective" '("fov" 30))
(RiTranslate 0 0 3)
(RiPixelFilter RiBoxFilter 1 1)
(RiWorldBegin)
(RiLightSource "ambientlight" (list "intensity" 0.2))
(RiLightSource "distantlight" (list "intensity" 1.2 ))
(RiAttributeBegin)
(RiColor (Color 1 0 0))
(RiSurface "plastic")
(RiTransformBegin)
(RiTranslate -0.5 -0.5 0)
(RiPoints 4 (list "P" #f32(0 0 0 0 1 0 1 1 0 1 0 0) "constantwidth" 0.4))
(RiTransformEnd)
(RiAttributeEnd)
(RiWorldEnd)
(RiEnd)

  • -
  • -
<< 45/50 >>