How do I tint the walls and floor procedurally?


I’ve been doing some experiments with Unity3D and came across this problem.

Consider a white wall and floor with a sphere on it. The camera is positioned so that the game is bi-dimensional and you control the sphere left and right by pushing buttons on the bottom of the screen.

Now, when that sphere comes in contact with a colored cube, I want the entire environment to be tinted with the cube’s color, like a circle growing outwards from the cube’s position until it fills the wall and floor. The sphere must remain white.

I have a few ideas on how to do this:

  • Make both the wall and the floor a single 3D object and animate the texture. Since I want it to look like a circle growing in size, it reached a point where the game slowed down to a crawl because of the calculations and calling texture.apply() in Update.
  • Use Vectrosity to create a circle with transparency that takes up the entire screen. The circle would be centered at the sphere and have a hole in the middle to exclude it. Haven’t tried this yet, don’t know how it would look.

Any ideas on how to approach this situation?


PS: I’ll try to add some images when I get home.

Turns out I didn’t manage to do it with lights, but I got really close to what I want using projectors:

The problem is where they overlap, one should be overriding the other, not blending. I’ll be asking a different question for that matter.

Thanks anyway. =)