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

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.

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.

Its a known bug with Draw Instanced…

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?

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.

Yeah I am sticking with the LTS, I am hoping Unity are aware of this and are actively trying to fix it

1 Like

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.

1 Like

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!

1 Like

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.

1 Like

I can see this issue here - Unity Issue Tracker - Instanced Terrain shadows are flickering when no Shadow Cascades and Close Fit Shadow Projection are used and camera is moving

But it isn’t to do with shadow cascades and close fit, although it is a similar issue.

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…

1 Like

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.

1 Like

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)

1 Like

Great work getting a repro and tracker.

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

https://discussions.unity.com/t/797036

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!!

1 Like

I got a response from Unity stating this is the same issue - Unity Issue Tracker - Terrain does not cast Shadows when "Draw Instanced" 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.

1 Like

Testing in Unity 2020.2.6f1 and HDRP 10.3.1 the issue is there:(

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.

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?

1 Like

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!

1 Like

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 :slight_smile:

1 Like