In our 3D game, I want to add the option to change the quality of the graphics. As an example, let this setting only affect the shadows:
- HIGH: shadows with blur.
- MEDIUM: shadows without blur.
- LOW: no shadows.
As a coder, the easiest hypothetical way is to define #define NO_SHADOWS
(for “LOW”) somewhere at the very start of the game. And this definition would affect the code of all fragment shaders of 3D models.
But in Defold engine I think this is not possible and I need to make 3 sets of all game materials with 3 different shaders. From Lua code, I will need to track the names of all the model components and their game object IDs to be able to switch their materials. I see this as a huge piece of code and quite a lot of manual work.
Maybe I’m missing some easy way to do this? What’s the best way to implement this?