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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more..
    Dismiss Notice
  3. Dismiss Notice

Bug Shadows Not Working with Draw Instanced on Split Terrains in HDRP 7.5.3

Discussion in 'High Definition Render Pipeline' started by i2eilly, Feb 21, 2021.

  1. i2eilly

    i2eilly

    Joined:
    Feb 27, 2018
    Posts:
    45
    Hey Everyone,

    I recently switched my project over to HDRP and have been having huge issues with the shadows on the terrain.

    I am using 2019.4.20f1 and HDRP 7.5.3.



    This only happens when the terrain is set to 'Draw Instanced'.

    Update*** |This will happen to any terrain that is spilt inside Unity 2019.4 LTS HDRP 7.5.3.|***

    I have seen other threads from people facing the same issue and they just disable the 'Draw Instanced' option however, if I do that my project just crashes when I press play. I would also like to keep the benefits of instanced terrain as there are 133 terrains in the project.

    What I have tried so far

    I have checked the clipping plane is at a resonable level, even changed to extremely low or high numbers with no effect on the shadows.

    I have also played with the shadow cascades - this also has no effect.

    I did try to reproduce this in a new project, but have been unable to get the shadows to act like this. I am currently still trying to reproduced to see if I can find the cause!

    Removed skybox/set a new skybox.

    Using a different terrain shader.

    Deleting everything in the scene - to see if there was a gameobject causing it.

    I placed a huge plane with a few cubes in the scene and deactivated the terrain, the shadows dissapear. Re-activating the terrains the shadows re appear.

    If I do disable 'Draw Instanced' then the shadows dissapear and the scene lighting is as expected.

    Has anyone got any ideas what might be causing this issue? I am 100% sure it is something to do with the terrains, is this a bug with 'Draw Instanced'?

    Any help anyone can provide would much appreciated, it is driving me crazy and grinding my project to a halt.
     
    Last edited: Mar 4, 2021
  2. i2eilly

    i2eilly

    Joined:
    Feb 27, 2018
    Posts:
    45
    Looking at the lighting debug view, it looks like the terrain tiles are flipping over.



    I am not 100% sure what this view is showing, if anyone has any insight I would really appreciate it.
     
  3. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    1,645
    Its a known bug with Draw Instanced...
     
  4. i2eilly

    i2eilly

    Joined:
    Feb 27, 2018
    Posts:
    45
    Thank you Warthos! Do you have a link to an issue tracker page or any idea if this will be fixed in the LTS versions?
     
  5. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    1,645
    Dont have a link, but where LTS builds last for 2 or 3 years, its safe to say it will be fixed in the next LTS. Could be fixed in newer versions, dont know, as i only use LTS builds.
     
  6. i2eilly

    i2eilly

    Joined:
    Feb 27, 2018
    Posts:
    45
    Yeah I am sticking with the LTS, I am hoping Unity are aware of this and are actively trying to fix it
     
    P_Jong likes this.
  7. i2eilly

    i2eilly

    Joined:
    Feb 27, 2018
    Posts:
    45
    Bump **

    Can someone from Unity confirm this is a known issue.

    I just updated and the only known issue I can see on the update log is -

    Terrain: Terrain Lit Opacity as Density option causes alpha'd areas on the 5th layer or greater to appear with artifacts


    I have been working on my project for 2 years now, I am using with the LTS version but this is making my project very unstable to work with.
     
    P_Jong likes this.
  8. HIBIKI_entertainment

    HIBIKI_entertainment

    Joined:
    Dec 4, 2018
    Posts:
    548

    I can't find the exact tracker, but it's been brought up numerous times in forums, you may be able to find a search.

    But basically The Shadow depth on instanced terrains that have been split (likely within unity) flicker like crazy, the only way around that in LTS is to disable instancing on your split terrains.

    One of the responses from unity in the forum had the tracker link stating that it was only going to be fixed in 2021+

    You still have the option to stay in LTS, especially if you're in production now.

    I'd keep evaluating your pros and cons.

    You could also always just check the terrain only set up in 2021 to evaluate and isolate this particular situation to see.

    Of course upgrading into a non production ready version can cause chaos on many other things.

    You may need to evaluate your production cycle to help you to decide if you're moving forward or not and can deal with the bug in some other manner.

    With the new pipeline cycles from 2019- 2022 being shortly on Unity's part 2019LTS ends mid 2021.

    If you're in production or near shipping and will finish mid year maybe hold on in there.

    But if you're still in pre stages somewhere, then you could evaluate getting prepared to jump into the new LTS when it arrives.

    It's always a tough choice with Dev breaking things like this, but I'd honestly say pull all the information you can before you make any decision, you certainly don't want to be giving yourself another 2 years unnecessarily.

    Make good choices to reach your goals sooner rather than later.

    Good luck regardless!
     
    i2eilly likes this.
  9. i2eilly

    i2eilly

    Joined:
    Feb 27, 2018
    Posts:
    45

    Thank you for your response! I just had another look and couldn't find a post about this, I have been looking for a few weeks now. That makes sense as my Terrain is tiled, so I assume this is the same issue you are talking about.

    I spoke with Unity on Twitter and they said they would get someone from Unity to confirm this an issue and respond here.

    When I disable 'Draw Instanced' and enter playmode the project just crashes instantly, so I'm pretty stuck.

    I think you mean that the 2018 LTS ends this year.

    'We’re committed to supporting 2019.4 LTS releases with biweekly updates until mid-2021, after which updates will be monthly until May 2022 (two years after the initial release date). These updates will only cover usability fixes aimed at improving the stability of the product to enable users to ship their projects.


    Unity 2018.4 is now the legacy LTS; it will be updated monthly until it reaches the end of its support cycle in spring 2021.'


    Upgrading my project to an Alpha or Beta version of Unity to fix a bug in a LTS version is really upsetting. I'm sat here wondering when did Unity go so wrong, this is crazy.

    Upgrading to 2020/21 would require me to upgrade my HDRP package.

    This means everything will break.

    I wish Unity would respond as to why they aren't fixing this issue in 2019 LTS.
     
    Last edited: Mar 5, 2021
    HIBIKI_entertainment likes this.
  10. i2eilly

    i2eilly

    Joined:
    Feb 27, 2018
    Posts:
    45
    Last edited: Mar 3, 2021
  11. HIBIKI_entertainment

    HIBIKI_entertainment

    Joined:
    Dec 4, 2018
    Posts:
    548

    Thanks for correcting me on the timescale there!

    I'll have another jump shortly to find the thread and post back to you if I find it.

    With hope they get back to you sooner rather than later *fingers crossed*

    I see what you mean with the relation similar but not exactly.

    Have you tried to isolate the issue in the frame debugger for terrain shadow cascades?
    And also if you're using anything in particular 3rd party or otherwise that might affect that specific system..
     
    i2eilly likes this.
  12. i2eilly

    i2eilly

    Joined:
    Feb 27, 2018
    Posts:
    45
    Ahh no worries, Unity versions can get confusing. You got me worried when you said 2019 was ending so soon!

    I am still searching but can't find any other posts, if you can find one that would be really helpful!

    I did delete everything in the scene apart from the terrain and the shadows still acted like this, I also played with the debug for shadow cascades. The only thing that removes the effect is disabling 'Draw Instanced' but as I said, my project crashes if I do that, plus with 133 terrains I would like them to be instanced.

    I just realized another issue, if I update to 2020.2, I lose enlighten. So I really need to stay in 2019.4 LTS & HDRP 7.5.3.

    So I am stuck with a 2 year old project bugged in Unity, I really wish someone from Unity would just shed some light on the issue.

    Surely if it is fixed in a newer version then 2019 LTS should be getting the fix. It is like a massive kick in the teeth for people/teams who are using the recommended version of Unity.

    I really appreciate your time and comments, thank you.
     
    HIBIKI_entertainment likes this.
  13. i2eilly

    i2eilly

    Joined:
    Feb 27, 2018
    Posts:
    45
    Ok I managed to reproduce the issue.

    Terrains that are split in Unity and have 'Draw Instanced' enabled will have this issue in Unity 2019.4.21f1 - HDRP 7.5.3.

    Using any method to split the terrain, Unity's Terrain Tools, SECTR, World Streamer in an empty project will causes the shadows to be broken.

    I have posted a bug report case number - (1318990)
     
    Last edited: Mar 3, 2021
    HIBIKI_entertainment likes this.
  14. HIBIKI_entertainment

    HIBIKI_entertainment

    Joined:
    Dec 4, 2018
    Posts:
    548

    Great work getting a repro and tracker.



    I'm sorry I didn't get back sooner.

    https://forum.unity.com/threads/hdrp-terrain-shadows-problem.917453/

    Here is the post I feel like I had originally seen on this equally so having a similar issue, but does go back to the original tracker anyway it seems

    Interestingly enough, I've never had this issue when not splitting within unity.

    It does seem however it may creep back.

    Will hopefully get a little time today to check this in 2020.

    Maybe there's a chance to port back

    Again sorry for the racing heart!!
     
    i2eilly likes this.
  15. i2eilly

    i2eilly

    Joined:
    Feb 27, 2018
    Posts:
    45
    I got a response from Unity stating this is the same issue - https://issuetracker.unity3d.com/is...ced-option-is-enabled-in-the-terrain-settings

    I guess this is the issue you were talking about HIBIKI_entertainment.

    This issue is there is no shadows on the terrain. But they are not the same issues. 2019.4 is not even mentioned here.

    This is a HDRP only bug with terrains that have been spilt inside Unity 2019.4.21f1 - HDRP 7.5.3 and have Draw Instanced enabled. It doesn't happen in the built in pipeline, I am yet to test URP - I guess URP will be OK due to no Realtime GI.

    It is very clear in the repro that shadows are broken with split terrains in 2019.4.21f1 - HDRP 7.5.3.
     
    Last edited: Mar 4, 2021
    HIBIKI_entertainment likes this.
  16. i2eilly

    i2eilly

    Joined:
    Feb 27, 2018
    Posts:
    45
    Testing in Unity 2020.2.6f1 and HDRP 10.3.1 the issue is there:(
     
    Last edited: Mar 5, 2021
  17. i2eilly

    i2eilly

    Joined:
    Feb 27, 2018
    Posts:
    45
    Further response form Unity...

    ``Hi,

    Thank you for the reply and yes you are right, this looks more related to this issue: https://issuetracker.unity3d.com/product/unity/issues/guid/1257896

    Which is fixed in 2021.1.0a1 and a backport is open for 2020.2, but I will also open a backport for 2019.4. Though I can't promise that it will be backported.

    Thank you for your understanding.``

    This is also not the same issue as I have already tested 2020.2 and split terrains work just fine with Draw Instanced enabled in HDRP 10.3.1.

    The issue tracker states that a planned fix is for 2020.3 for that issue...and it persists in 2020.2.
     
    Last edited: Mar 4, 2021
  18. HIBIKI_entertainment

    HIBIKI_entertainment

    Joined:
    Dec 4, 2018
    Posts:
    548

    Yeah we did some AB tests here and don't find it again in 2020.3

    With hope though, if this issue is very similar and the back port is a success, that genuinely helps everyone on LTS, and I can imagine (since it's a natural process to make) the bug will crop up a lot for people using the terrain system.

    Is the other issue you're testing different from your initial video/ from the tracker?
     
    i2eilly likes this.
  19. i2eilly

    i2eilly

    Joined:
    Feb 27, 2018
    Posts:
    45
    I got a new response stating they agree this issue is not either of the above mentioned and is a new issue only in HDRP 7.5.3.

    However I have been told it may not be fixed in 2019.4. I am not sure what happens now...

    Unity have accepted there is an issue in 2019.4 LTS HDRP 7.5.3, but are not promising a fix.

    I have been advised to upgrade to 2021.2 - but that is a big leap from 2019.4 and I am releasing the project later this year.

    I will keep this thread updated just in case someone else has the same issue in the future.

    Thank you for your help!
     
    HIBIKI_entertainment likes this.
  20. HIBIKI_entertainment

    HIBIKI_entertainment

    Joined:
    Dec 4, 2018
    Posts:
    548
    That's a great idea, it will certainly help others make decisions too.

    That's also not the first time I've seen this recommendation from unity in this version regard either.

    It may be worth you investigating the upgrade and make a test copy ready to study the impact it may have on your project, that's likely the quickest way you can see it as a viable solution or not, especially with this particular predicament

    You could make your own report for API/design 3rd party impacts etc, to help evaluate it too, seeing the whole picture.

    From our experiences the recent updates in some of our pre production projects have been a lot more forgiving than previous major version changes, so there is a chance of success there.
    But I fully understand going out of a 'production ready LTS' into potentially more instabilities can be a difficult choice.

    Surface to say, it's your choice still, even if you feel forced at this point.

    I honestly wish you the best going forward :)
     
    i2eilly likes this.
  21. i2eilly

    i2eilly

    Joined:
    Feb 27, 2018
    Posts:
    45

    Thank you!

    Firstly I will keep track of the issue to see if it can be fixed in 2019.4 HDRP 7.5.3 as this is the best outcome.

    If not, I will look into hacks that can be used to workaround the issue. This is because moving to such an unstable version of Unity will likely cause so many more problems than broken terrain shadows.

    Upgrading from HDRP 7.5.3 to a preview version of HDRP is not something I am really excited to do.

    Hopefully I can get an issue tracker link and will post here, the QA Team have yet to get back to me with a link. I am also hoping this gets added to the known issues on the update log.

    Thank you so much for your time, you really helped me narrow down the issue here!
     
    HIBIKI_entertainment likes this.
  22. i2eilly

    i2eilly

    Joined:
    Feb 27, 2018
    Posts:
    45
    So a little update.

    Unity are not fixing this in 2019.4 LTS.

    I can't believe I am the only one making an open world game in 2019.4 LTS HDRP 7.5.3. Anyone making a bigger game in HDRP would face this issue. I guess not many people making big games in HDRP 7!

    The experience with Unity bug reporting was dreadful to say the least.

    I spent 3 weeks isolating the issue, to find it was split terrains causing strange flickering shadows.

    I report a bug....

    QA tells me it is a duplicate...

    I explain it is not....

    QA tells me it is a duplicate of a different issue....

    I explain to them it is not....

    QA ignores me and a Unity staff forum member confirms the QA person was wrong and this is an issue....

    I then get no response from QA only a private message saying it is fixed in the latest Alpha HDRP 12.x. (Unity 2021.2).


    So I need to update a 2 year old project about to release in December to the latest Alpha....With no explanation or even a thank you for finding their bug....

    Well what an idiot I was sticking with the LTS version! It is the latest Alpha's that get all the fixes!

    Issue tracker states they found it in 11...
    https://issuetracker.unity3d.com/is...21.407408444.1612505480-1898724238.1594832502
    I sent the bug report in 7.5.3...
     
    Last edited: Mar 5, 2021
  23. i2eilly

    i2eilly

    Joined:
    Feb 27, 2018
    Posts:
    45
    So with the release of Unity 2019.4.22 today.

    It is sad to see this is not listed as a Known Issue with the LTS version.
     
  24. HIBIKI_entertainment

    HIBIKI_entertainment

    Joined:
    Dec 4, 2018
    Posts:
    548
    @i2eilly this may have something to do with how known issues are interpretated ( level of critical production affect)
    for example i know engine versions and pipelines, system and feature. have different breakdowns of known issues, terrains is likely more of a feature than a system in comprasion to something like an animation pipeline.

    keep your head up, best you can, don't let it drain your drive and stamina and keep the fires on your project rolling!
     
    i2eilly likes this.
  25. i2eilly

    i2eilly

    Joined:
    Feb 27, 2018
    Posts:
    45
    I did ask if it would be shown as a known issue but had no response.

    It would be nice for developers to know about this issue before choosing to use the terrain system in advance and finding out it can't be used on a big scale in HDRP 7.5.3.

    For now I have created proxy mesh and I am using those to cast shadows. But they also have an overhead that shouldn't really be needed - I have 133 terrains in the project, now that is 266.

    In the end it may just be a case of using mesh terrains, it is just a shame as the terrain feature is beautiful and I love using it!

    I wasn't given an explanation as to why it would be difficult to back port, of course I understand it is. Unity must also understand the same is true for updating a project the same amount of distance.

    I am happy I know what the issue is now as I can make some progress, it took me weeks to find the cause of this issue. I was upset with the support from Unity, but I am using Unity for free so any support is better than nothing.
     
    HIBIKI_entertainment likes this.
  26. HIBIKI_entertainment

    HIBIKI_entertainment

    Joined:
    Dec 4, 2018
    Posts:
    548
    I wholeheartedly agree, similar to the bug plaguing the asset store / local app data folder, not updating assets but telling you it has. This things can become quite problematic and difficult to debug or find solutions, even be aware of it until god knows when.

    I'm glad you've at least made some progress with this.

    One thing we have done before with great success is tuning off the mesh draw and shadows on the unity terrain and then using a sampled mesh in it's place.
    The performance isn't too shabby and it would eliminate your massive terrain increase as you'll draw the mesh and it's shadows and only show the trees/details from the unity terrain.

    It just takes an extra workflow to create the mesh with good texturing that matches your unity terrain splat, but you could also script a distant tile cull since you have so many.

    The additional caveat is of course you have to do this at the very end of your terrain state cause you won't be able to go back and iterate as easily, but that depends on your development timeline set up team/solo etc.

    But it might be worth looking into as well.

    I absolutely understand how disheartened you must have felt, I can see it in your words here too.

    I think the solution you have right now is pretty reasonable and it allows you to move forward with a visual representation of what you originally wanted anyway.

    Like you said if you have to change to a mesh eventually, then that's eventually, I think you'll be able to continue to use the tool you love until that point, in which that's also a good moment, because you'll be at an optimisation stage.

    so you can enjoy using the terrain tool and at later stages when you know it's not needed anymore, implement your mesh workflow.

    You'll be fully aware of your performance increase with the solutions you currently have in place, so that probably would be a nice bonus for you later down the line.

    Best of luck! And keep it up.
     
  27. HIBIKI_entertainment

    HIBIKI_entertainment

    Joined:
    Dec 4, 2018
    Posts:
    548
    @i2eilly
    We had some success with workarounds on this here as mentioned previously.
    imo i thought this might completely solve your issue moving forward.



    All the best and keep it up!
     
    P_Jong likes this.
  28. P_Jong

    P_Jong

    Joined:
    Jun 14, 2017
    Posts:
    58
    I'm getting this also in URP with Unity 2020.3.2f1 and URP 10.4.0. It also happens when splitting up a terrain. The best work around for now as shown by @HIBIKI_entertainment is to select Off for Cast Shadows in the Terrain Toolbox shows above. You can also toggle off the "Draw Instanced" as mentioned by @i2eilly, but then you loose some performance. I just wanted to list this for those using URP that this workaround will also work for them.

    @i2eilly my game is not as big as yours with 133 terrains! Impressive. I love exploring open worlds. Mine has a total of 80 terrains but its split up between 5 different planets for the player to explore. This bug has been bothering me for a couple of months now and I didn't know what had caused it. I kept baking maps with different settings thinking I set something up wrong. Thanks to the two of your for these work arounds!
     
    HIBIKI_entertainment and i2eilly like this.
  29. i2eilly

    i2eilly

    Joined:
    Feb 27, 2018
    Posts:
    45
    Thank you! It has been quite the journey making this game! I can't actually turn off 'Draw Instanced' as this will crash my project.

    I too lost a good 3-4 weeks try to find out what this issue was in my project. Unity have fixed in 2021, they have not said if it will be fixed for 2019 or 2020 as they closed down my issue tracker and marked as fixed!

    The only way around this for me was to make low poly mesh and use them as the shadow casters setting 'Shadows Only' and turning off shadows completely for the terrains.
     
    HIBIKI_entertainment and P_Jong like this.
  30. HIBIKI_entertainment

    HIBIKI_entertainment

    Joined:
    Dec 4, 2018
    Posts:
    548
    @i2eilly @P_Jong I'm glad you have both been able to find solutions/work arounds to this. It is indeed a tough situation and there's certainly not a one shoe fits all solution.
    Keep it up!