Search Unity

Self Shadow Casting & Receiving Only Shader - Possible?

Discussion in 'Shaders' started by TerraUnity, Aug 24, 2016.

  1. TerraUnity

    TerraUnity

    Joined:
    Aug 3, 2012
    Posts:
    1,255
    The title says it all. Is it possible to have the object only do self shadow casting and receive shadows from other objects on its surface but no shadow casting on other objects below it!

    I wish there was an Ignore Layers option in Mesh Renderers to select which layers this object can cast shadows and from which layers it can receive shadows.

    So to summarize above, I want the specific object to cast shadows but on arbitrary layers and also receive shadows but from arbitrary layers. This makes it more complete & customized for shadow settings.

    I know you can set Cast/Receive flags on individual objects to make a setup, but what about terrains for example which doesn't have Mesh Renderers and it requires its shader hack which I don't know how to do it either and it's not even a permanent universal solution!

    Multiple light and multiple camera setup is not possible because I should stick with deferred lighting which I don't know how to set up a Multi-Rig in deferred for god's sake if you know what I mean!

    In my scene, I have to set the shadow distance very high (10000+) mostly for large procedural objects like terrains, what I'm trying to do is that for a specific object I need to discard shadow casting on everything except itself as its shadow casting on other objects will be handled using projector shadows.

    The lack of layering feature for shadows in Unity is what I'm suffering for several years now and in every project we face this limitation. I think the shadowing system in Unity deserves to have its own layering option!
     
    Last edited: Aug 24, 2016
  2. sandstedt

    sandstedt

    Joined:
    May 24, 2015
    Posts:
    67
    Did you find any solution for this?