예제 #1
0
    def setup_scene(self) :
        h3dres = self._h3dres

        # Add environment
        self._env = h3d.addNodes(h3d.RootNode, h3dres.env)
        h3d.setNodeTransform(self._env, 0, 0, 0, 0, 0, 0, 0.23, 0.23, 0.23)
        # Add skybox
        self._sky = h3d.addNodes(h3d.RootNode, h3dres.skyBox)
        h3d.setNodeTransform(self._sky, 0, 0, 0, 0, 0, 0, 100, 50, 100)
        # Add light source
        self._light = h3d.addLightNode(h3d.RootNode, 'Light1', h3dres.lightMat, 'LIGHTING', 'SHADOWMAP')
        h3d.setNodeTransform(self._light, 50, 40, -50, -60, 130, 0, 1, 1, 1)
        h3d.setNodeParamF(self._light, h3d.Light.RadiusF, 0, 250)
        h3d.setNodeParamF(self._light, h3d.Light.FovF, 0, 90)
        h3d.setNodeParamI(self._light, h3d.Light.ShadowMapCountI, 3)
        h3d.setNodeParamF(self._light, h3d.Light.ShadowSplitLambdaF, 0, 0.9)
        h3d.setNodeParamF(self._light, h3d.Light.ShadowMapBiasF, 0, 0.001)
        h3d.setNodeParamF(self._light, h3d.Light.ColorF3, 0, 0.9)
        h3d.setNodeParamF(self._light, h3d.Light.ColorF3, 1, 0.9)
        h3d.setNodeParamF(self._light, h3d.Light.ColorF3, 2, 0.9)
        # Create volume data
        self._vol = h3d.addNodes(h3d.RootNode, h3dres.volBox)
        h3d.setNodeTransform(self._vol, 0, 3, 0, 0, 0, 0, 3, 3, 3)

        # Add a camera
        self.add_camera("MainCamera", h3dres.deferredPipe)
        h3d.setNodeTransform(self.camera, 9, 6.0, -14, -15, 145, 0, 1, 1, 1)
예제 #2
0
    def _h3dSetupScene(self):
        h3dres = self._h3dres

        self._env = h3d.addNodes(h3d.RootNode, h3dres.env)
        h3d.setNodeTransform(self._env, 0, -20, 0, 0, 0, 0, 20, 20, 20)

        self._knight = h3d.addNodes(h3d.RootNode, h3dres.knight)
        h3d.setNodeTransform(self._knight, 0, 0, 0, 0, 180, 0, 0.1, 0.1, 0.1)
        h3d.setupModelAnimStage(self._knight, 0, h3dres.knightAnim1, 0, '', False)
        h3d.setupModelAnimStage(self._knight, 1, h3dres.knightAnim2, 0, '', False)

        # Attach particle system to hand joint
        h3d.findNodes(self._knight, 'Bip01_R_Hand', h3d.NodeTypes.Joint)
        hand = h3d.getNodeFindResult(0)
        self._particleSystem = h3d.addNodes(hand, h3dres.particleSys)
        h3d.setNodeTransform(self._particleSystem, 0, 40, 0, 90, 0, 0, 1, 1, 1)

        self._light = h3d.addLightNode(h3d.RootNode, 'Light1', 0, 'LIGHTING', 'SHADOWMAP')
        h3d.setNodeTransform(self._light, 0, 15, 10, -60, 0, 0, 1, 1, 1)
        h3d.setNodeParamF(self._light, h3d.Light.RadiusF, 0, 30)
        h3d.setNodeParamF(self._light, h3d.Light.FovF, 0, 90)
        h3d.setNodeParamI(self._light, h3d.Light.ShadowMapCountI, 1)
        h3d.setNodeParamF(self._light, h3d.Light.ShadowMapBiasF, 0, 0.01)
        h3d.setNodeParamF(self._light, h3d.Light.ColorF3, 0, 1.0)
        h3d.setNodeParamF(self._light, h3d.Light.ColorF3, 1, 0.8)
        h3d.setNodeParamF(self._light, h3d.Light.ColorF3, 2, 0.7)

        # Customize post processing effects
        mat = h3d.findResource(h3d.ResTypes.Material, 'pipelines/postHDR.material.xml')
        # hdrParams: exposure, brightpass threshold, brightpass offset (see shader for description)
        h3d.setMaterialUniform(mat, 'hdrExposure', 2.5, 0.0, 0.0, 0.0)
        h3d.setMaterialUniform(mat, 'hdrBrightThres', 0.5, 0.0, 0.0, 0.0)
        h3d.setMaterialUniform(mat, 'hdrBrightOffset', 0.08, 0.0, 0.0, 0.0)
