Shader that "erases" part of a texture to show another texture based on a decal

Hey Everyone,

I have an interesting project that I’ve been working on and have scoured the forums to see if I can find an answer. The basic concept is this:

  1. Have an object with two textures associated with it where:
  2. The object is “hit” with multiple decals, and the the decal fades after a few, and then:
  3. A 2nd texture shows through in only the areas where the decal was visible.

Think of a dirty wall that gets hit with multiple “spurts” of water from a water gun and shows a cooler texture underneath. Is this possible with just shaders or do I need to think in terms of setPixels, etc.?

I’ve checked out the blended texture shaders, etc. and still haven’t been able to come up with a solid solution. Any help would be greatly appreciated!

Simplest method would be to use a render texture as a mask.

Setup a 2nd camera and set it’s render target as usual as if you were making a remote TV texture.

Set that camera’s background to black and set it to only render a special layer. Create a particle system on that layer that spawns some white “spray” particles when you “shoot”, the camera will then render these particles into your mask and in your game it will start to unmask your second texture.

Thanks for the suggestion, Cameron! It’s a little more complex than that, though, I guess. Here’s a bit broader scope of the project:

  1. There are 5 cameras rendered out to projectors.
  2. There are multiple water guns firing at the same time, so decals seem more intuitive to me than particles. I’ve had discussion around this, but from an implementation, and I don’t want to ninja the thread with that discussion, but I’d be interested in hearing your perspective on why particles vs water (knowing that you were unaware of multiple guns firing simultaneously).
  3. The “splats” have to be a specific color and look and feel, and also need to animate upon hitting the wall.

Does this change your perspective at all? Anyone else have any ideas (now that I’ve told you about the additional cameras and the need for specific styles of “splats”)?

Thanks again!

Particles or decal quads or prefabs you instantiate yourself, doesn’t matter really, you could set it up any way you want. The key part is that you use the rendertexture as input to the texture blend/mask so it animates based on whatever your other camera sees/renders.

You want something like this
http://www.exitstrategyentertainment.com/ponh/?p=370

Yes! This looks to be very close (if not exactly what I’m talking about)! Thanks so much!