I’m trying unsuccessfully so far to use the replacementTag option when using a replacement shader. Unfortunately the help doesn’t give any examples. It says
However a tag is made up of a key and a value, I’ve tried supplying just the key and just the value and both but nothing seems to work.
Therefore it looks like you supply the key not the value as it says in the help.
But if I change it to my own tag key “VisibleInDepth” it doesn’t work so it only seems to work with RenderType and not with your own tags. Is this a bug? or just a very annoying limitation?
Is there any solution to this? I have the same problem…
And another question: If I render from a cam with replacement shader, are there the shadows of ALL objects included? I ask, because when I use a culling mask it is not.
Unity will check for all existing shaders in the scene, if they have a RenderType-Tag with either funky or Opaque and replace this very subshader with the one from the replacement shader.
All shaders that DONT have a RenderType-tag set to funky or Opaque will be ignored.
I see, so you are saying you it just matches the tags in the replacement shader with the tag in the existing shader and swaps the ones that match… that makes a lot of sense. If only the help had explained it that way… :roll:
Oh my God DerWoDaSo you’re a life saver! I know it’s been like 5 years since this was posted. But still I have to say in about 5 hours of searching for how freaking replacement shaders work this was the only thing that explains it.
I’m having the same issue with Unity always using the first SubShader regardless of what the tags are in it.
This is rather annoying as I wanna create a generic shader that has multiple SubShaders that responds to different Replacement Shaders. Basically this “bug” renders my idea useless.
Any Unity guys around to verify whether this is actually a bug or a wanted behaviour?
scene use shader with tag “rendertype=opaque”,the tank body material shader with tag"rendertype=tank",close replacement shader in camera.
setreplacementshader in camera,use a shader has two subshader:
subshader0 set tag “rendertype= tank” not use diffuse texture but only purecolor red.
subshader1 set tag"rendertype=opaque" same as standard shader.
get this picture
if remove subshader1, or set “RenderType” = “somethingelse” all scene like picture ,and no change
if change tank body shader set tag “rendertype1 = tank” set replacement shader subshader0 set tag “rendertype1=tank”,set camera replacementshader “rendertype1” ,only tank is render no else render.
hey guys i need that script which attach to camera and shader please
i am new in unity and need same output you did above, i need whole scene color with a simple shader with my camera.
which i can’t do because of nothing detail about replacement shader use.
i am not a programmer so i just need simple script which i drag to my 2nd camera and render the scene as another color and my 1st camera as original,but i cant’t do this
please guys anyone have the solution please help me please