예제 #3
0
    def setup_scene(self):
        h3dres = self._h3dres

        # Add environment
        self._env = h3d.addNodes(h3d.RootNode, h3dres.env)
        h3d.setNodeTransform(self._env, 0, 0, 0, 0, 0, 0, 0.23, 0.23, 0.23)
        # Add skybox
        self._sky = h3d.addNodes(h3d.RootNode, h3dres.skyBox)
        h3d.setNodeTransform(self._sky, 0, 0, 0, 0, 0, 0, 100, 50, 100)
        # Add light source
        self._light = h3d.addLightNode(h3d.RootNode, 'Light1', h3dres.lightMat,
                                       'LIGHTING', 'SHADOWMAP')
        h3d.setNodeTransform(self._light, 50, 40, -50, -60, 130, 0, 1, 1, 1)
        h3d.setNodeParamF(self._light, h3d.Light.RadiusF, 0, 250)
        h3d.setNodeParamF(self._light, h3d.Light.FovF, 0, 90)
        h3d.setNodeParamI(self._light, h3d.Light.ShadowMapCountI, 3)
        h3d.setNodeParamF(self._light, h3d.Light.ShadowSplitLambdaF, 0, 0.9)
        h3d.setNodeParamF(self._light, h3d.Light.ShadowMapBiasF, 0, 0.001)
        h3d.setNodeParamF(self._light, h3d.Light.ColorF3, 0, 0.9)
        h3d.setNodeParamF(self._light, h3d.Light.ColorF3, 1, 0.9)
        h3d.setNodeParamF(self._light, h3d.Light.ColorF3, 2, 0.9)
        # Init character positions
        self._crowdSim.init()
        self.add_camera("MainCamera", h3dres.deferredPipe)
        h3d.setNodeTransform(self.camera, 15, 3.3, -16, 0, 130, 0, 1, 1, 1)
예제 #4
0
    def setup_scene(self):
        h3dres = self._h3dres

        # Add environment
        #self._env = h3d.addNodes(h3d.RootNode, h3dres.env)
        #h3d.setNodeTransform(self._env, 0, 0, 0, 0, 0, 0, 0.08, 0.08, 0.08)
        # Add skybox
        self.change_skybox(h3dres.skyBox)
        # Add light source
        self._light = h3d.addLightNode(h3d.RootNode, 'Light1', h3dres.lightMat,
                                       'LIGHTING', 'SHADOWMAP')
        h3d.setNodeTransform(self._light, 15, 10, -5, -40, 120, 0, 1, 1, 1)
        h3d.setNodeParamF(self._light, h3d.Light.RadiusF, 0, 100)
        h3d.setNodeParamF(self._light, h3d.Light.FovF, 0, self.light_fov)
        h3d.setNodeParamI(self._light, h3d.Light.ShadowMapCountI, 1)
        h3d.setNodeParamF(self._light, h3d.Light.ShadowSplitLambdaF, 0, 0.9)
        h3d.setNodeParamF(self._light, h3d.Light.ShadowMapBiasF, 0, 0.001)
        h3d.setNodeParamF(self._light, h3d.Light.ColorF3, 0, 0.95)
        h3d.setNodeParamF(self._light, h3d.Light.ColorF3, 1, 0.95)
        h3d.setNodeParamF(self._light, h3d.Light.ColorF3, 2, 0.85)
        if self.create_cmap:
            # Light camera
            self._light_camera = h3d.addCameraNode(self._light, "light_camera",
                                                   h3dres.deferredPipe2)
            h3d.setNodeParamI(self._light_camera, h3d.Camera.OutTexResI,
                              h3dres.cmap)
            h3d.setNodeParamI(self._light_camera, h3d.Camera.ViewportXI, 0)
            h3d.setNodeParamI(self._light_camera, h3d.Camera.ViewportXI, 0)
            h3d.setNodeParamI(self._light_camera, h3d.Camera.ViewportWidthI,
                              self.cmap_size)
            h3d.setNodeParamI(self._light_camera, h3d.Camera.ViewportHeightI,
                              self.cmap_size)
            h3d.resizePipelineBuffers(h3dres.deferredPipe2, self.cmap_size,
                                      self.cmap_size)
            h3d.setupCameraView(self._light_camera, self.light_fov, 1.0, 0.1,
                                1000.0)
            # Update ligth shader uniforms
            self.update_cmap_res()

        # Create volume data
        self._vol = h3d.addNodes(h3d.RootNode, h3dres.volBox)
        self._sphdata = h3d.getNodeParamI(self._vol,
                                          20000)  # for VolumeResI = 20000

        self._room = h3d.addNodes(h3d.RootNode, h3dres.roomBox)
        h3d.setNodeTransform(self._room, 0, -0.01, 0, 0, 0, 0, 20, 20, 20)

        self._plane = h3d.addNodes(h3d.RootNode, h3dres.plane)
        h3d.setNodeTransform(self._plane, 0, 0, 0, 0, 0, 0, 0.2, 0.2, 0.2)

        # Add a camera
        self.add_camera("MainCamera", h3dres.deferredPipe)
        h3d.setNodeTransform(self.camera, -2.0, 1.2, -6.5, -13, -170, 0, 1, 1,
                             1)
        #h3d.setNodeTransform(self.camera, -0.8, 1.06, -1.08, -41, -154, -6.4, 1, 1, 1)
        #h3d.setNodeTransform(self.camera, -0.32, 0.23, -0.54, -19, -174, -0.01, 1, 1, 1)
        self.__mode = 0
예제 #5
0
    def setup_scene(self) :
        h3dres = self._h3dres

        # Add environment
        #self._env = h3d.addNodes(h3d.RootNode, h3dres.env)
        #h3d.setNodeTransform(self._env, 0, 0, 0, 0, 0, 0, 0.08, 0.08, 0.08)
        # Add skybox
        self.change_skybox(h3dres.skyBox)
        # Add light source
        self._light = h3d.addLightNode(h3d.RootNode, 'Light1', h3dres.lightMat, 'LIGHTING', 'SHADOWMAP')
        h3d.setNodeTransform(self._light, 15, 10, -5, -40, 120, 0, 1, 1, 1)
        h3d.setNodeParamF(self._light, h3d.Light.RadiusF, 0, 100)
        h3d.setNodeParamF(self._light, h3d.Light.FovF, 0, self.light_fov)
        h3d.setNodeParamI(self._light, h3d.Light.ShadowMapCountI, 1)
        h3d.setNodeParamF(self._light, h3d.Light.ShadowSplitLambdaF, 0, 0.9)
        h3d.setNodeParamF(self._light, h3d.Light.ShadowMapBiasF, 0, 0.001)
        h3d.setNodeParamF(self._light, h3d.Light.ColorF3, 0, 0.95)
        h3d.setNodeParamF(self._light, h3d.Light.ColorF3, 1, 0.95)
        h3d.setNodeParamF(self._light, h3d.Light.ColorF3, 2, 0.85)
        if self.create_cmap :
            # Light camera
            self._light_camera = h3d.addCameraNode(self._light, "light_camera", h3dres.deferredPipe2)
            h3d.setNodeParamI(self._light_camera, h3d.Camera.OutTexResI, h3dres.cmap)
            h3d.setNodeParamI(self._light_camera, h3d.Camera.ViewportXI, 0)
            h3d.setNodeParamI(self._light_camera, h3d.Camera.ViewportXI, 0)
            h3d.setNodeParamI(self._light_camera, h3d.Camera.ViewportWidthI, self.cmap_size)
            h3d.setNodeParamI(self._light_camera, h3d.Camera.ViewportHeightI, self.cmap_size)
            h3d.resizePipelineBuffers(h3dres.deferredPipe2, self.cmap_size, self.cmap_size )
            h3d.setupCameraView(self._light_camera, self.light_fov, 1.0, 0.1, 1000.0)
            # Update ligth shader uniforms
            self.update_cmap_res()

        # Create volume data
        self._vol = h3d.addNodes(h3d.RootNode, h3dres.volBox)
        self._sphdata = h3d.getNodeParamI(self._vol, 20000) # for VolumeResI = 20000

        self._room = h3d.addNodes(h3d.RootNode, h3dres.roomBox)
        h3d.setNodeTransform(self._room, 0, -0.01, 0, 0, 0, 0, 20, 20, 20)

        self._plane = h3d.addNodes(h3d.RootNode, h3dres.plane)
        h3d.setNodeTransform(self._plane, 0, 0, 0, 0, 0, 0, 0.2, 0.2, 0.2)

        # Add a camera
        self.add_camera("MainCamera", h3dres.deferredPipe)
        h3d.setNodeTransform(self.camera, -2.0, 1.2, -6.5, -13, -170, 0, 1, 1, 1)
        #h3d.setNodeTransform(self.camera, -0.8, 1.06, -1.08, -41, -154, -6.4, 1, 1, 1)
        #h3d.setNodeTransform(self.camera, -0.32, 0.23, -0.54, -19, -174, -0.01, 1, 1, 1)
        self.__mode = 0
예제 #6
0
    def setup_scene(self) :
        h3dres = self._h3dres

        # Add skybox
        self._sky = h3d.addNodes(h3d.RootNode, h3dres.skyBox)
        h3d.setNodeTransform(self._sky, 0, 0, 0, 0, 0, 0, 500, 500, 500)
        # Add light source
        self._light = h3d.addLightNode(h3d.RootNode, 'Light1', h3dres.lightMat, 'LIGHTING', 'SHADOWMAP')
        h3d.setNodeTransform(self._light, 0, 20, 50, -30, 0, 0, 1, 1, 1)
        h3d.setNodeParamF(self._light, h3d.Light.RadiusF, 0, 200)
        h3d.setNodeParamF(self._light, h3d.Light.FovF, 0, 90)
        h3d.setNodeParamI(self._light, h3d.Light.ShadowMapCountI, 3)
        h3d.setNodeParamF(self._light, h3d.Light.ShadowSplitLambdaF, 0, 0.9)
        h3d.setNodeParamF(self._light, h3d.Light.ShadowMapBiasF, 0, 0.001)
        h3d.setNodeParamF(self._light, h3d.Light.ColorF3, 0, 0.9)
        h3d.setNodeParamF(self._light, h3d.Light.ColorF3, 1, 0.7)
        h3d.setNodeParamF(self._light, h3d.Light.ColorF3, 2, 0.75)
        # Add domino scene
        self._domino = h3d.addNodes(h3d.RootNode, h3dres.dominoRes )
        # Add particle effects
        h3d.findNodes(self._domino, 'sphere', h3d.NodeTypes.Mesh)
        sphere = h3d.getNodeFindResult(0)
        self._particleSystem = h3d.addNodes(sphere, h3dres.particleSys)
        # Set particle parameter
        count = h3d.findNodes(self._particleSystem, '', h3d.NodeTypes.Emitter)
        for i in range(count):
            node = h3d.getNodeFindResult(i)
            h3d.setNodeParamF(node, h3d.Emitter.ForceF3, 1, 1.5)
            h3d.setNodeParamF(node, h3d.Emitter.EmissionRateF, 0, 200)
            h3d.setNodeParamF(node, h3d.Emitter.SpreadAngleF, 0, 45)

        # Customize post processing effects
        mat = h3d.findResource(h3d.ResTypes.Material, 'pipelines/postHDR.material.xml')
        # hdrParams: exposure, brightpass threshold, brightpass offset (see shader for description)
        h3d.setMaterialUniform(mat, 'hdrExposure', 2.5, 0.0, 0.0, 0.0)
        h3d.setMaterialUniform(mat, 'hdrBrightThres', 0.5, 0.0, 0.0, 0.0)
        h3d.setMaterialUniform(mat, 'hdrBrightOffset', 0.08, 0.0, 0.0, 0.0)

        self.add_camera("MainCamera", h3dres.hdrPipe)
        h3d.setNodeTransform(self.camera, -14.0, 40.0, 24.0, -50.0, -20, 1.3, 1, 1, 1)
예제 #7
0
    def setup_scene(self):
        h3dres = self._h3dres

        self._env = h3d.addNodes(h3d.RootNode, h3dres.env)
        #h3d.setNodeTransform(self._env, 0, 0, 0, 0, 0, 0, 0.23, 0.23, 0.23)
        h3d.setNodeTransform(self._env, 0, -20, 0, 0, 0, 0, 20, 20, 20)
        # Add skybox
        self._sky = h3d.addNodes(h3d.RootNode, h3dres.skyBox)
        h3d.setNodeTransform(self._sky, 0, 0, 0, 90, 0, 0, 50, 50, 50)

        self._knight = h3d.addNodes(h3d.RootNode, h3dres.knight)
        h3d.setNodeTransform(self._knight, 0, 0, 0, 0, 180, 0, 0.1, 0.1, 0.1)
        h3d.setupModelAnimStage(self._knight, 0, h3dres.knightAnim1, 0, '',
                                False)
        h3d.setupModelAnimStage(self._knight, 1, h3dres.knightAnim2, 0, '',
                                False)

        self._light = h3d.addLightNode(h3d.RootNode, 'Light1', h3dres.lightMat,
                                       'LIGHTING', 'SHADOWMAP')
        h3d.setNodeTransform(self._light, 0, 15, 10, -60, 0, 0, 1, 1, 1)
        h3d.setNodeParamF(self._light, h3d.Light.RadiusF, 0, 30)
        h3d.setNodeParamF(self._light, h3d.Light.FovF, 0, 90)
        h3d.setNodeParamI(self._light, h3d.Light.ShadowMapCountI, 1)
        h3d.setNodeParamF(self._light, h3d.Light.ShadowMapBiasF, 0, 0.01)
        h3d.setNodeParamF(self._light, h3d.Light.ColorF3, 0, 1.0)
        h3d.setNodeParamF(self._light, h3d.Light.ColorF3, 1, 0.8)
        h3d.setNodeParamF(self._light, h3d.Light.ColorF3, 2, 0.7)

        # Customize post processing effects
        mat = h3d.findResource(h3d.ResTypes.Material,
                               'pipelines/postHDR.material.xml')
        # hdrParams: exposure, brightpass threshold, brightpass offset (see shader for description)
        h3d.setMaterialUniform(mat, 'hdrExposure', 2.5, 0.0, 0.0, 0.0)
        h3d.setMaterialUniform(mat, 'hdrBrightThres', 0.5, 0.0, 0.0, 0.0)
        h3d.setMaterialUniform(mat, 'hdrBrightOffset', 0.08, 0.0, 0.0, 0.0)

        # Attach particle system to hand joint
        self.set_particlesys(h3dres.particleSys2)
        self.add_camera("MainCamera", self.__rmode_dict[3][1])
        h3d.setNodeTransform(self.camera, -25, 14, 9, -30, -60, 5, 1, 1, 1)
예제 #8
0
    def setup_scene(self) :
        h3dres = self._h3dres

        # Add environment
        self._env = h3d.addNodes(h3d.RootNode, h3dres.env)
        h3d.setNodeTransform(self._env, 0, 0, 0, 0, 0, 0, 0.23, 0.23, 0.23)
        # Add skybox
        self._sky = h3d.addNodes(h3d.RootNode, h3dres.skyBox)
        h3d.setNodeTransform(self._sky, 0, 0, 0, 0, 0, 0, 100, 50, 100)
        # Add light source
        self._light = h3d.addLightNode(h3d.RootNode, 'Light1', h3dres.lightMat, 'LIGHTING', 'SHADOWMAP')
        h3d.setNodeTransform(self._light, 50, 40, -50, -60, 130, 0, 1, 1, 1)
        h3d.setNodeParamF(self._light, h3d.Light.RadiusF, 0, 250)
        h3d.setNodeParamF(self._light, h3d.Light.FovF, 0, 90)
        h3d.setNodeParamI(self._light, h3d.Light.ShadowMapCountI, 3)
        h3d.setNodeParamF(self._light, h3d.Light.ShadowSplitLambdaF, 0, 0.9)
        h3d.setNodeParamF(self._light, h3d.Light.ShadowMapBiasF, 0, 0.001)
        h3d.setNodeParamF(self._light, h3d.Light.ColorF3, 0, 0.9)
        h3d.setNodeParamF(self._light, h3d.Light.ColorF3, 1, 0.9)
        h3d.setNodeParamF(self._light, h3d.Light.ColorF3, 2, 0.9)
        # Init character positions
        self._crowdSim.init()
        self.add_camera("MainCamera", h3dres.deferredPipe)
        h3d.setNodeTransform(self.camera, 15, 3.3, -16, 0, 130, 0, 1, 1, 1)