1/1

Guile RMan #6 ShadowMap part 2

illum3.jpg

FramBegin〜Endを使ってAqsisサンプルのSoftshadowをguile-rmanで生成してみました。

#!/usr/bin/guile -s
!#
(use-modules (rman rispec))
(use-modules (rman utilities))

(RiBegin "illum3.rib")
;;(RiOption "limits" (list "bucketsize" #f32(32 32)))
(RiOption "limits" (list "eyesplits" 10))
(RiDeclare "bias" "float")
(RiHider "hidden" (list "depthfilter" "midpoint"))
(RiDisplay "softshadow.zfile" "zfile" "z")
(RiClipping 0.01 10)
(RiSides 2)
(RiFormat 512 512 1)
(RiPixelFilter RiBoxFilter 2 2)
(RiPixelSamples 1 1)
(RiShadingRate 2)

(RiFrameBegin 1)
(RiProjection "perspective" '("fov" 57.30))
(RiRotate -35.26 1.00 0.00 0.00)
(RiRotate 45.00 0.00 1.00 0.00)
(RiTranslate -5.00 -5.00 5.00)

(RiWorldBegin)
(RiSurface "null")
(RiSphere 1 -1 1 360)
(RiWorldEnd)
(RiFrameEnd)

(RiMakeShadow "softshadow.zfile" "softshadow.shad")


(RiDisplay "illum3.tif" "file" "rgba")
(RiFormat 512 384 1)

(RiPixelFilter RiGaussianFilter 2 2)
(RiPixelSamples 2 2)
(RiClipping 0.2 10)
(RiShadingRate 1)
(RiFrameBegin 2)

(RiProjection "perspective" '("fov" 45))
(RiTranslate 0 0 5)
(RiRotate -25 1 0 0)

(RiWorldBegin)
(RiLightSource "ambientlight" (list "intensity" 0.2))
(RiLightSource "shadowspot" (list "intensity" 80
"from" (Point 5 5 -5)
"to" (Point 0 0 0)
"coneangle" 0.5
"float blur" 0.03
"string shadowname" "softshadow.shad"))

(RiColor (Color 0.4 0.4 0.1))
(RiSurface "matte")
(RiSphere 1 -1 1 360)

(RiOrientation "rh")
(RiColor (Color 0.5 0 0))
(RiSurface "matte")
(RiPatch "bilinear" (list "P" #f32(-10 -1 -10
10 -1 -10
-10 -1 10
10 -1 10)))
(RiWorldEnd)
(RiFrameEnd)
(RiEnd)


Max eyesplits for object "unnamed" exceeded
Object "unnamed" spans the epsilon plane
Object "unnamed" spans the epsilon plane
Max eyesplits for object "unnamed" exceeded
Object "unnamed" spans the epsilon plane
Max eyesplits for object "unnamed" exceeded
が出ますがレンダリングできました。
  • -
  • -

Guile RMan #7 AutoShadow

Aqsis1.6では、
Attribute "autoshadows" "string shadowmapname" ["autoshadow.shad"] "integer res" [600]
を利用して、影の自動生成を行います。

これと、もう一つ
Option "Render" "integer multipass" [1]
がないと、シャドウマップは生成されません。

simple3.jpg
以下、Aqsis1.6.0のサンプルautoshadow.ribを参考にしました。

#!/usr/bin/guile -s
!#
(use-modules (rman rispec))
(use-modules (rman utilities))

(RiBegin "illum2.rib")
(RiOption "Render" (list "integer multipass" 1))
(RiHider "hidden" (list "depthfilter" "midpoint"))
(RiDisplay "illum2.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" 4096))
(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"
)))
(RiAttributeEnd)
(RiIlluminate light1 1 )
(RiAttributeBegin)

(RiTransformBegin)
(RiColor (Color 0.8 0.8 0.8))
(RiSurface "plastic")
(RiPolygon 4 (list "P" #f32(-1 0 -1 -1 0 1 1 0 1 1 0 -1)))
(RiTransformEnd)

(RiTransformBegin)
(RiColor (Color 0.8 0.4 0.2))
(RiSurface "plastic")
(RiRotate -90 1 0 0)

(RiScale 0.2 0.2 0.2)
(RiGeometry "teapot")
(RiTransformEnd)

(RiAttributeEnd)
(RiWorldEnd)
(RiEnd)



"integer res" 1024
"float blur" 0.008
と調整してみた。

(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
"float blur" 0.008
"string shadowname" "autoshadow.shad"
)))
(RiAttributeEnd)


illum3.jpg
  • -
  • -

1/1