So, setMaterialMode and setGLSLSetting are both depreciated, and no longer used. What should I use to change game quality in Python?
One idea is to disable the main draw loop, use render to texture on a small buffer, and then use a 2d filter to fill the screen buffer with it / upscale it, (without Fsr or dlss for now)
I think you can use bpy.
I could be wrong…
This can all be dynamically enabled or disabled using Python. A combination of BGE & BPY.
BGE only has working API for “Lights” & “Shadows” I think, and the rest would need to be done with BPY.
Are you sure you want to go about making a game quality manager such as this?
Well yes, it would lead to better performance.
Sorry for the long silence. I’ve been working bit by bit on script daily and so far 5 / 7 of the GLSL settings I’ve been able to reproducible so far for UPBGE 0.3+.
Preview:
import bge, bpy
GLSL_LIGHTS = True
GLSL_SHADERS = True
GLSL_SHADOWS = True
GLSL_ENV_LIGHT = True
GLSL_RAMPS = True
GLSL_NODES = True
GLSL_EXTRA_TEX = True
def main(self):
if self.sensors["Always"].status == 1:
# LIGHTS
if GLSL_LIGHTS == False:
# LIGHT METHOD
for lights in bpy.data.lights:
lights.energy = 0.0
# SHADERS
if GLSL_SHADERS == False:
# MATERIAL METHOD
for mat in bpy.data.materials:
if not mat.use_nodes:
mat.specular_intensity = 0.0
continue
for node in mat.node_tree.nodes:
if node.type == "BSDF_PRINCIPLED":
node.inputs["Specular"].default_value = 0.0
# LIGHT METHOD
for lights in bpy.data.lights:
lights.specular_factor = 0.0
# SHADOWS
if GLSL_SHADOWS == False:
# LIGHT METHOD
for mat in bpy.data.materials:
mat.shadow_method = "NONE"
# MATERIAL METHOD
for lights in bpy.data.lights:
lights.use_shadow = False
# ENVIRONMENT LIGHTING
if GLSL_ENV_LIGHT == False:
# WORLD METHOD
bpy.context.scene.world.node_tree.nodes["Background"].inputs[1].default_value = 0.0
# RAMPS
if GLSL_RAMPS == False:
pass
# NODES
if GLSL_NODES == False:
# MATERIAL METHOD
for mat in bpy.data.materials:
mat.use_nodes = False
# EXTRA TEXTURES
if GLSL_EXTRA_TEX == False:
pass
GLSL_RAMPS
& GLSL_EXTRA_TEX
are a wip and a bit of a hassle to setup because disabling ramps without breaking the node setup is a bit tedious. Removing all of the extra texture slots for PBR minus the diffuse (albedo) slot is going to take a while, although logically I should be able to disable all of the inputs at once, allowing only diffuse and alpha (transparency) slots to still work.