コード例 #1
0
ファイル: GPUFFT.py プロジェクト: brakhane/RenderPipeline
    def __init__(self, N, sourceTex, normalizationFactor):
        """ Creates a new fft instance. The source texture has to specified
        from the begining, as the shaderAttributes are pregenerated for
        performance reasons """
        DebugObject.__init__(self, "GPU-FFT")

        self.size = N
        self.log2Size = int(math.log(N, 2))
        self.normalizationFactor = normalizationFactor

        # Create a ping and a pong texture, because we can't write to the
        # same texture while reading to it (that would lead to unexpected
        # behaviour, we could solve that by using an appropriate thread size,
        # but it works fine so far)
        self.pingTexture = Texture("FFTPing")
        self.pingTexture.setup2dTexture(
            self.size, self.size, Texture.TFloat, Texture.FRgba32)
        self.pongTexture = Texture("FFTPong")
        self.pongTexture.setup2dTexture(
            self.size, self.size, Texture.TFloat, Texture.FRgba32)
        self.sourceTex = sourceTex

        for tex in [self.pingTexture, self.pongTexture, sourceTex]:
            tex.setMinfilter(Texture.FTNearest)
            tex.setMagfilter(Texture.FTNearest)
            tex.setWrapU(Texture.WMClamp)
            tex.setWrapV(Texture.WMClamp)

        # Pregenerate weights & indices for the shaders
        self._computeWeighting()

        # Pre generate the shaders, we have 2 passes: Horizontal and Vertical
        # which both execute log2(N) times with varying radii
        self.horizontalFFTShader = BetterShader.loadCompute(
            "Shader/Water/HorizontalFFT.compute")
        self.horizontalFFT = NodePath("HorizontalFFT")
        self.horizontalFFT.setShader(self.horizontalFFTShader)
        self.horizontalFFT.setShaderInput(
            "precomputedWeights", self.weightsLookupTex)
        self.horizontalFFT.setShaderInput("N", LVecBase2i(self.size))

        self.verticalFFTShader = BetterShader.loadCompute(
            "Shader/Water/VerticalFFT.compute")
        self.verticalFFT = NodePath("VerticalFFT")
        self.verticalFFT.setShader(self.verticalFFTShader)
        self.verticalFFT.setShaderInput(
            "precomputedWeights", self.weightsLookupTex)
        self.verticalFFT.setShaderInput("N", LVecBase2i(self.size))

        # Create a texture where the result is stored
        self.resultTexture = Texture("Result")
        self.resultTexture.setup2dTexture(
            self.size, self.size, Texture.TFloat, Texture.FRgba16)
        self.resultTexture.setMinfilter(Texture.FTLinear)
        self.resultTexture.setMagfilter(Texture.FTLinear)

        # Prepare the shader attributes, so we don't have to regenerate them
        # every frame -> That is VERY slow (3ms per fft instance)
        self._prepareAttributes()
コード例 #2
0
    def __init__(self):
        DebugObject.__init__(self, "EditorShowbase")

        # Load the default prc file
        loadPrcFile("Config/configuration.prc")
        loadPrcFileData("", "window-title RenderPipeline Editor v0.1")

        ShowBase.__init__(self)
コード例 #3
0
    def __init__(self):
        DebugObject.__init__(self, "EditorShowbase")

        # Load the default prc file
        loadPrcFile("Config/configuration.prc")
        loadPrcFileData("", "window-title RenderPipeline Editor v0.1")

        ShowBase.__init__(self)

        
コード例 #4
0
ファイル: main.py プロジェクト: rimij405/RenderPipeline
    def __init__(self):
        DebugObject.__init__(self, "Main")

        self.debug("Bit System =", 8 * struct.calcsize("P"))

        # Load engine configuration
        self.debug("Loading panda3d configuration from configuration.prc ..")
        loadPrcFile("../../Config/configuration.prc")

        # Init the showbase
        ShowBase.__init__(self)

        # Create the render pipeline
        self.debug("Creating pipeline")
        self.renderPipeline = RenderingPipeline(self)

        # Set a write directory, where the shader cache and so on is stored
        # self.renderPipeline.getMountManager().setWritePath(writeDirectory)
        self.renderPipeline.getMountManager().setBasePath("../../")       
        self.renderPipeline.loadSettings("../../Config/pipeline.ini")

        # Create the pipeline, and enable scattering
        self.renderPipeline.create()

        # Load some demo source
        self.sceneSource = "Models/SmoothCube/Cube.bam"

        # Load scene from disk
        self.debug("Loading Scene '" + self.sceneSource + "'")
        self.model = self.loader.loadModel(self.sceneSource)
        self.scene = render.attachNewNode("Scene")
        self.model.reparentTo(self.scene)
        self.model.setZ(1.0)

        # Wheter to use a ground floor
        self.usePlane = True
        self.sceneWireframe = False

        # Flatten scene
        self.scene.flattenStrong()

        # Load ground plane if configured
        if self.usePlane:
            self.groundPlane = self.loader.loadModel(
                "Models/Plane/Model.egg.bam")
            self.groundPlane.setPos(0, 0, 0)
            self.groundPlane.setScale(2.0)
            self.groundPlane.setTwoSided(True)
            self.groundPlane.flattenStrong()
            self.groundPlane.reparentTo(self.scene)


        # Prepare textures with SRGB format
        self.prepareSRGB(self.scene)

        # Create movement controller (Freecam)
        self.controller = MovementController(self)
        self.controller.setInitialPosition(
            Vec3(0, -5, 5.0), Vec3(0, 0, 5))
        self.controller.setup()

        # Hotkey for wireframe
        self.accept("f3", self.toggleSceneWireframe)


        # Create a sun light
        dPos = Vec3(60, 30, 100)
        dirLight = DirectionalLight()
        dirLight.setShadowMapResolution(1024)
        dirLight.setPos(dPos)
        dirLight.setColor(Vec3(1))
        dirLight.setPssmTarget(base.cam, base.camLens)
        dirLight.setPssmDistance(50.0)
        dirLight.setCastsShadows(True)

        self.renderPipeline.addLight(dirLight)
        self.dirLight = dirLight
        sunPos = Vec3(56.7587, -31.3601, 189.196)
        self.dirLight.setPos(sunPos)

        # Tell the GI which light casts the GI
        self.renderPipeline.setGILightSource(dirLight)
        self.renderPipeline.setScatteringSource(dirLight)


        # Slider to move the sun
        if self.renderPipeline.settings.displayOnscreenDebugger:
            self.renderPipeline.guiManager.demoSlider.node[
                "command"] = self.setSunPos
            self.renderPipeline.guiManager.demoSlider.node[
                "value"] = 20

            self.lastSliderValue = 0.0

        # Load skyboxn
        self.skybox = self.renderPipeline.getDefaultSkybox()
        self.skybox.reparentTo(render)

        self.renderPipeline.setEffect(self.model, "DynamicMaterial.effect")


        self.renderPipeline.onSceneInitialized()

        self.createGUI()
コード例 #5
0
ファイル: main.py プロジェクト: Solecist/RenderPipeline
    def __init__(self):
        DebugObject.__init__(self, "Main")

        self.debug("Bit System =", 8 * struct.calcsize("P"))

        # Load engine configuration
        self.debug("Loading panda3d configuration from configuration.prc ..")
        loadPrcFile("Config/configuration.prc")

        # Init the showbase
        ShowBase.__init__(self)


        # Show loading screen
        self.loadingScreen = PipelineLoadingScreen(self)
        self.loadingScreen.render()
        self.loadingScreen.setStatus("Creating pipeline", 10)

        # Create the render pipeline
        self.debug("Creating pipeline")
        self.renderPipeline = RenderingPipeline(self)

        # Uncomment to use temp directory
        # writeDirectory = tempfile.mkdtemp(prefix='Shader-tmp')
        writeDirectory = "Temp/"

        # Set the pipeline base path
        self.renderPipeline.getMountManager().setBasePath(".")
        
        # Load pipeline settings
        self.renderPipeline.loadSettings("Config/pipeline.ini")

        self.loadingScreen.setStatus("Compiling shaders", 20)

        # Create the pipeline, and enable scattering
        self.renderPipeline.create()

        ####### END OF RENDER PIPELINE SETUP #######

        # Select demo scene here:

        # This sources are not included in the repo, for size reasons
        # self.sceneSource = "Demoscene.ignore/MasterSword/Scene.egg"
        # self.sceneSource = "Demoscene.ignore/MasterSword/Scene2.egg.bam"
        # self.sceneSource = "Demoscene.ignore/Couch2/Scene.egg"
        # self.sceneSource = "Demoscene.ignore/Couch/couch.egg.bam"
        # self.sceneSource = "Demoscene.ignore/LivingRoom/LivingRoom.egg"
        # self.sceneSource = "Demoscene.ignore/LivingRoom2/LivingRoom.egg"
        # self.sceneSource = "Demoscene.ignore/LostEmpire/Model.egg"
        # self.sceneSource = "Demoscene.ignore/SSLRTest/scene.egg"
        # self.sceneSource = "Demoscene.ignore/BMW/Bmw.egg"
        # self.sceneSource = "Demoscene.ignore/Tuscany/Tuscany.egg"
        # self.sceneSource = "Demoscene.ignore/EiffelTower/Scene.bam"
        # self.sceneSource = "Demoscene.ignore/HarvesterModel/Model.egg"
        # self.sceneSource = "Demoscene.ignore/OldHouse/Scene.egg"
        # self.sceneSource = "Demoscene.ignore/DemoTerrain/Scene.egg"
        # self.sceneSource = "Demoscene.ignore/TransparencyTest/Scene.egg"
        # self.sceneSource = "Demoscene.ignore/SanMiguel/Scene.bam"
        # self.sceneSource = "Demoscene.ignore/DabrovicSponza/Scene.egg"
        # self.sceneSource = "Demoscene.ignore/Avolition/level5.bam"
        # self.sceneSource = "Demoscene.ignore/Sphere/Scene.bam"
        # self.sceneSource = "Demoscene.ignore/Alphatest/alphatest.egg"
        # self.sceneSource = "Demoscene.ignore/TestScene/Test.bam"

        # This sources are included in the repo
        # self.sceneSource = "Models/CornelBox/Model.egg"
        # self.sceneSource = "Models/HouseSet/Model.egg"
        # self.sceneSource = "Models/PSSMTest/Model.egg.bam"
        # self.sceneSource = "Models/PBSTest/Scene.egg.bam"
        # self.sceneSource = "Models/HDRTest/Scene.egg"
        # self.sceneSource = "Models/GITestScene/Scene.egg"
        # self.sceneSource = "Models/VertexPerformanceTest/Scene.egg"
        # self.sceneSource = "Toolkit/Blender Material Library/MaterialLibrary.egg"
        self.sceneSource = "panda"

        # Select surrounding scene here
        self.sceneSourceSurround = None
        # self.sceneSourceSurround = "Demoscene.ignore/Couch/Surrounding.egg"
        # self.sceneSourceSurround = "Demoscene.ignore/LivingRoom/LivingRoom.egg"
        # self.sceneSourceSurround = "Models/LittleHouse/couch.bam"

        # Store a list of transparent objects
        self.transparentObjects = []

        # Create a sun light
        dPos = Vec3(60, 30, 100)

        if True:
            dirLight = DirectionalLight()
            dirLight.setPos(dPos * 100000.0)
            dirLight.setShadowMapResolution(2048)
            dirLight.setColor(Vec3(1.1, 1.05, 0.9) * 3.0)
            dirLight.setCastsShadows(True)
            dirLight.setPssmDistance(140)
            self.renderPipeline.addLight(dirLight)
            self.dirLight = dirLight

            # Tell the GI which light casts the GI
            self.renderPipeline.setScatteringSource(dirLight)

        # Slider to move the sun
        if self.renderPipeline.settings.displayOnscreenDebugger:
            self.renderPipeline.guiManager.demoSlider.node[
                "command"] = self.setSunPos
            self.renderPipeline.guiManager.demoSlider.node[
                "value"] = 50

            self.lastSliderValue = 0.5

        self.movingLights = []

        self.demoLights = []

        # Create some lights
        for i in xrange(0):
            pointLight = PointLight()

            radius = float(i) / 3.0 * 6.28 + 1.52
            xoffs = i * 3.0
            yoffs = math.cos(radius) * 0.0
            pointLight.setPos(0, 0, 15)
            pointLight.setColor(Vec3(0.2,0.6,1.0)*6)
            pointLight.setShadowMapResolution(512)
            pointLight.setRadius(18)
            pointLight.setCastsShadows(True)
            self.renderPipeline.addLight(pointLight)
            # pointLight.attachDebugNode(render)
            # self.movingLights.append(pointLight)

        # Create more lights
        for i in xrange(0):
            pointLight = PointLight()
            radius = float(i) / 12.0 * 6.28 + 5.22
            xoffs = math.sin(radius) * 50.0
            yoffs = math.cos(radius) * 50.0
            pointLight.setPos(Vec3( xoffs, yoffs, 12))
            # pointLight.setColor(Vec3(0.2,0.6,1.0) * 0.05)
            pointLight.setColor(random(), random(), random())
            pointLight.setRadius(90)
            self.renderPipeline.addLight(pointLight)
            # pointLight.attachDebugNode(render)


        for x in xrange(0):
            spotLight = SpotLight()
            spotLight.setColor(Vec3(0.5, 0.8, 1.0) * 0.3)

            lightPos = Vec3(math.sin(x/10.0 * 6.28) * 16.0, math.cos(x/10.0 * 6.28) * 16.0, 29.0)

            spotLight.setPos(lightPos)
            spotLight.lookAt(lightPos - Vec3(0, 0, 1))
            spotLight.setFov(90)
            spotLight.setShadowMapResolution(1024)
            spotLight.setCastsShadows(True)
            spotLight.setNearFar(2.0, 60.0)
            spotLight.setIESProfile("AreaLight")
            self.renderPipeline.addLight(spotLight)
            # spotLight.attachDebugNode(render)
            # self.movingLights.append(spotLight)

        # Attach update task
        self.addTask(self.update, "update")

        # Update loading screen status
        self.loadingScreen.setStatus("Loading scene", 55)
       

        # Show loading screen a bit
        if True:
            self.doMethodLater(0.5, self.loadScene, "Load Scene")
        else:
            self.loadScene()
コード例 #6
0
ファイル: EditorGUI.py プロジェクト: brakhane/RenderPipeline
 def __init__(self):
     DebugObject.__init__(self, "EditorGUI")
     self.parent = base.pixel2d
     self._createComponents()
コード例 #7
0
    def __init__(self):
        DebugObject.__init__(self, "WaterManager")
        self.options = OceanOptions()
        self.options.size = 512
        self.options.windDir.normalize()
        self.options.waveAmplitude *= 1e-7

        self.displacementTex = Texture("Displacement")
        self.displacementTex.setup2dTexture(
            self.options.size, self.options.size,
            Texture.TFloat, Texture.FRgba16)

        self.normalTex = Texture("Normal")
        self.normalTex.setup2dTexture(
            self.options.size, self.options.size,
            Texture.TFloat, Texture.FRgba16)

        self.combineShader = Shader.loadCompute(Shader.SLGLSL,
            "Shader/Water/Combine.compute")

        self.ptaTime = PTAFloat.emptyArray(1)

        # Create a gaussian random texture, as shaders aren't well suited
        # for that
        setRandomSeed(523)
        self.randomStorage = PNMImage(self.options.size, self.options.size, 4)
        self.randomStorage.setMaxval((2 ** 16) - 1)

        for x in xrange(self.options.size):
            for y in xrange(self.options.size):
                rand1 = self._getGaussianRandom() / 10.0 + 0.5
                rand2 = self._getGaussianRandom() / 10.0 + 0.5
                self.randomStorage.setXel(x, y, LVecBase3d(rand1, rand2, 0))
                self.randomStorage.setAlpha(x, y, 1.0)

        self.randomStorageTex = Texture("RandomStorage")
        self.randomStorageTex.load(self.randomStorage)
        self.randomStorageTex.setFormat(Texture.FRgba16)
        self.randomStorageTex.setMinfilter(Texture.FTNearest)
        self.randomStorageTex.setMagfilter(Texture.FTNearest)

        # Create the texture wwhere the intial height (H0 + Omega0) is stored.
        self.texInitialHeight = Texture("InitialHeight")
        self.texInitialHeight.setup2dTexture(
            self.options.size, self.options.size,
            Texture.TFloat, Texture.FRgba16)
        self.texInitialHeight.setMinfilter(Texture.FTNearest)
        self.texInitialHeight.setMagfilter(Texture.FTNearest)

        # Create the shader which populates the initial height texture
        self.shaderInitialHeight = Shader.loadCompute(Shader.SLGLSL,
            "Shader/Water/InitialHeight.compute")
        self.nodeInitialHeight = NodePath("initialHeight")
        self.nodeInitialHeight.setShader(self.shaderInitialHeight)
        self.nodeInitialHeight.setShaderInput("dest", self.texInitialHeight)
        self.nodeInitialHeight.setShaderInput(
            "N", LVecBase2i(self.options.size))
        self.nodeInitialHeight.setShaderInput(
            "patchLength", self.options.patchLength)
        self.nodeInitialHeight.setShaderInput("windDir", self.options.windDir)
        self.nodeInitialHeight.setShaderInput(
            "windSpeed", self.options.windSpeed)
        self.nodeInitialHeight.setShaderInput(
            "waveAmplitude", self.options.waveAmplitude)
        self.nodeInitialHeight.setShaderInput(
            "windDependency", self.options.windDependency)
        self.nodeInitialHeight.setShaderInput(
            "randomTex", self.randomStorageTex)

        self.attrInitialHeight = self.nodeInitialHeight.getAttrib(ShaderAttrib)

        self.heightTextures = []
        for i in xrange(3):

            tex = Texture("Height")
            tex.setup2dTexture(self.options.size, self.options.size,
                               Texture.TFloat, Texture.FRgba16)
            tex.setMinfilter(Texture.FTNearest)
            tex.setMagfilter(Texture.FTNearest)
            tex.setWrapU(Texture.WMClamp)
            tex.setWrapV(Texture.WMClamp)
            self.heightTextures.append(tex)

        # Also create the shader which updates the spectrum
        self.shaderUpdate = Shader.loadCompute(Shader.SLGLSL,
            "Shader/Water/Update.compute")
        self.nodeUpdate = NodePath("update")
        self.nodeUpdate.setShader(self.shaderUpdate)
        self.nodeUpdate.setShaderInput("outH0x", self.heightTextures[0])
        self.nodeUpdate.setShaderInput("outH0y", self.heightTextures[1])
        self.nodeUpdate.setShaderInput("outH0z", self.heightTextures[2])
        self.nodeUpdate.setShaderInput("initialHeight", self.texInitialHeight)
        self.nodeUpdate.setShaderInput("N", LVecBase2i(self.options.size))
        self.nodeUpdate.setShaderInput("time", self.ptaTime)
        self.attrUpdate = self.nodeUpdate.getAttrib(ShaderAttrib)

        # Create 3 FFTs
        self.fftX = GPUFFT(self.options.size, self.heightTextures[0],
                           self.options.normalizationFactor)
        self.fftY = GPUFFT(self.options.size, self.heightTextures[1],
                           self.options.normalizationFactor)
        self.fftZ = GPUFFT(self.options.size, self.heightTextures[2],
                           self.options.normalizationFactor)

        self.combineNode = NodePath("Combine")
        self.combineNode.setShader(self.combineShader)
        self.combineNode.setShaderInput(
            "displacementX", self.fftX.getResultTexture())
        self.combineNode.setShaderInput(
            "displacementY", self.fftY.getResultTexture())
        self.combineNode.setShaderInput(
            "displacementZ", self.fftZ.getResultTexture())
        self.combineNode.setShaderInput("normalDest", self.normalTex)
        self.combineNode.setShaderInput(
            "displacementDest", self.displacementTex)
        self.combineNode.setShaderInput(
            "N", LVecBase2i(self.options.size))
        self.combineNode.setShaderInput(
            "choppyScale", self.options.choppyScale)
        self.combineNode.setShaderInput(
            "gridLength", self.options.patchLength)
        # Store only the shader attrib as this is way faster
        self.attrCombine = self.combineNode.getAttrib(ShaderAttrib)
コード例 #8
0
    def __init__(self):
        DebugObject.__init__(self, "WaterManager")
        self.options = OceanOptions()
        self.options.size = 512
        self.options.windDir.normalize()
        self.options.waveAmplitude *= 1e-7

        self.displacementTex = Texture("Displacement")
        self.displacementTex.setup2dTexture(self.options.size,
                                            self.options.size, Texture.TFloat,
                                            Texture.FRgba16)

        self.normalTex = Texture("Normal")
        self.normalTex.setup2dTexture(self.options.size, self.options.size,
                                      Texture.TFloat, Texture.FRgba16)

        self.combineShader = BetterShader.loadCompute(
            "Shader/Water/Combine.compute")

        self.ptaTime = PTAFloat.emptyArray(1)

        # Create a gaussian random texture, as shaders aren't well suited
        # for that
        setRandomSeed(523)
        self.randomStorage = PNMImage(self.options.size, self.options.size, 4)
        self.randomStorage.setMaxval((2**16) - 1)

        for x in xrange(self.options.size):
            for y in xrange(self.options.size):
                rand1 = self._getGaussianRandom() / 10.0 + 0.5
                rand2 = self._getGaussianRandom() / 10.0 + 0.5
                self.randomStorage.setXel(x, y, LVecBase3d(rand1, rand2, 0))
                self.randomStorage.setAlpha(x, y, 1.0)

        self.randomStorageTex = Texture("RandomStorage")
        self.randomStorageTex.load(self.randomStorage)
        self.randomStorageTex.setFormat(Texture.FRgba16)
        self.randomStorageTex.setMinfilter(Texture.FTNearest)
        self.randomStorageTex.setMagfilter(Texture.FTNearest)

        # Create the texture wwhere the intial height (H0 + Omega0) is stored.
        self.texInitialHeight = Texture("InitialHeight")
        self.texInitialHeight.setup2dTexture(self.options.size,
                                             self.options.size, Texture.TFloat,
                                             Texture.FRgba16)
        self.texInitialHeight.setMinfilter(Texture.FTNearest)
        self.texInitialHeight.setMagfilter(Texture.FTNearest)

        # Create the shader which populates the initial height texture
        self.shaderInitialHeight = BetterShader.loadCompute(
            "Shader/Water/InitialHeight.compute")
        self.nodeInitialHeight = NodePath("initialHeight")
        self.nodeInitialHeight.setShader(self.shaderInitialHeight)
        self.nodeInitialHeight.setShaderInput("dest", self.texInitialHeight)
        self.nodeInitialHeight.setShaderInput("N",
                                              LVecBase2i(self.options.size))
        self.nodeInitialHeight.setShaderInput("patchLength",
                                              self.options.patchLength)
        self.nodeInitialHeight.setShaderInput("windDir", self.options.windDir)
        self.nodeInitialHeight.setShaderInput("windSpeed",
                                              self.options.windSpeed)
        self.nodeInitialHeight.setShaderInput("waveAmplitude",
                                              self.options.waveAmplitude)
        self.nodeInitialHeight.setShaderInput("windDependency",
                                              self.options.windDependency)
        self.nodeInitialHeight.setShaderInput("randomTex",
                                              self.randomStorageTex)

        self.attrInitialHeight = self.nodeInitialHeight.getAttrib(ShaderAttrib)

        self.heightTextures = []
        for i in xrange(3):

            tex = Texture("Height")
            tex.setup2dTexture(self.options.size, self.options.size,
                               Texture.TFloat, Texture.FRgba16)
            tex.setMinfilter(Texture.FTNearest)
            tex.setMagfilter(Texture.FTNearest)
            tex.setWrapU(Texture.WMClamp)
            tex.setWrapV(Texture.WMClamp)
            self.heightTextures.append(tex)

        # Also create the shader which updates the spectrum
        self.shaderUpdate = BetterShader.loadCompute(
            "Shader/Water/Update.compute")
        self.nodeUpdate = NodePath("update")
        self.nodeUpdate.setShader(self.shaderUpdate)
        self.nodeUpdate.setShaderInput("outH0x", self.heightTextures[0])
        self.nodeUpdate.setShaderInput("outH0y", self.heightTextures[1])
        self.nodeUpdate.setShaderInput("outH0z", self.heightTextures[2])
        self.nodeUpdate.setShaderInput("initialHeight", self.texInitialHeight)
        self.nodeUpdate.setShaderInput("N", LVecBase2i(self.options.size))
        self.nodeUpdate.setShaderInput("time", self.ptaTime)
        self.attrUpdate = self.nodeUpdate.getAttrib(ShaderAttrib)

        # Create 3 FFTs
        self.fftX = GPUFFT(self.options.size, self.heightTextures[0],
                           self.options.normalizationFactor)
        self.fftY = GPUFFT(self.options.size, self.heightTextures[1],
                           self.options.normalizationFactor)
        self.fftZ = GPUFFT(self.options.size, self.heightTextures[2],
                           self.options.normalizationFactor)

        self.combineNode = NodePath("Combine")
        self.combineNode.setShader(self.combineShader)
        self.combineNode.setShaderInput("displacementX",
                                        self.fftX.getResultTexture())
        self.combineNode.setShaderInput("displacementY",
                                        self.fftY.getResultTexture())
        self.combineNode.setShaderInput("displacementZ",
                                        self.fftZ.getResultTexture())
        self.combineNode.setShaderInput("normalDest", self.normalTex)
        self.combineNode.setShaderInput("displacementDest",
                                        self.displacementTex)
        self.combineNode.setShaderInput("N", LVecBase2i(self.options.size))
        self.combineNode.setShaderInput("choppyScale",
                                        self.options.choppyScale)
        self.combineNode.setShaderInput("gridLength", self.options.patchLength)
        # Store only the shader attrib as this is way faster
        self.attrCombine = self.combineNode.getAttrib(ShaderAttrib)
コード例 #9
0
ファイル: main.py プロジェクト: cesarmarinhorj/RenderPipeline
    def __init__(self):
        DebugObject.__init__(self, "Main")

        self.debug("Bit System =", 8 * struct.calcsize("P"))

        # Load engine configuration
        self.debug("Loading panda3d configuration from configuration.prc ..")
        loadPrcFile("../../Config/configuration.prc")

        # Init the showbase
        ShowBase.__init__(self)

        # Create the render pipeline
        self.debug("Creating pipeline")
        self.renderPipeline = RenderingPipeline(self)

        # Set a write directory, where the shader cache and so on is stored
        # self.renderPipeline.getMountManager().setWritePath(writeDirectory)
        self.renderPipeline.getMountManager().setBasePath("../../")       
        self.renderPipeline.loadSettings("../../Config/pipeline.ini")

        # Create the pipeline, and enable scattering
        self.renderPipeline.create()

        # Load some demo source
        # self.sceneSource = "Models/SmoothCube/Cube.bam"
        self.sceneSource = "Demoscene.ignore/Sphere/Scene.bam"

        # Load scene from disk
        self.scene = render.attachNewNode("Scene")
        self.debug("Loading Scene '" + self.sceneSource + "'")

        self.model = self.scene.attachNewNode("model")

        for metallic in xrange(2):
            for roughness in xrange(10):
                for specular in xrange(10):

                    model = self.loader.loadModel(self.sceneSource)
                    model.reparentTo(self.model)
                    model.setZ(5.0)
                    model.setX(metallic * 40.0 + roughness*3.0)
                    model.setY(specular*3.0)

                    model.setShaderInput("opt_roughness", roughness / 10.0)
                    model.setShaderInput("opt_metallic", metallic)
                    model.setShaderInput("opt_specular", specular / 10.0)

        ntex = loader.loadTexture("DemoNormalTex.png")
        ntex.setWrapU(Texture.WMRepeat)
        ntex.setWrapV(Texture.WMRepeat)
        ntex.setMinfilter(Texture.FTLinear)
        ntex.setMagfilter(Texture.FTLinear)
        self.model.setShaderInput("demoBumpTex", ntex)


        # Create some lights
        for i in xrange(10):
            continue
            pointLight = PointLight()
            xoffs = (i-25) * 15.0
            pointLight.setPos(xoffs, 0, 8)
            pointLight.setColor(Vec3(random(), random(), random())*1)
            pointLight.setRadius(15)
            self.renderPipeline.addLight(pointLight)

        # Wheter to use a ground floor
        self.usePlane = True
        self.sceneWireframe = False

        # Flatten scene
        self.scene.flattenStrong()

        # Load ground plane if configured
        if self.usePlane:
            self.groundPlane = self.loader.loadModel(
                "Models/Plane/Plane.bam")
            self.groundPlane.setPos(0, 0, 0)
            self.groundPlane.setScale(2.0)
            self.groundPlane.setTwoSided(True)
            self.groundPlane.flattenStrong()
            self.groundPlane.reparentTo(self.scene)


        # Prepare textures with SRGB format
        self.prepareSRGB(self.scene)

        # Create movement controller (Freecam)
        self.controller = MovementController(self)
        self.controller.setInitialPosition(
            Vec3(0, -5, 5.0), Vec3(0, 0, 5))
        self.controller.setup()

        # Hotkey for wireframe
        self.accept("f3", self.toggleSceneWireframe)


        # Create a sun light
        dPos = Vec3(60, 30, 100)
        dirLight = DirectionalLight()
        dirLight.setShadowMapResolution(1024)
        dirLight.setPos(dPos)
        dirLight.setColor(Vec3(1))
        dirLight.setPssmTarget(base.cam, base.camLens)
        dirLight.setPssmDistance(180.0)
        dirLight.setCastsShadows(True)

        self.renderPipeline.addLight(dirLight)
        self.dirLight = dirLight
        sunPos = Vec3(56.7587, -31.3601, 189.196)
        self.dirLight.setPos(sunPos)

        self.renderPipeline.setScatteringSource(dirLight)


        # Slider to move the sun
        if self.renderPipeline.settings.displayOnscreenDebugger:
            self.renderPipeline.guiManager.demoSlider.node[
                "command"] = self.setSunPos
            self.renderPipeline.guiManager.demoSlider.node[
                "value"] = 20

            self.lastSliderValue = 0.0

        # Load skyboxn
        self.skybox = self.renderPipeline.getDefaultSkybox()
        self.skybox.reparentTo(render)

        self.renderPipeline.setEffect(self.model, "DynamicMaterial.effect")

        self.renderPipeline.onSceneInitialized()
        self.renderPipeline.fillTextureStages(render)

        self.createGUI()
コード例 #10
0
 def __init__(self):
     DebugObject.__init__(self, "Editor")
     self.showbase = EditorShowbase()
     self.gui = EditorGUI()
コード例 #11
0
ファイル: EditorGUI.py プロジェクト: rasteron/RenderPipeline
 def __init__(self):
     DebugObject.__init__(self, "EditorGUI")
     self.parent = base.pixel2d
     self._createComponents()
コード例 #12
0
ファイル: main.py プロジェクト: rasteron/RenderPipeline
    def __init__(self):
        DebugObject.__init__(self, "Main")

        self.debug("Bit System =", 8 * struct.calcsize("P"))

        # Load engine configuration
        self.debug("Loading panda3d configuration from configuration.prc ..")
        loadPrcFile("Config/configuration.prc")

        # Init the showbase
        ShowBase.__init__(self)

        # Create the render pipeline
        self.debug("Creating pipeline")
        self.renderPipeline = RenderingPipeline(self)
        self.renderPipeline.loadSettings("Config/pipeline.ini")

        # Uncomment to use temp directory
        # writeDirectory = tempfile.mkdtemp(prefix='Shader-tmp')
        # writeDirectory = "Temp/"

        # Clear write directory when app exits
        # atexit.register(os.remove, writeDirectory)

        # Set a write directory, where the shader cache and so on is stored
        # self.renderPipeline.getMountManager().setWritePath(writeDirectory)

        self.renderPipeline.getMountManager().setBasePath(".")

         ####### END OF RENDER PIPELINE SETUP #######
        # Load some demo source
        # self.sceneSource = "Demoscene.ignore/sponza.egg.bam"
        # self.sceneSource = "Demoscene.ignore/occlusionTest/Model.egg"
        # self.sceneSource = "Demoscene.ignore/lost-empire/Model.egg"
        # self.sceneSource = "Models/PSSMTest/Model.egg.bam"
        # self.sceneSource = "Scene.ignore/Car.bam"
        # self.sceneSource = "Demoscene.ignore/GITest/Model.egg"
        # self.sceneSource = "Demoscene.ignore/PSSMTest/Model.egg.bam"
        # self.sceneSource = "Models/Raventon/Model.egg"
        # self.sceneSource = "Demoscene.ignore/Room/LivingRoom.egg.bam"
        self.sceneSource = "Toolkit/Blender Material Library/MaterialLibrary.egg"

        # If global illumination is enabled, load the voxel grid
        GlobalIllumination.setSceneRoot(
            "Toolkit/Blender Material Library/voxelized/")

        # Create the pipeline, and enable scattering
        self.renderPipeline.create()
        self.renderPipeline.enableDefaultEarthScattering()

        # Load scene from disk
        self.debug("Loading Scene '" + self.sceneSource + "'")
        self.scene = self.loader.loadModel(self.sceneSource)

        # Wheter to use a ground floor
        self.usePlane = False
        self.sceneWireframe = False

        # Flatten scene?
        self.scene.flattenStrong()

        # Load ground plane if configured
        if self.usePlane:
            self.groundPlane = self.loader.loadModel(
                "Models/Plane/Model.egg.bam")
            self.groundPlane.setPos(0, 0, -0.01)
            self.groundPlane.setScale(2.0)
            self.groundPlane.setTwoSided(True)
            self.groundPlane.flattenStrong()
            self.groundPlane.reparentTo(self.scene)

        # Some artists really don't know about backface culling
        # self.scene.setTwoSided(True)

        # Required for tesselation
        # self.convertToPatches(self.scene)

        self.scene.reparentTo(self.render)

        # Prepare textures with SRGB format
        self.prepareSRGB(self.scene)

        # Create movement controller (Freecam)
        self.controller = MovementController(self)
        self.controller.setInitialPosition(
            Vec3(0.422895, -6.49557, 4.72692), Vec3(0, 0, 3))
        self.controller.setup()

        # Hotkey for wireframe
        self.accept("f3", self.toggleSceneWireframe)

        # Hotkey to reload all shaders
        self.accept("r", self.setShaders)

        # Create a sun light
        dPos = Vec3(60, 30, 100)
        dirLight = DirectionalLight()
        dirLight.setDirection(dPos)
        dirLight.setShadowMapResolution(4096)
        dirLight.setAmbientColor(Vec3(0.5, 0.5, 0.5))
        dirLight.setCastsShadows(True)
        dirLight.setPos(dPos)
        dirLight.setColor(Vec3(4))
        self.renderPipeline.addLight(dirLight)
        self.dirLight = dirLight
        sunPos = Vec3(56.7587, -31.3601, 189.196)
        self.dirLight.setPos(sunPos)
        self.dirLight.setDirection(sunPos)

        # Slider to move the sun
        if self.renderPipeline.settings.displayOnscreenDebugger:
            self.renderPipeline.guiManager.demoSlider.node[
                "command"] = self.setSunPos
            self.lastSliderValue = 0.0

        # Load skybox
        self.skybox = None
        self.loadSkybox()

        # Set default object shaders
        self.setShaders(refreshPipeline=False)
コード例 #13
0
ファイル: main.py プロジェクト: brakhane/RenderPipeline
    def __init__(self):
        DebugObject.__init__(self, "Main")

        self.debug("Bit System =", 8 * struct.calcsize("P"))

        # Load engine configuration
        self.debug("Loading panda3d configuration from configuration.prc ..")
        loadPrcFile("Config/configuration.prc")

        # Init the showbase
        ShowBase.__init__(self)

        # Create the render pipeline
        self.debug("Creating pipeline")
        self.renderPipeline = RenderingPipeline(self)

        # Uncomment to use temp directory
        # writeDirectory = tempfile.mkdtemp(prefix='Shader-tmp')
        # writeDirectory = "Temp/"

        # Clear write directory when app exits
        # atexit.register(os.remove, writeDirectory)

        # Set a write directory, where the shader cache and so on is stored
        # self.renderPipeline.getMountManager().setWritePath(writeDirectory)
        self.renderPipeline.getMountManager().setBasePath(".")

        ####### END OF RENDER PIPELINE SETUP #######
        # Load some demo source
        # self.sceneSource = "Demoscene.ignore/sponza.egg.bam"
        # self.sceneSource = "Demoscene.ignore/occlusionTest/Model.egg"
        # self.sceneSource = "Demoscene.ignore/lost-empire/Model.egg"
        # self.sceneSource = "Models/PSSMTest/Model.egg.bam"
        # self.sceneSource = "Demoscene.ignore/GITest/Model.egg"
        # self.sceneSource = "Demoscene.ignore/PSSMTest/Model.egg.bam"
        # self.sceneSource = "Demoscene.ignore/Room/LivingRoom.egg"
        # self.sceneSource = "Models/CornelBox/Model.egg"
        # self.sceneSource = "Models/HouseSet/Model.egg"
        self.sceneSource = "Toolkit/Blender Material Library/MaterialLibrary.egg"

        self.renderPipeline.loadSettings("Config/pipeline.ini")

        # Create the pipeline, and enable scattering
        self.renderPipeline.create()
        self.renderPipeline.enableDefaultEarthScattering()

        # Load scene from disk
        self.debug("Loading Scene '" + self.sceneSource + "'")
        self.scene = self.loader.loadModel(self.sceneSource)

        # Wheter to use a ground floor
        self.usePlane = False
        self.sceneWireframe = False

        # Flatten scene?
        self.scene.flattenStrong()
        self.scene.analyze()

        # Load ground plane if configured
        if self.usePlane:
            self.groundPlane = self.loader.loadModel(
                "Models/Plane/Model.egg.bam")
            self.groundPlane.setPos(0, 0, -0.01)
            self.groundPlane.setScale(2.0)
            self.groundPlane.setTwoSided(True)
            self.groundPlane.flattenStrong()
            self.groundPlane.reparentTo(self.scene)

        # Some artists really don't know about backface culling
        # self.scene.setTwoSided(True)

        # Required for tesselation

        # self.convertToPatches(self.scene)

        self.scene.reparentTo(self.render)

        # Prepare textures with SRGB format
        self.prepareSRGB(self.scene)

        # Create movement controller (Freecam)wwww
        self.controller = MovementController(self)
        self.controller.setInitialPosition(Vec3(0, -5, 5.0), Vec3(0, 0, 5))
        self.controller.setup()

        # Hotkey for wireframe
        self.accept("f3", self.toggleSceneWireframe)

        # Hotkey to reload all shaders
        self.accept("r", self.setShaders)

        # for i in xrange(1):
        #     pointLight = PointLight()
        #     pointLight.setPos(Vec3( (i-1)*3, 0, 7))
        #     pointLight.setColor(Vec3(0.1))
        #     pointLight.setShadowMapResolution(1024)
        #     pointLight.setRadius(50)
        #     pointLight.setCastsShadows(True)
        #     # pointLight.attachDebugNode(render)
        #     self.renderPipeline.addLight(pointLight)

        # Create a sun light
        dPos = Vec3(60, 30, 100)
        dirLight = DirectionalLight()
        dirLight.setDirection(dPos)
        dirLight.setShadowMapResolution(2048)
        dirLight.setAmbientColor(Vec3(0.0, 0.0, 0.0))
        dirLight.setPos(dPos)
        dirLight.setColor(Vec3(3))
        dirLight.setPssmTarget(base.cam, base.camLens)
        dirLight.setCastsShadows(True)

        self.renderPipeline.addLight(dirLight)
        self.dirLight = dirLight
        sunPos = Vec3(56.7587, -31.3601, 189.196)
        self.dirLight.setPos(sunPos)
        self.dirLight.setDirection(sunPos)

        # Tell the GI which light casts the GI
        self.renderPipeline.setGILightSource(dirLight)

        # Slider to move the sun
        if self.renderPipeline.settings.displayOnscreenDebugger:
            self.renderPipeline.guiManager.demoSlider.node[
                "command"] = self.setSunPos
            self.renderPipeline.guiManager.demoSlider.node["value"] = 20

            self.lastSliderValue = 0.0

        # Load skyboxn
        self.skybox = None
        self.loadSkybox()

        # Set default object shaders
        self.setShaders(refreshPipeline=False)
コード例 #14
0
ファイル: main.py プロジェクト: swq0553/RenderPipeline
    def __init__(self):
        DebugObject.__init__(self, "Main")

        self.debug("Bit System =", 8 * struct.calcsize("P"))

        # Load engine configuration
        self.debug("Loading panda3d configuration from configuration.prc ..")
        loadPrcFile("../../Config/configuration.prc")

        # Init the showbase
        ShowBase.__init__(self)

        # Create the render pipeline
        self.debug("Creating pipeline")
        self.renderPipeline = RenderingPipeline(self)

        # Set a write directory, where the shader cache and so on is stored
        # self.renderPipeline.getMountManager().setWritePath(writeDirectory)
        self.renderPipeline.getMountManager().setBasePath("../../")
        self.renderPipeline.loadSettings("../../Config/pipeline.ini")

        # Create the pipeline, and enable scattering
        self.renderPipeline.create()

        # Load some demo source
        # self.sceneSource = "Models/SmoothCube/Cube.bam"
        self.sceneSource = "Demoscene.ignore/Sphere/Scene.bam"

        # Load scene from disk
        self.scene = render.attachNewNode("Scene")
        self.debug("Loading Scene '" + self.sceneSource + "'")

        self.model = self.scene.attachNewNode("model")

        for metallic in xrange(2):
            for roughness in xrange(10):
                for specular in xrange(10):

                    model = self.loader.loadModel(self.sceneSource)
                    model.reparentTo(self.model)
                    model.setZ(5.0)
                    model.setX(metallic * 40.0 + roughness * 3.0)
                    model.setY(specular * 3.0)

                    model.setShaderInput("opt_roughness", roughness / 10.0)
                    model.setShaderInput("opt_metallic", metallic)
                    model.setShaderInput("opt_specular", specular / 10.0)

        ntex = loader.loadTexture("DemoNormalTex.png")
        ntex.setWrapU(Texture.WMRepeat)
        ntex.setWrapV(Texture.WMRepeat)
        ntex.setMinfilter(Texture.FTLinear)
        ntex.setMagfilter(Texture.FTLinear)
        self.model.setShaderInput("demoBumpTex", ntex)

        # Create some lights
        for i in xrange(10):
            continue
            pointLight = PointLight()
            xoffs = (i - 25) * 15.0
            pointLight.setPos(xoffs, 0, 8)
            pointLight.setColor(Vec3(random(), random(), random()) * 1)
            pointLight.setRadius(15)
            self.renderPipeline.addLight(pointLight)

        # Wheter to use a ground floor
        self.usePlane = True
        self.sceneWireframe = False

        # Flatten scene
        self.scene.flattenStrong()

        # Load ground plane if configured
        if self.usePlane:
            self.groundPlane = self.loader.loadModel("Models/Plane/Plane.bam")
            self.groundPlane.setPos(0, 0, 0)
            self.groundPlane.setScale(2.0)
            self.groundPlane.setTwoSided(True)
            self.groundPlane.flattenStrong()
            self.groundPlane.reparentTo(self.scene)

        # Prepare textures with SRGB format
        self.prepareSRGB(self.scene)

        # Create movement controller (Freecam)
        self.controller = MovementController(self)
        self.controller.setInitialPosition(Vec3(0, -5, 5.0), Vec3(0, 0, 5))
        self.controller.setup()

        # Hotkey for wireframe
        self.accept("f3", self.toggleSceneWireframe)

        # Create a sun light
        dPos = Vec3(60, 30, 100)
        dirLight = DirectionalLight()
        dirLight.setShadowMapResolution(1024)
        dirLight.setPos(dPos)
        dirLight.setColor(Vec3(1))
        dirLight.setPssmTarget(base.cam, base.camLens)
        dirLight.setPssmDistance(180.0)
        dirLight.setCastsShadows(True)

        self.renderPipeline.addLight(dirLight)
        self.dirLight = dirLight
        sunPos = Vec3(56.7587, -31.3601, 189.196)
        self.dirLight.setPos(sunPos)

        self.renderPipeline.setScatteringSource(dirLight)

        # Slider to move the sun
        if self.renderPipeline.settings.displayOnscreenDebugger:
            self.renderPipeline.guiManager.demoSlider.node[
                "command"] = self.setSunPos
            self.renderPipeline.guiManager.demoSlider.node["value"] = 20

            self.lastSliderValue = 0.0

        # Load skyboxn
        self.skybox = self.renderPipeline.getDefaultSkybox()
        self.skybox.reparentTo(render)

        self.renderPipeline.setEffect(self.model, "DynamicMaterial.effect")

        self.renderPipeline.onSceneInitialized()
        self.renderPipeline.fillTextureStages(render)

        self.createGUI()
コード例 #15
0
ファイル: Editor.py プロジェクト: aurodev/RenderPipeline
 def __init__(self):
     DebugObject.__init__(self, "Editor")
     self.showbase = EditorShowbase()
     self.gui = EditorGUI()
コード例 #16
0
    def __init__(self):
        DebugObject.__init__(self, "Main")

        self.debug("Bit System =", 8 * struct.calcsize("P"))

        # Load engine configuration
        self.debug("Loading panda3d configuration from configuration.prc ..")
        loadPrcFile("../../Config/configuration.prc")

        # Init the showbase
        ShowBase.__init__(self)

        # Create the render pipeline
        self.debug("Creating pipeline")
        self.renderPipeline = RenderingPipeline(self)

        # Set a write directory, where the shader cache and so on is stored
        # self.renderPipeline.getMountManager().setWritePath(writeDirectory)
        self.renderPipeline.getMountManager().setBasePath("../../")
        self.renderPipeline.loadSettings("../../Config/pipeline.ini")

        # Create the pipeline, and enable scattering
        self.renderPipeline.create()
        self.renderPipeline.enableDefaultEarthScattering()

        # Load some demo source
        self.sceneSource = "Models/SmoothCube/Cube.bam"

        # Load scene from disk
        self.debug("Loading Scene '" + self.sceneSource + "'")
        self.model = self.loader.loadModel(self.sceneSource)
        self.scene = render.attachNewNode("Scene")
        self.model.reparentTo(self.scene)
        self.model.setZ(1.0)

        # Wheter to use a ground floor
        self.usePlane = True
        self.sceneWireframe = False

        # Flatten scene
        self.scene.flattenStrong()

        # Load ground plane if configured
        if self.usePlane:
            self.groundPlane = self.loader.loadModel(
                "Models/Plane/Model.egg.bam")
            self.groundPlane.setPos(0, 0, 0)
            self.groundPlane.setScale(2.0)
            self.groundPlane.setTwoSided(True)
            self.groundPlane.flattenStrong()
            self.groundPlane.reparentTo(self.scene)

        # Prepare textures with SRGB format
        self.prepareSRGB(self.scene)

        # Create movement controller (Freecam)
        self.controller = MovementController(self)
        self.controller.setInitialPosition(Vec3(0, -5, 5.0), Vec3(0, 0, 5))
        self.controller.setup()

        # Hotkey for wireframe
        self.accept("f3", self.toggleSceneWireframe)

        # Hotkey to reload all shaders
        self.accept("r", self.setShaders)

        # Create a sun light
        dPos = Vec3(60, 30, 100)
        dirLight = DirectionalLight()
        dirLight.setDirection(dPos)
        dirLight.setShadowMapResolution(2048)
        dirLight.setAmbientColor(Vec3(0.0, 0.0, 0.0))
        dirLight.setPos(dPos)
        dirLight.setColor(Vec3(3))
        dirLight.setPssmTarget(base.cam, base.camLens)
        dirLight.setPssmDistance(50.0)
        dirLight.setCastsShadows(True)

        self.renderPipeline.addLight(dirLight)
        self.dirLight = dirLight
        sunPos = Vec3(56.7587, -31.3601, 189.196)
        self.dirLight.setPos(sunPos)
        self.dirLight.setDirection(sunPos)

        # Tell the GI which light casts the GI
        self.renderPipeline.setGILightSource(dirLight)

        # Slider to move the sun
        if self.renderPipeline.settings.displayOnscreenDebugger:
            self.renderPipeline.guiManager.demoSlider.node[
                "command"] = self.setSunPos
            self.renderPipeline.guiManager.demoSlider.node["value"] = 20

            self.lastSliderValue = 0.0

        # Load skyboxn
        self.skybox = None
        self.loadSkybox()

        # Set default object shaders
        self.setShaders(refreshPipeline=False)

        self.createGUI()
コード例 #17
0
ファイル: main.py プロジェクト: swq0553/RenderPipeline
    def __init__(self):
        DebugObject.__init__(self, "Main")

        self.debug("Bit System =", 8 * struct.calcsize("P"))

        # Load engine configuration
        self.debug("Loading panda3d configuration from configuration.prc ..")
        loadPrcFile("Config/configuration.prc")

        # Init the showbase
        ShowBase.__init__(self)

        # Show loading screen
        self.loadingScreen = PipelineLoadingScreen(self)
        self.loadingScreen.render()
        self.loadingScreen.setStatus("Creating pipeline", 10)

        # Create the render pipeline
        self.debug("Creating pipeline")
        self.renderPipeline = RenderingPipeline(self)

        # Uncomment to use temp directory
        # writeDirectory = tempfile.mkdtemp(prefix='Shader-tmp')
        writeDirectory = "Temp/"

        # Set the pipeline base path
        self.renderPipeline.getMountManager().setBasePath(".")

        # Load pipeline settings
        self.renderPipeline.loadSettings("Config/pipeline.ini")

        self.loadingScreen.setStatus("Compiling shaders", 20)

        # Create the pipeline, and enable scattering
        self.renderPipeline.create()

        ####### END OF RENDER PIPELINE SETUP #######

        # Select demo scene here:

        # This sources are not included in the repo, for size reasons
        # self.sceneSource = "Demoscene.ignore/MasterSword/Scene.egg"
        # self.sceneSource = "Demoscene.ignore/MasterSword/Scene2.egg.bam"
        # self.sceneSource = "Demoscene.ignore/Couch2/Scene.egg"
        # self.sceneSource = "Demoscene.ignore/Couch/couch.egg.bam"
        # self.sceneSource = "Demoscene.ignore/LittleHouse/Scene.bam"
        # self.sceneSource = "Demoscene.ignore/LivingRoom/LivingRoom.egg"
        # self.sceneSource = "Demoscene.ignore/LivingRoom2/LivingRoom.egg"
        # self.sceneSource = "Demoscene.ignore/LostEmpire/Model.egg"
        # self.sceneSource = "Demoscene.ignore/SSLRTest/scene.egg"
        # self.sceneSource = "Demoscene.ignore/BMW/Bmw.egg"
        # self.sceneSource = "Demoscene.ignore/Tuscany/Tuscany.egg"
        # self.sceneSource = "Demoscene.ignore/EiffelTower/Scene.bam"
        # self.sceneSource = "Demoscene.ignore/HarvesterModel/Model.egg"
        # self.sceneSource = "Demoscene.ignore/AudiR8/Scene.bam"
        # self.sceneSource = "Demoscene.ignore/OldHouse/Scene.egg"
        # self.sceneSource = "Demoscene.ignore/DemoTerrain/Scene.egg"
        # self.sceneSource = "Demoscene.ignore/TransparencyTest/Scene.egg"
        # self.sceneSource = "Demoscene.ignore/SanMiguel/Scene.bam"
        self.sceneSource = "Demoscene.ignore/DabrovicSponza/Scene.egg"
        # self.sceneSource = "Demoscene.ignore/Sponza/sponza.egg.bam"
        # self.sceneSource = "Demoscene.ignore/Avolition/level5.bam"
        # self.sceneSource = "Demoscene.ignore/Sphere/Scene.bam"
        # self.sceneSource = "Demoscene.ignore/Alphatest/Scene.bam"
        # self.sceneSource = "Demoscene.ignore/TestScene/Test.bam"
        # self.sceneSource = "Demoscene.ignore/BokehTest/Scene.egg"

        # This sources are included in the repo
        # self.sceneSource = "Models/CornelBox/Model.egg"
        # self.sceneSource = "Models/HouseSet/Model.egg"
        # self.sceneSource = "Models/PSSMTest/Model.egg.bam"
        # self.sceneSource = "Models/PBSTest/Scene.egg.bam"
        # self.sceneSource = "Models/HDRTest/Scene.egg"
        # self.sceneSource = "Models/GITestScene/Scene.egg"
        # self.sceneSource = "Toolkit/Blender Material Library/MaterialLibrary.bam"
        # self.sceneSource = "panda"

        # Select surrounding scene here
        self.sceneSourceSurround = None
        # self.sceneSourceSurround = "Demoscene.ignore/Couch/Surrounding.egg"
        # self.sceneSourceSurround = "Demoscene.ignore/LivingRoom/LivingRoom.egg"

        # Wheter to create the default ground plane
        self.usePlane = False

        # Store a list of transparent objects
        self.transparentObjects = []

        # Create a sun light
        dPos = Vec3(60, 30, 100)

        if True:
            dirLight = DirectionalLight()
            dirLight.setPos(dPos * 100000.0)
            dirLight.setShadowMapResolution(2048)
            dirLight.setColor(Vec3(1.0, 1.0, 1.0) * 5.0)
            dirLight.setCastsShadows(True)
            dirLight.setPssmDistance(140)
            self.renderPipeline.addLight(dirLight)
            self.dirLight = dirLight

            # Tell the GI which light casts the GI
            self.renderPipeline.setScatteringSource(dirLight)

        # Slider to move the sun
        if self.renderPipeline.settings.displayOnscreenDebugger:
            self.renderPipeline.guiManager.demoSlider.node[
                "command"] = self.setSunPos
            self.renderPipeline.guiManager.demoSlider.node["value"] = 89

            self.lastSliderValue = 0.5

        self.movingLights = []

        self.demoLights = []

        # Create some lights
        for i in xrange(5):
            continue
            pointLight = PointLight()

            radius = float(i) / 3.0 * 6.28 + 1.52
            xoffs = (i - 3) * 10.0
            yoffs = math.cos(radius) * 0.0
            pointLight.setPos(xoffs, 0, 8)
            # pointLight.setColor(Vec3(0.2,0.6,1.0)*6)
            pointLight.setColor(Vec3(random(), random(), random()) * 3)
            pointLight.setShadowMapResolution(512)
            pointLight.setRadius(18)
            pointLight.setCastsShadows(True)
            self.renderPipeline.addLight(pointLight)
            pointLight.attachDebugNode()
            # self.movingLights.append(pointLight)

        # Create more lights
        for i in xrange(0):
            pointLight = PointLight()
            radius = float(i) / 12.0 * 6.28 + 5.22
            xoffs = math.sin(radius) * 50.0
            yoffs = math.cos(radius) * 50.0
            pointLight.setPos(Vec3(xoffs, yoffs, 12))
            # pointLight.setColor(Vec3(0.2,0.6,1.0) * 0.05)
            pointLight.setColor(random(), random(), random())
            pointLight.setRadius(90)
            self.renderPipeline.addLight(pointLight)
            # pointLight.attachDebugNode(render)

        for x in xrange(0):
            spotLight = SpotLight()
            spotLight.setColor(Vec3(0.5, 0.8, 1.0) * 0.3)

            lightPos = Vec3(
                math.sin(x / 10.0 * 6.28) * 16.0,
                math.cos(x / 10.0 * 6.28) * 16.0, 29.0)

            spotLight.setPos(lightPos)
            spotLight.lookAt(lightPos - Vec3(0, 0, 1))
            spotLight.setFov(90)
            spotLight.setShadowMapResolution(1024)
            spotLight.setCastsShadows(True)
            spotLight.setNearFar(2.0, 60.0)
            spotLight.setIESProfile("AreaLight")
            self.renderPipeline.addLight(spotLight)
            # spotLight.attachDebugNode(render)
            # self.movingLights.append(spotLight)

        # Attach update task
        self.addTask(self.update, "update")

        # Update loading screen status
        self.loadingScreen.setStatus("Loading scene", 55)

        # Show loading screen a bit
        if False:
            self.doMethodLater(0.5, self.loadScene, "Load Scene")
        else:
            self.loadScene()