General question about shading in unity

A large gameplay feature of my game is the ability to see through walls. imagine an RTS but where you can toggle through different levels of buildings.

So I’ve got how to do it all worked out and I’ve created the feature using a fragment shader’s discard feature (input height H. if world position of frag is > inputHeight, discard = simple!). I’m still creating a prototype so my focus is not on art at the moment. Now when I made this shader I just wrote a basic diffuse and specular lighting into it. I’m not intimidated by shader writing, though I’m not an expert. My question is this:

if your implementing a gameplay feature geared around a fragment shader effect, is it a good idea to modify unity’s built in shaders or start from scratch with your own lighting models?

There is just something that bugs me about wanting to implement just a single feature, which is in total 4 lines of code, but then having to disregard ALL of unity’s built in shaders. Now are Unity’s shaders actually doing something cool that would make me want to keep them? If I switch to my own shader for every surface in my game am i playing with fire? Is there a reason not to do that - aka some kind of incredible optimization for different platforms that unity handles behind the scenes?

What are your thoughts? I’m just looking for advice, because my re-invent the wheel senses are going off when im writing my own custom cg shader for every surface of the game.

thanks for any advice!

Matt

There’s nothing special about Unity’s built-in shaders - feel free to use your own instead :wink:

The only thing of note is that they are mostly written using Unity’s own “surface shader” template, so you won’t be able to modify them by adding your own custom fragment function - you’d have to write the complete vert/frag shader from scratch, but it’s not so hard.

ok cool! I’ll just write my own vert/frag shader. just wanted to check!

thanks guys!