Example #1
0
    def createInstances(self, _planeHandle, _sphereHandle):
        """docstring for createInstances"""
        floorTrans = vecmath.scaleTranslation(Vec3(10.0, 1.0, 10.0), Vec3(0.0, -5.0, 0.0))
        apiCall( ILBCreateInstance(self.m_scene, _planeHandle, "FloorInstance", floorTrans, self.m_floorInstance))

        #spherePosRadius = 10.0 - 2.0*self.SPHERE_RADIUS
        trans = vecmath.scaleTranslation(Vec3(self.SPHERE_RADIUS, self.SPHERE_RADIUS, self.SPHERE_RADIUS), Vec3(0.0, self.SPHERE_RADIUS-5.0, 0.0))
        apiCall(ILBCreateInstance(self.m_scene, _sphereHandle, "SphereInstance", trans, self.m_sphereInstance))
        apiCall( ILBSetRenderStats(self.m_sphereInstance, ILB_RS_SHADOW_BIAS, ILB_RSOP_ENABLE) )
Example #2
0
                                      vecmath.translation(Vec3(0.0, 7.5, -20.0)) * vecmath.directionalLightOrientation(vecmath.normalize(Vec3(-1.0, -1.0, -0.25))), 
            ColorRGB(0.6, 0.6, 0.5))
        sun.setCastShadows(True);
        sun.setShadowSamples(32);
        sun.setShadowAngle(0.025);
        lightManager.addLight(sun);     

        sky = SkyLightSource( "Sky", vecmath.translation(Vec3(0.0, 5.0, -00.0)), ColorRGB(0.25, 0.3, 0.4))
        lightManager.addLight(sky)

        sceneUpVector = ILB_UP_POS_Y
        sceneScale = 1.0
        perspCamera = Camera("Camera", vecmath.translation(Vec3(-5.0, 5.0, -10.0)) * vecmath.cameraOrientation(vecmath.normalize(Vec3(0.25, -0.25, -1.0)), Vec3(0.0, 1.0, 0.0)), math.pi/2.0, 1.0)

        targetManager = TargetManager()
        objTrans = vecmath.scaleTranslation(Vec3(1.0, 1.0, 1.0), Vec3(0.0, 0.0, 0.0))

        for mesh in meshHandles:
            width = 64
            height = 64
            if meshNames[i] == "Ground":
                targetManager.addTarget(TargetEnttiy(objTrans, meshHandles[mesh], mesh))
            else:
                targetManager.addTarget(TargetEnttiy(objTrans, meshHandles[mesh], mesh, width, height))
                

        while True:
            beastConfig = beastCacheFolder + "/data/ernst.xml"

            dom = minidom.getDOMImplementation()
            xmlDoc = dom.createDocument(None, "ILConfig", None)
Example #3
0
def main(argv):
    """docstring for main"""
    optlist, args = getopt.getopt(argv, "", ['runningmode='])

    runningmode = "global"
    for o, a in optlist:
        if o == "--runningmode":
            runningmode = a

    runmode = getRunMode(runningmode)
    print runmode

    try:
        M_PI = 3.14159265358979323846

        bmh = createNewManagerHandle()
        
        apiCall( ILBSetLogTarget(ILB_LT_ERROR, ILB_LS_STDERR, None) )
        
        apiCall( ILBSetLogTarget(ILB_LT_INFO, ILB_LS_DEBUG_OUTPUT, None) )
        
        config = ConfigParser.ConfigParser()
        config.read('config.ini')
        configItems = {}
        for item in config.items('BeastPythonExamples'):
            configItems[item[0]] = item[1]

        # Setup our beast manager
        beastCacheFolder = os.path.normpath(configItems['beast_cache'])
        beastBinFolder = os.path.normpath(configItems['beast_bin'])
        beastDataFolder = os.path.normpath(configItems['beast_data'])


        dir = beastCacheFolder + r'/temp/cache'

        if runmode == RM_CLEAR:
            print "Clearing cache..."
            apiCall( ILBCreateManager(dir, ILB_CS_GLOBAL, bmh) )
            apiCall( ILBClearCache(bmh) )
            print "Done!"
        elif runmode == RM_GLOBAL:
            print "Creating a global cache!"
            apiCall( ILBCreateManager(dir, ILB_CS_GLOBAL, bmh) )
        elif runmode == RM_LOCAL:
            print "createing a local cache!"
            apiCall( ILBCreateManager(dir, ILB_CS_LOCAL, bmh) )
        else:
            print "Invalid runmode"
        
        apiCall( ILBSetBeastPath(bmh, beastBinFolder) )

        sphereName = "Sphere"
        floorName = "Floor"
        sphereMatName = "SphereMaterial"
        floorMatName = "FloorMaterial"

        sphereMesh = createNewMeshHandle()
        if not findCachedMesh(bmh, sphereName, sphereMesh):
           sphereMesh = primitives.createSphere(bmh, sphereName, sphereMatName, 600, 400, None) 

        floorMesh = createNewMeshHandle()
        if not findCachedMesh(bmh, floorName, floorMesh):
           floorMesh = primitives.createPlaneSimple(bmh, floorName, floorMatName) 

        texName = "Mandelbrot"
        texture = createNewTextureHandle()
        if not findCachedTexture(bmh, texName, texture):
            texture = textures.createMandelbrotTexture(bmh, texName, ColorRGB(1.0, 0.7, 0.7), 1000, 1000)


        scene = createNewSceneHandle()
        sceneName = "SimpleScene"
        apiCall( ILBBeginScene(bmh, sceneName, scene) )

        floorInstance = createNewInstanceHandle()
        floorTrans = vecmath.scaleTranslation(Vec3(10.0, 1.0, 10.0), Vec3(0.0, -5.0, 0.0))
        apiCall( ILBCreateInstance(scene, floorMesh, "FloorInstance", floorTrans, floorInstance))


        SPHERES = 5
        spherePosRadius = 5.0
        sphereRad = 2.0
        sphereInstances = []

        for i in range(SPHERES):
            angle = (M_PI * 2.0 * i) / SPHERES
            x = math.cos(angle) * spherePosRadius
            z = math.sin(angle) * spherePosRadius

            trans = vecmath.scaleTranslation(Vec3(sphereRad, sphereRad, sphereRad), 
                                     Vec3(x, -3.0, z))
            tempInstance = createNewInstanceHandle()
            sphereName = 'SphereInstance_' + str(i)
            apiCall( ILBCreateInstance(scene, sphereMesh, sphereName, trans, tempInstance) )


        # create the floor material
        floorMat = createNewMaterialHandle()
        primitives.apiCall( ILBCreateMaterial(scene, floorMatName, floorMat) )
        primitives.apiCall( ILBSetMaterialTexture(floorMat, ILB_CC_DIFFUSE, texture) )

        # create sphere material
        sphereMat = createNewMaterialHandle()
        apiCall( ILBCreateMaterial(scene, sphereMatName, sphereMat) )
        apiCall( ILBSetMaterialColor(sphereMat, ILB_CC_DIFFUSE, ColorRGBA(0.3, 0.3, 0.3, 1.0)) )
        apiCall( ILBSetMaterialColor(sphereMat, ILB_CC_SPECULAR, ColorRGBA(1.0, 1.0, 1.0, 1.0)) )
        apiCall( ILBSetMaterialScale(sphereMat, ILB_CC_REFLECTION, 0.1) )
        apiCall( ILBSetMaterialScale(sphereMat, ILB_CC_SHININESS, 15.0) )

        light = createNewLightHandle()
        apiCall( ILBCreateDirectionalLight(scene, 
                                           "Sun", 
                                           vecmath.directionalLightOrientation(Vec3(1.0, -1.0, -1.0)),
                                           ColorRGB(1.0, 1.0, 0.8),
                                           light))
        apiCall( ILBSetCastShadows(light, True) )
        apiCall( ILBSetShadowSamples(light, 32) )
        apiCall( ILBSetShadowAngle(light, 0.1) )


        skylight = createNewLightHandle()
        apiCall( ILBCreateSkyLight( scene, 'SkyLight', vecmath.identity(), ColorRGB(0.21, 0.21, 0.3), skylight) )


        camera = createNewCameraHandle()
        apiCall( ILBCreatePerspectiveCamera(scene, 
                 "Camera", 
                 vecmath.setCameraMatrix(Vec3(0.3, 0.5, 15.0), Vec3(0.1, -0.3, -1.0), Vec3(0.0, 1.0, 0.0)),
                 camera) )

        # Finalize the scene
        apiCall(ILBEndScene(scene));

        job = createNewJobHandle()
        apiCall( ILBCreateJob( bmh, 'TestJob', scene, beastDataFolder + r'/data/simpleFG.xml', job ) )

        fullShadingPass = createNewRenderPassHandle()
        apiCall( ILBCreateFullShadingPass(job, 'fullShading', fullShadingPass) )

        cameraTarget = createNewTargetHandle()
        apiCall( ILBCreateCameraTarget( job, 'cameraTarget', camera, 640, 480, cameraTarget ) )

        apiCall( ILBAddPassToTarget( cameraTarget, fullShadingPass ) )

        if not renderJob( job ):
            print "render error occured"

    except BeastPythonException, (instance):
        print "exception: " + str(instance.parameter)
        ex = instance.parameter
        errorString = createNewStringHandle()
        extendedError = createNewStringHandle()
        ILBErrorToString(ex, errorString)
        ILBGetExtendErrorInformation(extendedError)
        print "Beast API error"
        print "Error: " + convertStringHandle(errorString)
        print "Info: " + convertStringHandle(extendedError)
