Is there a way to render objects and update GI based on which camera I use? I’m not really sure if I want to do this since Its just for a possible game-mode that I could scrap, but if there’s an easy way, it would be great.
What I want to do is change these values when a new camera renders.
Is it possible to do it with the cameras OnPreRender/OnPostRender or something?
The intended use is for me to render some stuff differently when doing local multiplayer/couch multiplayer for each player.
For example: Player 1, 2, 3 and 4 each have a flag that’s green. However, when viewing in Player 1s camera, I want Player 1s flag to be green and the other players as red. When viewed in player 2s camera, Player 2s should be green and the others red and so on. I cannot just use four different colors for each player. Its a bit difficult to explain why, but the colors are limited, and there could be a lot more players (bots or even networked players), and I want the players to be able to choose colors themselves, meaning that they could potentially choose the same color.
Or another example: You have Player 1 and 2, splitscreen for an rts. The players want their units to be colored in green for their units on their screen and the other players in red.
As I said, if it’s “too difficult” to create this behaviour, I’ll probably scrap the idea instead. I’ve seen the camera.RenderWithShader(…) too, but I think that’s where “too difficult” or too much of a hassle to be worth it comes in.
Hm, yes, maybe that could be a possible solution. I think it could be quite a few objects though, and if there’s four local players possible then there would be four objects I assume.
I think I’ll try and swap the values on preRender and postRender (hook to the camera with a list or something) and call the appropriate functions and see if that works first, otherwise, multiple objects could be a solution. I’ll look into it and see if any of them work! Thanks.
So it seems that I could get it to work to some extent, but the DynamicGI does not seem to update the values immediately, so I’m guessing it’s once per frame only then right? In that case I think I’m stuck.
DynamicGI.SetEmissive(renderer, col); // Does not work with camera prerender/postrender
Otherwise, it seems to work though. Materials seems to be updated. What i did was create an interface