Search Unity

Unique shadows are broken in 5.5

Discussion in '5.5 Beta' started by Kuura, Sep 17, 2016.

  1. Kuura

    Kuura

    Joined:
    Apr 16, 2015
    Posts:
    52
    Hi,

    Unique Character Shadows https://www.assetstore.unity3d.com/en/#!/content/39921 example project asset is broken in 5.5. The sampling shader gets called and all but the attenuation value it returns seems to be 0 almost everywhere. 5.5 introduced new depth stuff for directional lights and I'm not sure if this affects the sampling or the rendering of the shadow texture or something...

    I tried playing around with the pcf sampling part of the shader but couldn't get any useful data out. I'm also not sure how should I debug the shadowmap texture being rendered as the preview is completely black.

    This is one of the most valuable assets in our project so any help would be appreciated.

    Example pic of how the shadows are broken attached.
     

    Attached Files:

    looki666 likes this.
  2. Kuura

    Kuura

    Joined:
    Apr 16, 2015
    Posts:
    52
    Looking over this again the shadow texture inspector preview is red in 5.4 while it's black in 5.5. The camera render function seems to get called normally but I couldn't get it to render anything useful even after fiddling around. Changing the render texture creation parameters didn't do anything and trying to get the camera to render normal game content didn't work either for some reason, although it's not my script so it's possible I've overlooked something.
     
  3. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    1,487
    Hi Kuura,
    Unfortunately assets packs are not supported in Betas, since they change too fast and often. Once the final is released, our content team will check the bigger packs and update them.
     
    Quast likes this.
  4. Kuura

    Kuura

    Joined:
    Apr 16, 2015
    Posts:
    52
    Thank you for the reply, that's reassuring to hear. I hope this asset is considered one of the bigger packs.

    Still, if anyone has input on the issue that would be appreciated.
    5.5 has various bugfixes and features that are driving us to migrate early and I'm also personally interested in what's causing the problem.
     
  5. torbjorn

    torbjorn

    Unity Technologies

    Joined:
    Jun 25, 2015
    Posts:
    210
    Hi @Kuura, great that you're finding use for the package!

    The reason it has stopped working in 5.5 is that it's not aware of the new reverse depth precision improvements that are in 5.5.

    As LeonhardP already said, we normally don't update these during alpha/beta cycles, as keeping up with changes there is just too labour intensive.

    That being said, if you're willing to try a highly unofficial 5.5 fix, you can grab this package: https://drive.google.com/file/d/0ByY3rAMAS1c7VThneGRtMXZacmc/view?usp=sharing

    ("works for me" 5.5b4 dx11. will not work for 5.3/5.4. a proper package update should happen around 5.5 shipping)
     
    Pawige likes this.
  6. Kuura

    Kuura

    Joined:
    Apr 16, 2015
    Posts:
    52
    Your fix works great!
    Seems like the fix was literally just reversing the z component of the projection matrix. I should probably update my matrix knowledge. Thank you for taking time to look into this.
     
  7. wdw8903

    wdw8903

    Joined:
    Apr 2, 2015
    Posts:
    34
    Hello, I have tried unique shadows from asset store with unity 5.4 and above post one with 5.5. Both seems not work for me. I can't see any difference with normal shadow. Can you post a screenshot, @Kuura ? Thank you.
     

    Attached Files:

  8. Kuura

    Kuura

    Joined:
    Apr 16, 2015
    Posts:
    52
    I don't have the demo project anymore, but my best guess would be make sure you're using the asset correctly and try playing around with the values, remember to set a focus etc. The reversed Z should be the only issue affecting 5.4 -> 5.5. The shadows are working great here on 5.5b10.
     
  9. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,192
    Hi there,
    Regarding the new reversed z-buffer introduced in Unity 5.5 is there any chance UNITY_SAMPLE_DEPTH macro will be modified so it takes into account this?
    I know Linear01Depth and LinearEyeDepth function will automatically handle this for us, but what about the above macro?
     
  10. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    1,487
    Could you please create a dedicated thread for your question?
     
  11. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,192
    Done.
     
    LeonhardP and neoshaman like this.
  12. torbjorn

    torbjorn

    Unity Technologies

    Joined:
    Jun 25, 2015
    Posts:
    210
    @wdw8903 did you try entering playmode in the included sample scene?
     
  13. wdw8903

    wdw8903

    Joined:
    Apr 2, 2015
    Posts:
    34
    Sorry for the late reply, too busy and away from forum these days.
    The shadow change when I enter play mode, never notice this before. Great, now my character will have great shadow. thanks for the reply!