How to use the panda3d.core.Shader function in Panda3D

To help you get started, we’ve selected a few Panda3D examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tobspr / RenderPipeline / Code / GUI / ExposureWidget.py View on Github external
def _late_init(self, task):
        """ Gets called after the pipeline initialized, this extracts the
        exposure texture from the stage manager """

        stage_mgr = self._pipeline.stage_mgr

        if not stage_mgr.has_pipe("Exposure"):
            self.debug("Disabling exposure widget, could not find the exposure data.")
            self._node.remove_node()
            return

        self._node.show()

        exposure_tex = stage_mgr.get_pipe("Exposure")
        self._cshader = Shader.load_compute(Shader.SL_GLSL, "Shader/GUI/VisualizeExposure.compute.glsl")
        self._cshader_np.set_shader(self._cshader)
        self._cshader_np.set_shader_input("DestTex", self._storage_tex)
        self._cshader_np.set_shader_input("ExposureTex", exposure_tex)
github tobspr / RenderPipeline / Data / default_cubemap / filter.py View on Github external
from panda3d.core import PNMImage, load_prc_file_data, Texture, NodePath
from panda3d.core import Shader, ShaderAttrib

import shutil
import os

load_prc_file_data("", "textures-power-2 none")
# load_prc_file_data("", "window-type offscreen")
load_prc_file_data("", "win-size 100 100")
load_prc_file_data("", "notify-level-display error")

import direct.directbase.DirectStart


compute_shader = Shader.make_compute(Shader.SL_GLSL, """
#version 430

layout (local_size_x = 16, local_size_y = 16) in;
uniform writeonly image2D DestTex;
uniform samplerCube SourceCubemap;
uniform int size;
uniform int blurSize;
uniform int effectiveSize;
uniform int faceIndex;


vec3 transform_cubemap_coordinates(vec3 coord) {
    return normalize(coord.xzy * vec3(1,-1,1));
}

vec3 get_transformed_coord(vec2 coord) {
github StephenLujan / Panda-3d-Procedural-Terrain-Engine / src / terraintexturer.py View on Github external
self.textureMapper.addTexture(self.tex4)
        self.textureMapper.addRegionToTex(Vec4(self.indexToHeight(0.72), 9999.0, -0.001, 1.001))

        logging.info( "intializing terrain shader generator...")
        file = 'shaders/terrain.sha'
        if SAVED_TEXTURE_MAPS:
            self.shaderGenerator = BakedTerrainShaderGenerator(self.terrain, self, self.textureMapper)
            file = 'shaders/bakedTerrain.sha'
        else:
            self.shaderGenerator = FullTerrainShaderGenerator(self.terrain, self,  self.textureMapper)
            file = 'shaders/fullTerrain.sha'
        logging.info( "terrain shader generator initialized...")

        if RUNTYPE == 'python':
            self.shaderGenerator.saveShader(file)
            self.shader = Shader.load(file, Shader.SLCg)
        else:
            self.shader = Shader.make(self.shaderGenerator.createShader(), Shader.SLCg);

        self.terrain.setShaderInput("normalMap", self.normalMap)
        self.terrain.setShaderInput("displacementMap", self.displacementMap)
        self.terrain.setShaderInput("detailTex", self.detailTex)
        self.terrain.setShaderInput('tscale', self.texScale)
        self.terrain.setShaderInput("fogColor", Vec4(1.0, 1.0, 1.0, 1.0))
        self.terrain.setShaderInput("camPos", base.camera.getPos())
github tobspr / RenderPipeline / Code / RenderPasses / GlobalIlluminationPass.py View on Github external
def setShaders(self):
        shader = Shader.load(Shader.SLGLSL, 
            "Shader/DefaultPostProcess.vertex",
            "Shader/ComputeGI.fragment")
        self.target.setShader(shader)
        
        return [shader]
github tobspr / RenderPipeline / Code / RenderPasses / FinalPostprocessPass.py View on Github external
def setShaders(self):
        shader = Shader.load(Shader.SLGLSL, 
            "Shader/DefaultPostProcess.vertex",
            "Shader/FinalPostprocessPass.fragment")
        self.target.setShader(shader)

        return [shader]
github tobspr / RenderPipeline / Code / RenderPasses / TransparencyShadePass.py View on Github external
def setShaders(self):
        shader = Shader.load(Shader.SLGLSL, 
            "Shader/TransparencyShade/vertex.glsl",
            "Shader/TransparencyShade/fragment.glsl",
            "Shader/TransparencyShade/geometry.glsl",
            )
        self.target.setShader(shader)

        return [shader]
github tobspr / RenderPipeline / Code / RenderPasses / CloudRenderPass.py View on Github external
def setShaders(self):
        shader = Shader.load(Shader.SLGLSL, 
            "Shader/DefaultPostProcess.vertex",
            "Shader/RenderClouds.fragment")
        self.target.setShader(shader)

        shaderV = Shader.load(Shader.SLGLSL, 
            "Shader/DefaultPostProcess.vertex",
            "Shader/CloudBlurV.fragment")
        self.targetV.setShader(shaderV)

        shaderH = Shader.load(Shader.SLGLSL, 
            "Shader/DefaultPostProcess.vertex",
            "Shader/CloudBlurH.fragment")
        self.targetH.setShader(shaderH)

        return [shader]
github tobspr / RenderPipeline / Code / RenderPasses / AntialiasingSMAAPass.py View on Github external
"Shader/Antialiasing/SMAA/EdgeDetection.fragment")
        self._edgesBuffer.setShader(edgeShader)

        weightsShader = Shader.load(Shader.SLGLSL, 
            "Shader/Antialiasing/SMAA/BlendingWeights.vertex", 
            "Shader/Antialiasing/SMAA/BlendingWeights.fragment")
        self._blendBuffer.setShader(weightsShader)

        neighborShader = Shader.load(Shader.SLGLSL, 
            "Shader/Antialiasing/SMAA/Neighbors.vertex", 
            "Shader/Antialiasing/SMAA/Neighbors.fragment")

        for buff in self._neighborBuffers:
            buff.setShader(neighborShader)

        resolveShader = Shader.load(Shader.SLGLSL, 
            "Shader/Antialiasing/SMAA/Resolve.vertex", 
            "Shader/Antialiasing/SMAA/Resolve.fragment")
        self._resolveBuffer.setShader(resolveShader)

        return [edgeShader, weightsShader, neighborShader, resolveShader]
github tobspr / RenderPipeline / Code / RenderPasses / SceneFinishPass.py View on Github external
def setShaders(self):
        shader = Shader.load(Shader.SLGLSL, 
            "Shader/DefaultPostProcess.vertex",
            "Shader/SceneFinishPass.fragment")
        self.target.setShader(shader)

        return [shader]