- Home /
Best Way To Add 2 Shaders to and Object? 2020
So im trying to create a shader that outlines certain items that are pick-up-able and what not. Now I got everything to work in terms of the shader and the material to go with it. Works perfectly when its just a random sphere or something with no materials. But the moment I add it to an item that already has a mesh/shader, it completely overwrites the items mesh, and ya, is highlighted with the outline I desired, but now its a naked object with no color lol. How do I get this shader to work with my already existing Material/shaders?
Any Help Is greatly appreciated.
Answer by Captain_Pineapple · Aug 18, 2020 at 07:47 AM
One mesh can only have one shader afaik. If you want to combine multiple shaders into one you can do that by creating a new shader that combines the functionalities of both shaders. An outline can then be "activated" by setting it's intensity value in the materials property block. This way the shader can then be manipulated to change it's appearance. Basically just like you would set a new color.
Not really. You can squeeze 2 materials on a single mesh and make it draw twice. The problem would be which comes first. Usually, outline can be implemented on the shader with extra pass, pass 0 with cull front, pass 1 with normal shader. However exceptions arise when you can only use a single pass. URP does not support multi passes and I had to put 2 materials on a single mesh.
I suppose the main problem is meshes that have multiple sub meshes won't work right off the bat..