Hi there. I’m using HDRP in the latest version of Unity 2022, and I’m painting details onto my terrain. These details use grass prefabs from Unity’s HDRP Terrain Demo Scene, and they are GPU-instanced. Also, I’m using DirectX 12 within Unity.
The issue is that these details badly flicker. I can’t seem to find the source of the problem. Any ideas?
Could be temporal antialiasing. Go to your camera and disable anti-aliasing, and see if it still flickers once in-game.
Also scene camera has it’s own anti-aliasing setting, you can find it by pressing on the small camera icon.
Temporal Antialiasing does worse on vegetation that is rendered through unity’s terrain, (since it uses instancing), and so they lose motion vectors which TAA relies on to produce better results.
Tried it out, disabled TAA on both scene and main camera. Did not seem to work. I’m trying enabling the detail objects for lightmapping, maybe that’ll help. Any other ideas?
Tried it out, disabled TAA on both scene and main camera. Did not seem to work. I’m trying enabling the detail objects for lightmapping, maybe that’ll help. I did, however, just notice this error, could be related:
Yeah that’s weird, no way that’s caused by anti-aliasing method. Not sure what to be honest.
Most likely as you said it’s a problem with the terrain.
Try disabling/enabling instancing in terrain settings, see if that changes anything.
Also try disabling all post processing.
Finally try disabling Light Layers in your active HDRP asset (the one your using). It’s there somewhere.
If the issue still occurs it’s most likely an issue with the terrain or grass shader, not sure what unfortunately.
Are you using default shaders or something you’ve creating with ShaderGraph? Also interested to know the results of testing with GPU instancing turned off.
If you have a project where you can reproduce the issue reliably (seems like this is the case) I’d say go ahead and created a bug report and we’ll take a look.
It looks like it’s from a TerrainGrass shader graph, but I didn’t create it myself. I’m using grass details from Unity’s HDRP Terrain Demo Scene. Also, disabling GPU instancing appears to be unsupported. Unity version is 2022.1.2f1, HDRP version is 13.1.8.
Fortunately, it looks like switching to DX11 worked. Unfortunately, looks like I can’t reap the performance benefits of DX12. Thank you for suggesting that, though, and I guess I can finally get on with my project.
Thanks for following up! Of course we don’t want DX12 to be broken so this will need to get fixed. If you have a project that reproduces the issue reliably, a bug report with said project would be awesome.
I have the same problem on URP. A grass mesh from the latest Unity’s Terrain Sample Asset Pack flickers in Game mode (both shadow and the grass) as if it was Z-fighting with itself. Nothing helps (DX11/12, shadow bias, near clipping plane etc). The grass comes with shader “Shader graphs\Terrain grass”. In Scene mode the flickering does not occur. Interestingly in a new clean project I cannot reproduce it.
Seems, this didn’t get fixed yet, if it’s a bug? It’s still happening for me in 2022.2.b13 with the latest version of the HDRP Terrain demo. Flickers on DX12 but not 11. I can make a bug report, if necessary. But it seems pretty easy to reproduce and shouldn’t happen now with DX12 out of experimental. Especially not on an Unity demo. Or is there some secret HDRP setting that you have to tick to have it work in DX12?
Good to see the thread is still getting attention. I’ve been done with the project for about eight months now but it’s a little frustrating that DX12, for all its wonderful performance benefits, still has issues with a pretty significant component of the terrain system. I’m building a space game rn but I still hope it gets resolved, and soon.
Yeah, if just someone would read the forum
Anyway, I have just submitted a bug report and will keep you updated here on how’s it going. That’s what I wrote on how to reproduce it:
Start a HDRP core project, import Unity HDRP Terrain Sample Asset and start the TerrainDemoScene while using DX12.
Move the camera in scene view and you see flickering of the grass already. Same happens in play mode.
If you turn DX12 off and use DX11, there is no flickering.
Expected result: no flickering in the Scene view
Actual result: flickering in the Scene view
Reproducible with: 2022.1.2f1, 2022.2.0b16
Not reproducible with: 2021.3.16f1, 2022.2.0f1, 2022.2.2f1, 2023.1.0a24
Couldn’t test with: 2022.1.1f1 (due to the project crashing after selecting DX12 Graphics API)
Also experiencing this issue (or something with the same symptoms anyway) with 2021.3.16f1 and URP 12.1.8. I do not have the option of reverting to DX11 as I need DX12 for the Crest Ocean System to render properly on XBox. Is there a link/reference number for the bug report mentioned in the last post above? Thanks.