Skip to content

Instantly share code, notes, and snippets.

@rdb
Forked from anonymous/main.py
Last active August 29, 2015 14:02
Show Gist options
  • Save rdb/6b98e2d6cb67da4da678 to your computer and use it in GitHub Desktop.
Save rdb/6b98e2d6cb67da4da678 to your computer and use it in GitHub Desktop.
# Simple render to texture
node = loader.loadModel("panda")
depthtex = Texture('depth')
depthtex.set_clear(1.0)
colortex = Texture('color')
colortex.set_clear((0, 0, 0, 1))
normaltex = Texture('normal')
normaltex.set_clear((0.5, 0.5, 0.5))
node.add_render_target(depthtex)
node.add_render_target(colortex)
node.add_render_target(normaltex)
node.set_shader_input(mainTarget, "test", 1.0)
# Postprocessing
post_card = base.aspect2d.attach_new_node(myCardGeometry)
post_card.set_shader_input("colortex", colortex)
post_card.set_shader_input("normaltex", normaltex)
post_card.set_shader_input("depthttex", depthtex)
# Exclude some node from the normal buffer
# This target collection can be used multiple times
noNormalsTarget = TargetCollection(mainTarget)
noNormalsTarget.removeTarget(normaltarget)
noNormalsNode.set_render_target(noNormalsTarget)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment