Custom shaders and shadows

Since I’m quite new to this shader business I’m bumping into problems here and there, and this time I’m really struggling with solving it.

I’ve made this shader that I’ve gotten to cast shadows with a custom ShadowCaster pass but I’m still not able to get it to collect shadows in any way. I’ve tried getting the fallback to handle the ShadowCollector pass, I’ve tried diffent ways to write the shadowcollector pass, and I’ve tried setting the Queue to geometry and RenderType to Opaque instead of Transparent..

Shader coding in Unity is hard, because there isn’t much info to be found anywhere about how things work and how it should be done. Does anyone out there have any tips on how I can get this to work?

See the code below or download the shader here.

6 thoughts on “Custom shaders and shadows”

  1. Your water shaders look pretty awesome! I’m trying to test them out myself but not having much luck.

    Could you give a brief overview of how to make use of the shaders?

    I tried using it on a plane which gives me some sort of flat wavey effect with two colours which doesn’t look anywhere near like what you have in your video, I’m guessing i’m missing some important steps.

    Any help would be appreciated!

    1. Hi, luke! The shader is kind of lacking in features and I guess it’s kind of depending on several thing’s to be “correct”.. the wave generator is a mess and you have to tweak the numbers on your material to get the right look. And I think the plane you use for the water needs to be rotated in the right way in it’s original form to wave on the right axis! I should try to create a unitypackage with a ready built scene or something for you.

  2. A sample scene would be amazing! I wanted to try out your transparent shader with the ripples, but couldn’t see the shader code for that one, would be cool if you had your shaders on github with a sample project setup to use them 😀

Leave a Reply

Your email address will not be published. Required fields are marked *