Render the scene only using a given a renderType tag

Hi, is there a way I can tell the a Camera to render the whole scene, and only render objects with a specific RenderType

With Out replacing their current shader…

Basicly, I want to write an additional pass on multiple Shaders tagged renderType=“AwesomePass”
MainCamera will do its its normal stuff.
Then I tell a 2nd camera to render the scene only using the AwesomePass, and then each object that has an AwesomePass will use its Own shader code, and not a replacement One.

another way to put this is…

I want to have Multiple Shaders that are on a Select few objects to have a Special pass tagged with renderType=“AwesomePass”
When I call a render to the scene, only the objects, that use a Shader that is tagged with “AwesomePass” will then render That specific Pass.

I am rending this AwesomePass to a render Texture. and Again, I DO NOT want to replace their current shader

I think you are after culling mask:

EDIT: Considering your comment, so you want to modify the rendering of an object based on what camera is rendering. You can use one of the callback from MonoBehaviour for instance:

Consider this script below:

public class ModifyRendering: MonoBehaviour {
	public Renderer render;
	void OnPreRender()
	{
		render.material.color = Color.white;
		if(tag == "MainCamera"){
			render.material.color = Color.red;
		}
	}
}

You attach that to all cameras and add as many checks you need. There is a reference to the object meant to be controlled.

Here below is a more advanced version that discard the check from the callback and only makes it happen once:

public class ModifyRendering: MonoBehaviour 
{
     delegate void EventHandler ();
     event EventHandler OnRenderProcess; 
     public Renderer render;
     // The event is set in the Start once
     void Start()
     {
         if(tag == "MainCamera")
         {
             OnRenderProcess = SetForMain;
             return;
         }
         // Can be as many if you need here based on tag or culling mask or else
         OnRenderProcess = SetForCamera;
     }
    // The callback
    // Using OnPreCull you are even earlier in the process
    void OnPreRender()
    {
        OnRenderProcess ();
    }
    // The methods
    void SetForMain()
    {
        // Here changing color but you can also change the shader
        render.material.color = Color.blue;
    }
    void SetForCamera()
    {
        render.material.color = Color.white;
    }
}

I hade Posted my question here as well : http://forum.unity3d.com/threads/render-the-scene-only-using-a-given-a-rendertype-tag.254976/

After everyones Post, I was able to get the effects I wanted via Making Multiple Cameras to Control when things were Renderered. I also found out that when using a Replacement Shader, its being executed as if its running in that file : IE: that you have access to all the same properties and variables

And so I just had to do write a replacement shader for every rendertype I had that would Output this information.
But instead of of using RenderType = AwesomePass. I used AwesomePass = Terrain, and AwesomePass = Fun, etc etc. Since I didn’t want to completely overwrite the RenderTypes. Thusly because only 3 Different Shaders use my AwesomePass tag I only had to write 3 shaders.

I also did use some Camera Masking for some of the Render Passes. Thanks for the help :slight_smile: