Skip to content

Instantly share code, notes, and snippets.

@DCubix
Created February 16, 2017 17:13
Show Gist options
  • Save DCubix/55ba3a3284f8dea0893a31617f18381c to your computer and use it in GitHub Desktop.
Save DCubix/55ba3a3284f8dea0893a31617f18381c to your computer and use it in GitHub Desktop.
from bge import types, render, logic
class CustomTechnique(types.KX_RenderTechnique):
def __init__(self):
super(CustomTechnique, self).__init__()
self.normals_shader = types.BL_Shader(...)
def apply(self):
# render all the meshes with a specific shader
# If the shader override (param 2) is null, use the material
# We can have a function to render a single mesh and bind the textures to a shader
# self.renderSingleGeometry(index, shader)
# and self.getGeometryCount(scene)
# so, for i in range(self.getGeometryCount(scene))
# To bind textures:
# self.bindTextures(mesh, shader)
self.renderGeometries(logic.getCurrentScene(), self.normals_shader)
self.postProcess()
def main(cont):
render.renderTechnique = CustomTechnique() # if renderTechnique is null, render normally, else, use the technique
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment