Multi Shader
Posted: Fri Jun 22, 2018 7:13 pm
Hello. I have a question about the switch between shaders at runtime.
In my game, I have some enemies with only one material. Sometimes I need to change the shader of the material to highlight or to disintegrate the enemy for example. The idea is to make one shader that contains all the possible effects in the game and defines the output with a switch. In terms of optimization, do you think that is a good idea?
Is it better to have that huge shader with all possibilities, is it better to keep all the effects separated like one per material and change the whole material when needed, or it does not make so much difference? One of the main concerns I have about putting everything in the same shader and just switching between them, is that I don't know if the inactive shaders will be still doing calculus, thus being very expensive to put all of them together
In my game, I have some enemies with only one material. Sometimes I need to change the shader of the material to highlight or to disintegrate the enemy for example. The idea is to make one shader that contains all the possible effects in the game and defines the output with a switch. In terms of optimization, do you think that is a good idea?
Is it better to have that huge shader with all possibilities, is it better to keep all the effects separated like one per material and change the whole material when needed, or it does not make so much difference? One of the main concerns I have about putting everything in the same shader and just switching between them, is that I don't know if the inactive shaders will be still doing calculus, thus being very expensive to put all of them together