Turn ON/OFF shadows and shaders in runtime?


(linuxfree) #1

In BGE i have doubt we can turn on/off shadows and shaders only main scene? or need made to all scenes of game?
in main scene i have baked shadows and AO in render mode.

i wish make this in settings for weak machine or weak pc

thanks


(BluePrintRandom) #2

check out in the rasterizer setting in api
edit:
bge.render.setGLSLMaterialSetting(setting, enable)¶
Enables or disables a GLSL material setting.

Parameters:
setting (string (lights, shaders, shadows, ramps, nodes, extra_textures)) –
enable (boolean) –

example

bge.render.setting(“shadows”,False)

https://docs.blender.org/api/blender_python_api_2_77_1/bge.render.html#bge.render.setGLSLMaterialSetting


(linuxfree) #3

ok but i wish made a diferent style for set in game.Will available in pause scene then in this scene will have a check box to enable/disable. the settings will change to all scenes then how main scene is suspended with Pause scene active will put a cube in plane t show real example of settings.


(Daedalus_MDW) #4

in my experience, GLSL settings are a bit wonky, and can only be set at init. i havent been able to get a dynamic switch to work.

i have successfully created a robust system to set graphic parameters. it IS possible and i will share when i release the rest of my code. (hopefully soon)

tip: when opening a new blend, you need to reset all the options you change to TRUE when the new blend starts, then disable the ones you want.


(edderkop) #5

i needed something like this to, here is a blend that shows how i solved the problem.

(change the object color on ground plane to adjust the shadows)

http://15b.dk/blendfiles/shadow-test.blend