Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. The 2023.1 beta is now available for testing. To find out what's new, have a look at our 2023.1 feature highlights.
    Dismiss Notice

Semitransparent Shadows?

Discussion in 'Unity 5 Pre-order Beta' started by PhobicGunner, Oct 27, 2014.

  1. PhobicGunner

    PhobicGunner

    Joined:
    Jun 28, 2011
    Posts:
    1,813
    Hey, I noticed that with the new standard shader I can cast semitransparent shadows - which is amazing! That said, I'm trying to see if I can add this functionality to a custom alphablended surface shader (the end goal being a sort of faked lighting particle shader for smoke and such) but I'm having trouble understanding what's going on in the Universal shader.

    Any pointers?
     
  2. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    These shadows are a bit of a hack - it's more like "shadow dithering" based on alpha value, and only look okay-ish because shadows are later blurred.

    In a custom shader, you'd have to write a manual ShadowCaster pass, with shader code similar to UnityUniversalShadow.cginc
     
  3. PhobicGunner

    PhobicGunner

    Joined:
    Jun 28, 2011
    Posts:
    1,813
    I figured you were doing some kind of alpha-to-coverage-style hack :) As far as hacks go, it's pretty damn neat.
    Just as a matter of curiousity, what about adding this as a pragma to surface shaders? Like there's the "alpha" keyword, maybe there could also be "alphaDitherShadows" or something.
     
  4. PhobicGunner

    PhobicGunner

    Joined:
    Jun 28, 2011
    Posts:
    1,813
    On a side note, is it possible to modify the included Universal shader to add vertex color support? I think that would probably get me 90% of the way there.
     
  5. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    "Not easily" I guess, but since you have the source...

    OTOH, I'm working on making it possible to use Standard shaders' BRDF from surface shaders. Hopefully will land in one of these betas.
     
    shkar-noori likes this.
  6. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,688
    I'm curious actually, I can't find this setting for the semitransparent shadows. Where is it? I've looked on the light, the material, the renderer, and the light, to no avail.

    I'm loving the new standard shader, BTW. It's so easy to make objects that look really nice! :)
     
  7. Whippets

    Whippets

    Joined:
    Feb 28, 2013
    Posts:
    1,775
    Aras, need to get you and Joen (Unlogick) together, so that the UMA (and other characters) skin shader can be sorted out and use the new standard shader's internal BRDF system.