Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. We are looking for feedback on the experimental Unity Safe Mode which is aiming to help you resolve compilation errors faster during project startup.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

HDRP shadow artifact.

Discussion in 'Graphics Experimental Previews' started by jjejj87, Jun 5, 2018.

  1. jjejj87

    jjejj87

    Joined:
    Feb 2, 2013
    Posts:
    446
    I am getting weird shadow artifacts on some objects. It seems to be happening with objects with flat surface.

    Unity 18.2.0b6 with HDRP.

    Lightmap is not baked and only Realtime GI is enabled. All objects on scene are marked static with one directional light.
    shadow.jpg
     
    Last edited: Jun 5, 2018
  2. Paddington_Bear

    Paddington_Bear

    Joined:
    Dec 9, 2012
    Posts:
    274
    Have you checked your PP stack?
     
    Last edited: Jun 6, 2018
  3. jjejj87

    jjejj87

    Joined:
    Feb 2, 2013
    Posts:
    446
    Yes, but it doesn't seem to be the problem, here are more screenshots with all PP disabled.

    To add, it is not lightmap related, because, when I rotate the object in the editor, the shadow artifacts stay directional light relevant

    artifact2.jpg
     
  4. uy3d

    uy3d

    Unity Technologies

    Joined:
    Aug 16, 2016
    Posts:
    159
    Are you using contact shadows?
    Also, have you checked the normals on those meshes? You can use the HDRP debug views to make sure that they're pointing outwards.
     
  5. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    26,727
    Regarding contact shadows, are they a work in progress? I only seem to get noise from them like the OP.
     
  6. uy3d

    uy3d

    Unity Technologies

    Joined:
    Aug 16, 2016
    Posts:
    159
    They are work in progress in the sense that they're not done, but they are not currently being worked on. You'll need some form of temporal AA to get rid of the resulting noise.
     
  7. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    26,727
    I have the post processing stack on, with TAA but the noise persists, I guess I need to smooth it a bit more somehow.
     
  8. jjejj87

    jjejj87

    Joined:
    Feb 2, 2013
    Posts:
    446
    First screenshot was with contact shadows. The second is without. It is happening on both.

    As for normals, they are all correct. If you check the screenshot showing the underside of a roof, you can see wood bars, artifacting on the right side and the left side fine - they are the same mesh just repeated.

    Here is the screenshot of the same mesh in the example scene:
    bench.jpg

    and here I have no issues under the same setting.
     
  9. kemalakay

    kemalakay

    Unity Technologies

    Joined:
    Jul 12, 2016
    Posts:
    224
    Hello @jjejj87

    It's really hard to tell anything without seeing your actual scene setup. Can you perhaps share a small reproducible project with us where this issue persists? So we can check it on our end.

    You can either report this issue through BugReporter or you can directly share the project with me and/or @uy3d through PM

    Thanks!
     
  10. jjejj87

    jjejj87

    Joined:
    Feb 2, 2013
    Posts:
    446
    kemalakay, I will do that
     
    kemalakay likes this.
  11. jjejj87

    jjejj87

    Joined:
    Feb 2, 2013
    Posts:
    446
    kermalakay, I sent u a pm.
     
  12. kemalakay

    kemalakay

    Unity Technologies

    Joined:
    Jul 12, 2016
    Posts:
    224
    We followed up this issue with @jjejj87 and after a more thorough investigation, we realized that the problem was with realtime lightmap UVs that Enlighten was using for realtime GI. We'll share the solution here so if you also encounter a similar problem, you can refer to this thread.

    Basically, you're seeing four screenshots below. On the first image, you can clearly see the artifacts on the bench (black areas) and this is due to overlapping faces in the lightmap. On the left side of the screenshot, you can see the lightmap UV layout for the mesh.

    On the second screenshot below, you can see that artifact issue is resolved. This is achieved by preventing overlaps between the charts. For optimization purposes, `optimize realtime UVs` option is enabled in Mesh Renderer by default. If you turn that off (see the last image), you can see that lightmap layout changes. You can also use Global Maps tab in lighting window in order to troubleshoot your UVs. In this case, you should check Realtime Albedo since you're using Realtime GI with Enlighten.

    Now, we're aware that automatic unwrapping solutions in Unity (i.e. `Generate Lightmaps` option and `Optimize Realtime UVs`) are not very ideal. Thus, we also recommend that you author your own lightmap UVs if you can afford it.

    For realtime lightmap UVs, you need to provide the data into third UV channel of your mesh. You can find more details about this in this post: https://forum.unity.com/threads/imp...garding-mesh-uv-channels.370746/#post-2402424 Regarding lightmaps, it is also important to keep in mind that the padding between the charts should always be at least two full texels apart in order to avoid light leaking and artifacts.

    Thanks

    WithRealtimeUV.JPG WithoutRealtimeUV.JPG NotEnoughGap.JPG

    RealtimeUVs.jpg
     
  13. jjejj87

    jjejj87

    Joined:
    Feb 2, 2013
    Posts:
    446
    I just want to add that kemalakay was really helpful and through that process, I learned things that I was not aware of. I was genuinely surprised with the level of support.

    But, I also realize that there are few things that Unity should add.

    1. A full comprehensive documentation geared towards production. Finding out limitations like this and the fact that many more will have to go through it is just painful. Please author a full comprehensive document - not a forum thread.

    2. In the 3d model asset inspector import settings please add the following (short term) :
    • ability to see if the 3d model has overlapping UVs (a warning label should work) and warn users about lightmapping and other related issues that we should be aware of.
    • Information label in the mesh component whether or not the 3rd channel is being used.
    • ability to author the 3rd UV channel by duplicating the 1st channel. (I don't want to author an asset, then import and adjust UVs until Unity likes it. If my first channel has no overlapping UVs, then I'd like to use that as my 3rd as well. Easy, Simple, Fast)
    • ability to preview bake the model in a generic environment in the inspector for checking lightmapping results (I do it in a separate scene for now, but it would be better if it can be done in an inspector, quick and fast)
    3. And these are my suggestions for the long term regarding Realtime GI.
    • Realtime GI uses Enlighten at the moment, and given the history and its drawbacks, perhaps we should also get the option to calculate radiosity by PLM as well.
    • Allow proxy volume adjusters so that certain parts of the baked output can be tweaked post bake.
    • GPU support for realistic iteration cycle.
    • Add another option for baking RealtimeGI, a sparse octree voxel GI baker using GPU like SEGI. Please incorporate SEGI or its variant for baking precomputed GI.
     
    McRiP28, kemalakay and hippocoder like this.
  14. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    26,727
    Please don't. But instead provide a suitable interface that's documented so that 3rd party authors can continue innovating without any invasive work to existing pipelines :)

    SEGI is really bad for most projects performance wise and doesn't meet the same quality standards I set for GI.
     
  15. jjejj87

    jjejj87

    Joined:
    Feb 2, 2013
    Posts:
    446
    hippocoder, I think you are getting my point wrong. I meant that SEGI or its variant (voxel based) could be used for precompute calculation (not realtime) because one, it is GPU based already, and two, it is a technique vastly different from Enlighten/PLM. I personally think voxel generation out performs uv based lightmapping in many ways under the following premise:
    • Prototyping
    • Early level placement and shadow/light/GI adjustment
    • 3d assets with overlapping UVs and varying scale.
    SEGI in realtime use is quite demanding, but the same tech when used for calculating precompute seems like a good option. It is just faster - much faster. Voxel generation could also help with current Enlighten's short comings. For example, calculting radiosity from generated voxels could also work.
     
    LacunaCorp and hippocoder like this.
unityunity