Best way to implement stencilled texture

I’m writing a simple game where you fling balls of colour against a wall, in order to fill in a stencil of a cartoon character. Now, I’ve looked high and low and I just can’t find a good way of scripting this.

I have a plane with two materials - the back material is where the paint ball will hit, where I am trying to blit a “splat” texture, and the front material holds the cartoon stencil image, with alpha where I want the paint splats to show through.

So, what’s the best way to do this? I’ve tried to just SetPixels into the back material, with no success. I’ve also seen mention of Layers…

Thanks!

M

Been working some more :

public class Splat : MonoBehaviour 
{
	public Texture2D	SplatTexture;
	
	Texture2D			tex;
	Color[]				pix;
	
	
	void Start () 
	{
    	pix = SplatTexture.GetPixels( 0 );
		tex = new Texture2D( 256, 256, TextureFormat.ARGB32, false );
		renderer.material.mainTexture = tex;
	}
	
	void OnCollisionEnter( Collision c )
    {
		tex.SetPixels( 100, 100, 128, 128, pix, 0 );
						   
		tex.Apply( false );
    }    

}

This at least compiles, but no splat texture appears on the surface…

:cry: