Toggle Material Nodes At Run-Time

Hi,
Asking for a friend.
I suspect there is no way currently to disable material nodes in legacy BGE/UPBGE. Am I wrong. Thanks.

Current Solutions

  • Switch material at run-time with duplicate material that has material nodes deactivated (performance costly obviously)
  • Replicate the raw GLSL for the material shader and alternately toggle it on/off at run-time with KX_BlenderMaterial.shader OR KX_BlenderMaterial.getShader().setSource()

You could use setGLSLMaterialSetting to disable nodes for all the materials:

bge.render.setGLSLMaterialSetting('nodes', False)

This will disable the Nodes setting on the shading section and it will remain disabled even after the game stopped.

1 Like

True, I had forgotten about that function. Thanks for the information. :smiley: