Search Unity

  1. We would like to hear your feedback about Unity and our products. Click here for more information.
    Dismiss Notice

LWRP Shadows

Discussion in 'Handheld AR' started by m3rt32, Mar 28, 2019.

  1. m3rt32

    m3rt32

    Joined:
    Mar 5, 2013
    Posts:
    48
    Hey! In GDC AR Foundation talk, we saw that Unity showed LWRP along with shadows in transparent surfaces. Unfortunately, it doesn't exists in lightweight rp branch in arfoundation-samples repo. So is there a way that you can provide it ? Because shadows are quite important and old shaders are not working with lwrp.
     
    Saicopate likes this.
  2. Saicopate

    Saicopate

    Joined:
    Sep 25, 2017
    Posts:
    54
    Same issue here. This is a must-have for AR.
     
  3. DanMillerU3D

    DanMillerU3D

    Unity Technologies

    Joined:
    May 12, 2017
    Posts:
    5
    m3rt32 likes this.
  4. Saicopate

    Saicopate

    Joined:
    Sep 25, 2017
    Posts:
    54
    I'm getting:

    Shader error in 'Custom/Shadows Only': failed to open source file: 'ShadowsOnlyPass.hlsl' at line 70 (on metal)


    Any clue where to get it from?
     
  5. m3rt32

    m3rt32

    Joined:
    Mar 5, 2013
    Posts:
    48
    @Saicopate I see an hlsl shader include in this shadowsOnly.shader file but since this is a gist I assume @DanMillerU3D didn't push push it. So, it would be great if you can also add hlsl shader @DanMillerU3D
     
  6. superjayman

    superjayman

    Joined:
    May 31, 2013
    Posts:
    108
    Where is #include "ShadowsOnlyPass.hlsl" ?
     
  7. DanMillerU3D

    DanMillerU3D

    Unity Technologies

    Joined:
    May 12, 2017
    Posts:
    5
  8. fotalik

    fotalik

    Joined:
    Sep 23, 2017
    Posts:
    18
    @DanMillerU3D Hi, when i import ShadowsOnlyPass.hlsl I get the following error:

    upload_2019-5-2_11-52-46.png
     
    azevedco likes this.
  9. azevedco

    azevedco

    Joined:
    Mar 2, 2014
    Posts:
    1
    Wow, was literally about to post this at the exact same time.
    Currently having this issue as well.
    To add on, here is the full error message:
    Shader error in 'Custom/Shadows Only': undeclared identifier '_MainTex_ST' at Assets/_Core/Shaders/ShadowsOnlyPass.hlsl(92) (on metal)

    Compiling Vertex program
    Platform defines: UNITY_NO_DXT5nm UNITY_ENABLE_REFLECTION_BUFFERS UNITY_NO_CUBEMAP_ARRAY UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_DLDR_ENCODING
     
    Last edited: May 2, 2019
    fotalik likes this.
  10. Tarrag

    Tarrag

    Joined:
    Nov 7, 2016
    Posts:
    85
  11. steego

    steego

    Joined:
    Jul 15, 2010
    Posts:
    895
  12. Andy-Touch

    Andy-Touch

    A Moon Shaped Bool Unity Technologies

    Joined:
    May 5, 2014
    Posts:
    1,005
    fotalik likes this.
  13. Tarrag

    Tarrag

    Joined:
    Nov 7, 2016
    Posts:
    85
    Thank you @steego ! This is a snapshot of the shadow I get with your shared shader, one whitish directional light and soft shadows, it comes out jagged and pitch black in my test.

    How can I remove the occlusion feature in the shader please?

    My settings below if that helps,
    Cheers, Sergio
    On Unity 2019.1.0f2, ARFoundation LWRP 2019-1 from git

    upload_2019-5-17_18-14-9.png

    upload_2019-5-17_19-17-39.png
    upload_2019-5-17_19-18-9.png
    upload_2019-5-17_19-18-31.png
     
    Last edited: May 17, 2019
  14. fotalik

    fotalik

    Joined:
    Sep 23, 2017
    Posts:
    18
    @Tarrag you can play with cascades and just decrease distance in LighweightRenderPipelineAsset - Shadows
     
  15. Tarrag

    Tarrag

    Joined:
    Nov 7, 2016
    Posts:
    85
    Hey @fotalik , thanks for the guidance, I played with those but none did the trick (distance 0, 2, 30, 40, cascades 0, 2 - combining the two)
     
  16. hawken

    hawken

    Joined:
    Aug 22, 2013
    Posts:
    430
    @Tarrag Distance is in unit meters, currently LWRP doesn't fade distance like the default RP, but it will cut off at that distance and give you all the resolution in that area. If you set it to 5 meters or so, the shadows will be sharp. To get soft shadows, you'll need to tick the box on your LWRP profile that says "soft shadows" - just changing the light settings has no effect.

    To make the shadow less black, just reduce the shadow strength in light settings.
     
    Tarrag likes this.
  17. Tarrag

    Tarrag

    Joined:
    Nov 7, 2016
    Posts:
    85
    Thank you @hawken ! Yes reducing the strength setting on the actual light with some distance did it ! :)
     
  18. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    135
    @hawken What do I do then in an architectural situation where the building is 200 metres long? I need sharp shadows all the way. I would for example stand on the corner of the building looking down the long wall, or I can look from birdseye at the entire building. I can't have lowres shadows across entire thing, or only sharp shadows for 5 metres when I typically view the building from more than 5 metres away...

    Any ideas or thoughts come to mind?
     
  19. hawken

    hawken

    Joined:
    Aug 22, 2013
    Posts:
    430
    In this instance use the cascade editor, you can set where sharp shadows end, and lower res ones start by adjusting the 3 sliders.

    In standard RP there is a visual preview of this in the editor window. It doesn't appear in LWRP but it does work.
     
  20. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    135
    yeah I tried that but it produced very destinct differences in the line where the cascade takes place. Looking down a 200m wall for example, you can clearly see the 4 different qualities
     
  21. hawken

    hawken

    Joined:
    Aug 22, 2013
    Posts:
    430
    Theres a plugin on the asset store called “next-gen soft shadows” that might fit your needs. I’ve not tried it in AR yet so I can’t vouch for performance but it does do away with banding.
     
    newguy123 likes this.
  22. Tarrag

    Tarrag

    Joined:
    Nov 7, 2016
    Posts:
    85
    cool plugin, says not avail for lwrp "Unity 5.6 up to 2019 (Built-in Renderer) HD & LW pipeline support coming in the future"