visualdesigncafe / nature-renderer

Nature Renderer is a plugin for the Unity game engine to efficiently render vegetation on your terrains.
https://visualdesigncafe.com/nature-renderer/
0 stars 0 forks source link

Huge black bar in the middle of the screen when using Deferred Rendering (BiRP) #51

Open valentin56610 opened 4 months ago

valentin56610 commented 4 months ago

Describe the bug Visual black bar in the middle of the screen.

Video of the bug happening: https://streamable.com/0pbwk8

To Reproduce Steps to reproduce the behavior: Basically have your terrain/scene setup, just switch rendering to Deferred, enjoy the black bars.

Expected behavior No black bar in the middle of the screen.

Screenshots Render ON: Capture d’écran 2024-05-31 à 22 37 40

Render OFF: Capture d’écran 2024-05-31 à 22 37 41

Project(please complete the following information):

System (please complete the following information):

Additional context Does not happen if render mode on Camera is set to Forward.

maxplooi commented 4 months ago

It looks like some of the detail objects/trees do not fully support Nature Renderer in the shaders. Most likely, the deferred shader pass is not patched correctly. Can you give it a try with different shaders on your prefabs to see if that fixes the issue? (The included Nature Shaders are always good to test with)

Another possible cause is that a script in the scene is rendering the camera with a replacement shader, which does not support Nature Renderer. Do you have any image effects or other special effects that use a custom camera in the scene? You can try disabling those to check if the issue goes away.

valentin56610 commented 3 months ago

It looks like some of the detail objects/trees do not fully support Nature Renderer in the shaders. Most likely, the deferred shader pass is not patched correctly. Can you give it a try with different shaders on your prefabs to see if that fixes the issue? (The included Nature Shaders are always good to test with)

Another possible cause is that a script in the scene is rendering the camera with a replacement shader, which does not support Nature Renderer. Do you have any image effects or other special effects that use a custom camera in the scene? You can try disabling those to check if the issue goes away.

I am using The Vegetation Engine for all shaders for all vegetation items in the game.

As for post processing, I have tried disabling it and the black bar is still there, so it's not coming from there!

valentin56610 commented 3 months ago

UPDATE: It seems to be linked to the Ambient Occlusion from the Post Process unity package.

When I play without Ambient Occlusion, then all is fine, no black bar. As soon as I turn ON Ambient Occlusion, the bar appear.

Fun fact: Turning it back OFF doesn't make them go away, they will stay until scene is reloaded WITHOUT ambient occlusion

Well and obviously this is still linked to the Deferred rendering mode. So it is AO + deferred that creates these black bars.

valentin56610 commented 3 months ago

One more update: Changing the camera's clipping planes can make the black bar disappear Changing either the far clipping plane to 100 (from 10,000) or the near clipping plane to 1 (from 0.01) will remove the black bar

This is obviously not a solution, as I cannot use those clipping planes, but this make it go away. Maybe something worth checking.

Regular camera clipping planes (black bar present): Capture d’écran 2024-06-30 à 13 18 03

Clipping planes close set to 1 (no black bar): Capture d’écran 2024-06-30 à 13 18 22

Clipping plane far set to 100 (no black bar): Capture d’écran 2024-06-30 à 13 18 28

Also, changing the camera's clear flags from Skybox to anything else do also make the black bar go away: Capture d’écran 2024-06-30 à 13 21 17

valentin56610 commented 3 months ago

Ok so I think I have found the culprit.

I am using Amplify Impostors (https://assetstore.unity.com/packages/tools/utilities/amplify-impostors-119877) And so when a vegetation impostor is being rendered, the black bar appears

As soon as I remove/delete the impostor(s), the black bar is gone

valentin56610 commented 3 months ago

Final update and will be waiting for a fix: Rendering the impostors using Nature Renderer in Deferred mode + having Ambient Occlusion creates huge black bars on both end of the world.

Having no impostors OR no ambient occlusion OR not rendering using nature renderer removes the black bars.

I have tried placing the prefab and moving it around, no black bars. But if Nature Renderer is spawning/rendering it, then they appear

stonstad commented 2 weeks ago

Hi Valentin. Thank you for sharing your troubleshooting steps. I'm seeing similar behavior. I can confirm it is happening with NR 2022 + BiRP + Deferred. Changing the near clipping plane from 0.3 to 0.6 mitigates the behavior.

@maxplooi Any updates regarding this behavior?

image