Example #4
0
        apiCall( ILBClearCache(bmh) )

        # Create ball and a plane meshes
        sphereMatName = 'SphereMaterial'
        boxMatName = 'boxMaterial'
        sphereMesh = primitives.createSphere(bmh, 'Sphere', sphereMatName, 32, 32)
        cornellMesh = primitives.createCornellBox(bmh, "Cornell", boxMatName)
        
        # Create a scene
        scene = createNewSceneHandle()
        apiCall( ILBBeginScene(bmh, 'BakingScene', scene) )
        

        # create an instance of the Cornell Box
        cornellInstance = createNewInstanceHandle()
        cornellTrans = vecmath.scaleTranslation(Vec3(10.0, 10.0, 10.0), Vec3(0.0, 0.0, 0.0))

        apiCall( ILBCreateInstance(scene, cornellMesh, "CornellInstance", cornellTrans, cornellInstance))


        # create area light
        lh = createNewLightHandle()
        pos = Vec3(0.0, 9.0, 0.0)
        lookAt = Vec3(0.0, 0.0, 0.0)
        matrix = vecmath.setAreaLightMatrix(pos, 
                                            lookAt-pos,
                                            Vec3(1.0, 0.0, 0.0),
                                            Vec2(2.0, 2.0))
        apiCall( ILBCreateAreaLight(scene,
                                     "Light",
                                     matrix,
Example #5
0
        # Waste the cache from previous runs if present
        apiCall( ILBClearCache(bmh) )

        # Create ball and a plane meshes
        sphereMatName = 'SphereMaterial'
        floorMatName = 'FloorMaterial'
        floorMesh = primitives.createPlaneMultiUV(bmh, 'Floor', floorMatName)
        
        # Create a scene
        scene = createNewSceneHandle()
        apiCall( ILBBeginScene(bmh, 'UvsetScene', scene) )
        
        # Create an instance of the plane that will be a floor
        floorInstance = createNewInstanceHandle()
        floorTrans = vecmath.scaleTranslation(Vec3(10.0, 1.0, 10.0), 
                                              Vec3(0.0, -5.0, 0.0))
        apiCall( ILBCreateInstance(scene, floorMesh, 'FloorInstance', floorTrans, floorInstance) )

        # create texture with 4 colors
        floorTex = textures.createTestColorTexutre(bmh, "TestColorTexture") 

        floorMat = createNewMaterialHandle()
        apiCall( ILBCreateMaterial(scene, floorMatName, floorMat) )
        apiCall( ILBSetMaterialTexture(floorMat, ILB_CC_DIFFUSE, floorTex) )
        apiCall( ILBSetChannelUVLayer(floorMat, ILB_CC_DIFFUSE, "uv3") )
        apiCall( ILBSetMaterialTexture(floorMat, ILB_CC_EMISSIVE, floorTex) )
        apiCall( ILBSetChannelUVLayer(floorMat, ILB_CC_EMISSIVE, "uv4") )

        light = createNewLightHandle()
        pos = Vec3(0.0, 1.0, 0.0)
        lookAt = Vec3(0.0, 0.0, 0.0)
Example #6
0
        # Waste the cache from previous runs if present
        apiCall( ILBClearCache(bmh) )

        # Create ball and a plane meshes
        sphereMatName = 'SphereMaterial'
        floorMatName = 'FloorMaterial'
        #floorMesh = primitives.createPlane(bmh, 'Floor', floorMatName, 5, 5)
        floorMesh = primitives.createPlaneSimple(bmh, 'Floor', floorMatName)
        sphereMesh = primitives.createSphere(bmh, 'Sphere', sphereMatName, 30, 15)
        
        scene = createNewSceneHandle()
        sceneName = "OcclusionScene"
        apiCall( ILBBeginScene(bmh, sceneName, scene) )

        floorInstance = createNewInstanceHandle()
        floorTrans = vecmath.scaleTranslation(Vec3(10.0, 1.0, 10.0), Vec3(0.0, -5.0, 0.0))
        apiCall( ILBCreateInstance(scene, floorMesh, "FloorInstance2", floorTrans, floorInstance))

        light = createNewLightHandle()
        apiCall( ILBCreateDirectionalLight(scene, 
                                           "Light", 
                                           vecmath.directionalLightOrientation(Vec3(1.0, -1.0, -1.0)),
                                           ColorRGB(1.0, 1.0, 0.8),
                                           light))
        apiCall( ILBSetCastShadows(light, True) )
        apiCall( ILBSetShadowSamples(light, 32) )
        apiCall( ILBSetShadowAngle(light, 0.1) )

        SPHERE_RADIUS = 1
        SPHERES = 50
Example #7
0
def generateLight(_lsType, _scene, _goboTex):
    """docstring for generateLight"""
    lh = createNewLightHandle()
    lookAt = Vec3(0.0, -2.0, 0.0)
    if _lsType == 0:
        apiCall( ILBCreateDirectionalLight(_scene, 
                                           "Light", 
                                           vecmath.directionalLightOrientation(Vec3(1.0, -1.0, -1.0)),
                                           ColorRGB(1.0, 1.0, 0.8),
                                           lh))
        apiCall( ILBSetCastShadows(lh, True) )
        apiCall( ILBSetShadowSamples(lh, 32) )
        apiCall( ILBSetShadowAngle(lh, 0.1) )

    elif _lsType == 1:
        # point light
        apiCall( ILBCreatePointLight(_scene,
                                     "Light",
                                     vecmath.translation(Vec3(-1.0, 1.0, 1.0)),
                                     ColorRGB(3.0, 3.0, 2.0),
                                     lh))

        apiCall( ILBSetCastShadows(lh, True) )
        apiCall( ILBSetShadowSamples(lh, 32) )
        apiCall( ILBSetShadowRadius(lh, 1.0) )

        # set a quadratic falloff
        apiCall( ILBSetFalloff(lh, ILB_FO_EXPONENT, 2.0, 20.0, True))
    elif _lsType == 2:
        # spot light
        pos = Vec3(-1.0, 1.0, 1.0)
        spotMatrix = vecmath.setSpotlightMatrix(pos, lookAt-pos)
        apiCall( ILBCreateSpotLight(_scene,
                                     "Light",
                                     spotMatrix,
                                     ColorRGB(3.0, 3.0, 2.0),
                                     lh))

        apiCall( ILBSetCastShadows(lh, True) )
        apiCall( ILBSetShadowSamples(lh, 32) )
        apiCall( ILBSetShadowRadius(lh, 1.0) )

        coneAngle = M_PI/3.0
        apiCall(ILBSetSpotlightCone(lh, coneAngle, 0.1, 2.0))

    elif _lsType == 3:
        # window light
        pos = Vec3(-1.0, 1.0, 1.0)
        matrix = vecmath.setAreaLightMatrix(pos, 
                                            lookAt-pos,
                                            Vec3(0.0, 1.0, 0.0),
                                            Vec2(2.0, 5.0))
        apiCall( ILBCreateWindowLight(_scene,
                                     "Light",
                                     matrix,
                                     ColorRGB(3.0, 3.0, 2.0),
                                     lh))

        apiCall( ILBSetCastShadows(lh, True) )
        apiCall( ILBSetShadowSamples(lh, 32) )
        apiCall( ILBSetShadowAngle(lh, 0.1) )

    elif _lsType == 4:
        #area light
        pos = Vec3(-1.0, 1.0, 1.0)
        matrix = vecmath.setAreaLightMatrix(pos, 
                                            lookAt-pos,
                                            Vec3(0.0, 1.0, 0.0),
                                            Vec2(3.0, 1.0))
        apiCall( ILBCreateAreaLight(_scene,
                                     "Light",
                                     matrix,
                                     ColorRGB(0.4, 0.4, 0.3),
                                     lh))

        apiCall( ILBSetCastShadows(lh, True) )
        apiCall( ILBSetShadowSamples(lh, 32) )

    elif _lsType == 5:
        # Point light wit ramp
        transform = vecmath.scaleTranslation(Vec3(17.0, 17.0, 17.0), Vec3(-1.0, 1.0, 1.0))
        apiCall( ILBCreatePointLight(_scene,
                                     "Light",
                                     transform,
                                     ColorRGB(1.0, 1.0, 1.0),
                                     lh))

        apiCall( ILBSetCastShadows(lh, True) )
        apiCall( ILBSetShadowSamples(lh, 32) )
        apiCall( ILBSetShadowRadius(lh, 1.0) )
        apiCall( ILBSetFalloff(lh, ILB_FO_EXPONENT, 0.0, 20.0, True) )

        # set some random colors in a ramp
        rampColors = 10
        for i in range(rampColors):
            randCol = vecmath.randomRGBA(3.0)
            apiCall( ILBSetLightRampEntry(lh, i/(rampColors-1.0), randCol.toColorRGB()))

    elif _lsType == 6:
        # spot light
        pos = Vec3(-1.0, 1.0, 1.0)
        spotMatrix = vecmath.setSpotlightMatrix(pos, lookAt - pos)
        apiCall( ILBCreateSpotLight(_scene,
                                     "Light",
                                     spotMatrix,
                                     ColorRGB(3.0, 3.0, 2.0),
                                     lh))

        apiCall( ILBSetCastShadows(lh, True) )
        apiCall( ILBSetShadowSamples(lh, 32) )
        apiCall( ILBSetShadowRadius(lh, 1.0) )
        apiCall( ILBSetLightProjectedTexture(lh, goboTex) )

        coneAngle = M_PI/3.0
        apiCall( ILBSetSpotlightCone(lh, coneAngle, 0.1, 2.0) )

    return lh
Example #8
0
        
        lsTypes = 7
        scenes = []
        cameras = []

        for lightType in range(lsTypes):
            scene = createNewSceneHandle()
            sceneName = "SceneInstance_" + str(lightType)
            apiCall( ILBBeginScene(bmh, sceneName, scene) )

            skylight = createNewLightHandle()
            primitives.apiCall( ILBCreateSkyLight( scene, 'SkyLight', vecmath.identity(), ColorRGB(0.21, 0.21, 0.3), skylight) )

            # Create an instance of the plane that will be a floor
            floorInstance = createNewInstanceHandle()
            floorTrans = vecmath.scaleTranslation(Vec3(10.0, 1.0, 10.0), 
                                          Vec3(0.0, -5.0, 0.0))
            apiCall( ILBCreateInstance(scene, floorMesh, 'FloorInstance', floorTrans, floorInstance) )
            x = 0.0
            z = 0.0
            sphereRad = 2.0

            trans = vecmath.scaleTranslation(Vec3(sphereRad, sphereRad, sphereRad), Vec3(x, -3.0, z))
            tempInstance = createNewInstanceHandle()
            sphereName = 'SphereInstance_' + str(lightType)
            primitives.apiCall( ILBCreateInstance(scene, sphereMesh, sphereName, trans, tempInstance) )
            apiCall( ILBSetRenderStats(tempInstance, ILB_RS_SHADOW_BIAS, ILB_RSOP_ENABLE) )

            # create the floor material
            floorMat = createNewMaterialHandle()
            primitives.apiCall( ILBCreateMaterial(scene, floorMatName, floorMat) )
            primitives.apiCall( ILBSetMaterialColor(floorMat, ILB_CC_DIFFUSE, ColorRGBA(0.7, 0.7, 0.7, 1.0)) )
Example #9
0
def main(argv):
    """docstring for main"""
    try:
        M_PI = 3.14159265358979323846

        bmh = createNewManagerHandle()
        
        apiCall( ILBSetLogTarget(ILB_LT_ERROR, ILB_LS_STDERR, None) )
        
        apiCall( ILBSetLogTarget(ILB_LT_INFO, ILB_LS_DEBUG_OUTPUT, None) )
        
        config = ConfigParser.ConfigParser()
        config.read('config.ini')
        configItems = {}
        for item in config.items('BeastPythonExamples'):
            configItems[item[0]] = item[1]

        # Setup our beast manager
        beastCacheFolder = os.path.normpath(configItems['beast_cache'])
        beastBinFolder = os.path.normpath(configItems['beast_bin'])
        beastDataFolder = os.path.normpath(configItems['beast_data'])

        dir = beastCacheFolder + r'/temp/baking'
        apiCall( ILBCreateManager(dir, ILB_CS_LOCAL, bmh) )
        
        # Set the path to the Beast binaries
        apiCall( ILBSetBeastPath(bmh, beastBinFolder) )

        # Waste the cache from previous runs if present
        apiCall( ILBClearCache(bmh) )

        sphereName = "Sphere"
        floorName = "Floor"
        sphereMatName = "SphereMaterial"
        floorMatName = "FloorMaterial"

        sphereMesh = createNewMeshHandle()
        floorMesh = createNewMeshHandle()
        floorMesh = primitives.createPlaneSimple(bmh, 'Floor', floorMatName)
        sphereMesh = primitives.createSphere(bmh, 'Sphere', sphereMatName, 30, 15)

        scene = createNewSceneHandle()
        sceneName = "BakingScene"
        apiCall( ILBBeginScene(bmh, sceneName, scene) )

        floorInstance = createNewInstanceHandle()
        floorTrans = vecmath.scaleTranslation(Vec3(10.0, 1.0, 10.0), Vec3(0.0, -5.0, 0.0))
        apiCall( ILBCreateInstance(scene, floorMesh, "FloorInstance", floorTrans, floorInstance))


        SPHERES = 5
        spherePosRadius = 5.0
        sphereRad = 2.0
        sphereInstances = []

        for i in range(SPHERES):
            angle = (M_PI * 2.0 * i) / SPHERES
            x = math.cos(angle) * spherePosRadius
            z = math.sin(angle) * spherePosRadius

            trans = vecmath.scaleTranslation(Vec3(sphereRad, sphereRad, sphereRad), 
                                     Vec3(x, -3.0, z))
            tempInstance = createNewInstanceHandle()
            sphereName = 'SphereInstance_' + str(i)
            apiCall( ILBCreateInstance(scene, sphereMesh, sphereName, trans, tempInstance) )
            apiCall( ILBSetRenderStats(tempInstance, ILB_RS_SHADOW_BIAS, ILB_RSOP_ENABLE) )


        # create the floor material
        floorMat = createNewMaterialHandle()
        primitives.apiCall( ILBCreateMaterial(scene, floorMatName, floorMat) )
        primitives.apiCall( ILBSetMaterialColor(floorMat, ILB_CC_DIFFUSE, ColorRGBA(0.7, 0.7, 0.7, 1.0)) )

        # create sphere material
        sphereMat = createNewMaterialHandle()
        apiCall( ILBCreateMaterial(scene, sphereMatName, sphereMat) )
        apiCall( ILBSetMaterialColor(sphereMat, ILB_CC_DIFFUSE, ColorRGBA(0.9, 0.9, 0.9, 1.0)) )
        #apiCall( ILBSetMaterialColor(sphereMat, ILB_CC_SPECULAR, ColorRGBA(1.0, 1.0, 1.0, 1.0)) )
        #apiCall( ILBSetMaterialScale(sphereMat, ILB_CC_REFLECTION, 0.1) )
        #apiCall( ILBSetMaterialScale(sphereMat, ILB_CC_SHININESS, 15.0) )

        light = createNewLightHandle()
        apiCall( ILBCreateDirectionalLight(scene, 
                                           "Sun", 
                                           vecmath.directionalLightOrientation(Vec3(1.0, -1.0, -1.0)),
                                           ColorRGB(1.0, 1.0, 0.8),
                                           light))
        apiCall( ILBSetCastShadows(light, True) )
        apiCall( ILBSetShadowSamples(light, 32) )
        apiCall( ILBSetShadowAngle(light, 0.1) )


        skylight = createNewLightHandle()
        apiCall( ILBCreateSkyLight( scene, 'SkyLight', vecmath.identity(), ColorRGB(0.21, 0.21, 0.3), skylight) )


        camera = createNewCameraHandle()
        apiCall( ILBCreatePerspectiveCamera(scene, 
                 "Camera", 
                 vecmath.setCameraMatrix(Vec3(0.3, 0.5, 15.0), Vec3(0.1, -0.3, -1.0), Vec3(0.0, 1.0, 0.0)),
                 camera) )

        # Finalize the scene
        apiCall(ILBEndScene(scene));


        beastConfig = beastCacheFolder + "/data/baking.xml"

        dom = minidom.getDOMImplementation()
        xmlDoc = dom.createDocument(None, "ILConfig", None)
        docRoot = xmlDoc.documentElement

        AASettingsElement = xmlDoc.createElement("AASettings")
        xmlCreateElement(xmlDoc, AASettingsElement, "minSampleRate", "0")
        xmlCreateElement(xmlDoc, AASettingsElement, "maxSampleRate", "2")
        docRoot.appendChild(AASettingsElement)


        RenderSettingsElement = xmlDoc.createElement("RenderSettings")
        xmlCreateElement(xmlDoc, RenderSettingsElement, "bias", "0.00001")
        docRoot.appendChild(RenderSettingsElement)

        FrameSettingsElement = xmlDoc.createElement("FrameSettings")
        xmlCreateElement(xmlDoc, FrameSettingsElement, "inputGamma", "0.45")
        outputCorrectionElement = xmlDoc.createElement("outputCorrection")
        xmlCreateElement(xmlDoc, outputCorrectionElement, "colorCorrection", "Gamma")
        xmlCreateElement(xmlDoc, outputCorrectionElement, "gamma", "2.2")
        FrameSettingsElement.appendChild(outputCorrectionElement)



        GISettingsElement = xmlDoc.createElement("GISettings")
        xmlCreateElement(xmlDoc, GISettingsElement, "enableGI", "true")
        xmlCreateElement(xmlDoc, GISettingsElement, "fgRays", "1000")
        xmlCreateElement(xmlDoc, GISettingsElement, "fgContrastThreshold", "0.1")
        xmlCreateElement(xmlDoc, GISettingsElement, "fginterpolationPoints", "15")
        xmlCreateElement(xmlDoc, GISettingsElement, "primaryIntegrator", "FinalGather")
        xmlCreateElement(xmlDoc, GISettingsElement, "secondaryIntegrator", "None")

        docRoot.appendChild(FrameSettingsElement)

        #write file contents
        xmlFile = open(beastConfig, "w")
        xmlFile.write(xmlDoc.toprettyxml())
        xmlFile.close()


        job = createNewJobHandle()
        apiCall( ILBCreateJob( bmh, 'TestJob', scene, beastConfig, job ) )

        fullShadingPass = createNewRenderPassHandle()
        apiCall( ILBCreateFullShadingPass(job, 'fullShading', fullShadingPass) )


        textureTarget = createNewTargetHandle()
        apiCall( ILBCreateTextureTarget(job, "textureTarget", 512, 512, textureTarget))
        entity = createNewTargetEntityHandle()

        # Add the floor instance twice in different parts of the UV space
        apiCall( ILBAddBakeInstance(textureTarget, floorInstance, entity) )
        apiCall( ILBSetUVTransform(entity, Vec2(0.0, 0.0), Vec2(0.5, 1.0)) )

        apiCall( ILBAddBakeInstance(textureTarget, floorInstance, entity) )

        apiCall( ILBSetUVTransform(entity, Vec2(0.5, 0.0), Vec2(0.5, 1.0)) )

        cameraTarget = createNewTargetHandle()
        apiCall( ILBCreateCameraTarget( job, 'cameraTarget', camera, 640, 480, cameraTarget ) )


        apiCall( ILBAddPassToTarget( textureTarget, fullShadingPass ) )
        apiCall( ILBAddPassToTarget( cameraTarget, fullShadingPass ) )

        if not renderJob( job ):
            print "render error occured"

    except BeastPythonException, (instance):
        print "exception: " + str(instance.parameter)
        ex = instance.parameter
        errorString = createNewStringHandle()
        extendedError = createNewStringHandle()
        ILBErrorToString(ex, errorString)
        ILBGetExtendErrorInformation(extendedError)
        print "Beast API error"
        print "Error: " + convertStringHandle(errorString)
        print "Info: " + convertStringHandle(extendedError)