I have a scene with switchable characters, each with a Camera3D child. I want characters to have unique vision effects with spatial shader (like L4D2 infected vision). Can’t figure out a good way to apply camera specific spatial shader.
That’s not the issue. My use case is that I have different characters, one of them has a thermal vision. It’s hard to make it look good with just postprocessing shader, so I thought about adding a “thermal glow” spatial shader, but I don’t want it applied all the time, only when looking through that character’s camera.
I’m not sure i understand what you mean.
You mention different characters and different cameras - should each character have a specific camera? Should each stage be played with different characters?
I’m not sure if its the best solution but i would probably set up a singleton with an int variable with each int representing a different camera state, then on the camera’s ready function, i would update the camera’s state to match the singleton script.
It only needs one camera script and will be easy to update too. Like, if you press some change character button and tie a signal to it. Then you could tie that signal to update to singleton and call and update camera function in your camera script.
If you only need one scene, the singleton is not needed but its not a lot of extra work and could make sense to add if you want to add more scenes later. If you don’t need it you could just add all of the stuff above in the camera script.