Option "searchpath" "shader" "@:../shaders"
Option "searchpath" "texture" "../textures"
Option "searchpath" "archive" "../archives:Cutter_Help/templates/Rib"
  
#    Frame1 is for Ambient Occlusion    Point Cloud baking.
#    To use raytracing
#        Frame1:dont render
#        Frame2:enable raytracing, disable .ptc file in LightSource
#                disable raytracing bias
#    To use baked point cloud
#        Frame1:Enable Display for dicing camera setup,
#                otherwise, just render with no display.
#        Frame2:Disable raytracing, enable .ptc file in LightSource
#                enable raytracing bias
  
FrameBegin 1
    DisplayChannel "float _area"
    DisplayChannel "normal _N"
    Display "../tiffs/wgsOcclusionLightBake" "it" "rgba"
    Format 512 384 1
    Projection "perspective" "fov" 15
    ShadingRate 1
    Translate  0 0 4
    Rotate -50 1 0 0
    Rotate   0 0 1 0
    Scale 1 1 -1
    WorldBegin
        Attribute "cull" "hidden" 0       # don't cull hidden surfaces
        Attribute "cull" "backfacing" 0   # don't cull backfacing surfaces
        Attribute "dice" "rasterorient" 0 # view-independent dicing
  
Surface "wgsBakePTC" "string bakename" ["../textures/wgsOcclusionLightBake.ptc"]     
    AttributeBegin
        Scale 0.3 0.3 0.3
        ReadArchive "pCube.rib"
    AttributeEnd    
    AttributeBegin
        Polygon "P" [-0.5 0 -0.5  -0.5 0 0.5  0.5 0 0.5  0.5 0 -0.5]
                "st" [0 0  0 1  1 1  1 0]
    AttributeEnd
    WorldEnd
FrameEnd
######################################################
FrameBegin 2
    Display "../tiffs/wgsOcclusionLightBake.tif" "it" "rgba"
    Format 512    384 1
    Projection "perspective" "fov" 45
    ShadingRate .1
  
    Translate  0 0 1
    Rotate -30 1 0 0
    Rotate   160 0 1 0
    Scale 1 1 -1
    WorldBegin
#    Attribute "visibility" "trace" [1]    #raytracing on/off
        LightSource "ambientlight" 1 "intensity" 0.15
        TransformBegin
            Rotate -60 1 0 0
            Scale 1 1 -1
            LightSource "wgsOcclusionlight" 2
                        "string pntcloud" ["../textures/wgsOcclusionLightBake.ptc"]
                        "float intensity" 0.5
                        "float multiplier" 5
                        "float samples" 512
                        "float coneangle" 60
                        "float multiplier" 3 
                        "float coneangle" 90
        TransformEnd    
        Surface "plastic" "Kd" 0.9 "Ks" 0    
    AttributeBegin
#   Attribute "trace" "float bias" [0.001]
        Scale 0.3 0.3 0.3
        ReadArchive "pCube.rib"
    AttributeEnd    
    AttributeBegin
        Polygon "P" [-0.5 0 -0.5  -0.5 0 0.5  0.5 0 0.5  0.5 0 -0.5]
                "st" [0 0  0 1  1 1  1 0]
    AttributeEnd
    WorldEnd
FrameEnd