Search Unity

Nature Renderer: Better terrain detail rendering ✅ PBR ✅ Custom Shaders ✅ Shadows ✅ Wind ✅ SRP

Discussion in 'Assets and Asset Store' started by Visual-Design-Cafe, Oct 3, 2019.

  1. CreatureSurvive

    CreatureSurvive

    Joined:
    May 3, 2014
    Posts:
    17
    I picked up Nature Renderer a couple days ago, and just got around to testing it out. Firstly, the demo scene runs just fine, no issues at all. However in my own scenes (new or existing) it does not work at all.

    firstly, adding the Nature Renderer a terrain has a high chance if not only freezing unity, but my entire computer forcing a hard reboot (this happened 3 times now) it’s something I can’t even provide much detail for because unity doesn’t even generate editor logs beyond the point of adding the component in these cases.

    I’ve gotten it to work twice, both seemingly random. In these cases though, performance was beyond bad. It almost acts like a huge memory leak that quickly uses all resources until an eventual OS crash.

    most of my attempts result in this however. Add the component, and the scene flashes for a second and then shows Nature Renderer displaying correctly in the scene view. Or if it’s an empty terrain, then adding detail works as expected. However once I enter playmode, the editor shows the game view for a fraction of a second then jumps back to the scene view and all details disappear. Now the OS is completely frozen, requiring a hard reboot to recover.

    I haven’t had a single warning or error during any of these tests. I’ve tested running unity 2020.1 URP on a MBP Catalina. I tried both an existing project and a new project.

    I was expecting to see some related issues in this form, but I don’t see any which makes me wonder if I’m just doing something wrong (which honestly seems hard to do with the simplicity of this package).

    anyway, if anyone had similar issues, or even if they have some advice on debugging this, I’d be very grateful.
     
  2. Kagami12

    Kagami12

    Joined:
    Aug 9, 2015
    Posts:
    6
    I've been trying to implement this asset with a floating world origin, as approximately outlined here:
    http://wiki.unity3d.com/index.php/Floating_Origin

    There seems to be an issue when changing the transform of a terrain when the streaming option is toggled. The grass doesn't show up until I deactivate or reactivate the asset or toggle the streaming on and off.

    I've looked at the cells in the debugger, and before moving the terrain transform the cells are correctly aligned with the terrain, but after they all seem to be stuck below the terrain.

    Any idea on how to fix this?

    Thanks
     
  3. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    Changing this setting per-material is not supported at the moment.
    You can open the Shader Graph and disable decals in the settings of the master node:
    nature-renderer-shader-graph-receive-decals.jpg
     
  4. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    If you need to set the value higher than 250 then you can do so with a script using:
    Code (CSharp):
    1. GetComponent<VisualDesignCafe.Rendering.Nature.NatureRenderer>().DetailDistance = 300; // Or any other value
    You can call this in the Start method or Update method of a MonoBehaviour.
    Let me know if you need any help with creating this script.
     
    hopeful likes this.
  5. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    1. The detail distance will load from the terrain, so you can set it on the terrain using Map Magic. (I just noticed that this automatic loading of the detail distance got disabled in a recent update. I'll enable it again and publish an update this week.)
    2. You can change the grass density in the terrain settings. These settings are automatically loaded by Nature Renderer. (This should work fine in the current version)
    3. There is a very minimal performance impact. Nature Renderer is optimized to run on many terrains at the same time, so it should be no problem.

    The grass not showing is indeed caused by the shader not being included in the build. I have added a build process script that automatically registers the shaders for the next update.
     
    protopop likes this.
  6. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    This sounds very strange, it is the first time I am hearing of an issue like this. It does indeed sound like all system memory is being used until the system runs out of memory, although it may have other causes as well.
    I'll do my best to look into this for you. Can you let me know the following:
    • The size of the terrain that you are adding Nature Renderer to.
    • The detail density and detail resolution settings of the terrain.
    • The total number of different detail objects that have been added to the terrain.
    • If possible, can you send the scene with the terrain that causes the crash?
    • Can you try this in Unity 2019.4 LTS? Unity 2020.1 can be quite unstable from time to time.
     
  7. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    I'll test and debug it with the floating origin script from the wiki and get back to you. Moving the terrain should usually work fine, so there might be a bug here.
     
  8. CreatureSurvive

    CreatureSurvive

    Joined:
    May 3, 2014
    Posts:
    17
    So I did some more testing last night to see if I could get find whats causing the crashes with Nature Renderer in my project. It took a few more reboots before I found the cause, but it seems entirely due to procedural instancing. I can add the component, and if I’m quick enough, I can disable the procedural instancing before my computer completely crashes. Once it’s disabled, it takes another minute or more before the extreme lag diminishes. After that though, it works great.

    I have an older 2014 MBP with dual graphics, I’m guessing that the GT 750M cant handle the compute shaders even after you resized their pool. I’m not sure if that is a setting that you can expose in the inspector or not, but it’d be helpful for older hardware.

    as for the terrain I’m testing on, it’s small 250x250, with a single mesh detail object. The detail settings are probably irrelevant, because I tested on both ends of the spectrum while debugging this with no issue.

    if I add a single mesh detail while procedural instancing is enabled, it immediately boggs down until it crashes. So I don’t think it’s to do with density or object counts, it just plain doesn’t work right on this hardware.

    If you still need more testing, or if you still want me to test on 2019.4, I can do that later today and let you know. Also, I can send the project if needed, but this is affecting even new projects for me, so I’m thinking it’s just hardware limitations.

    In the event that procedural instancing is just not supported on my hardware, is there anyway to adjust the detail density, or is that only possible with instancing enabled.

    [edit] I was right to begin with, I was doing something wrong this whole time. I didn’t realize it but the mesh detail I was adding had an unsupported shader. As soon as I swapped the shader, procedural instancing started working correctly. I’m just amazed at the performance gains the single checkbox gives, great job on this package, and sorry to waist your time on this issue.
     
    Last edited: Sep 15, 2020
    hopeful and protopop like this.
  9. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    Thank you for looking into this with so much detail. I am glad to hear that everything is working correctly when using a shader that support procedural instancing.

    The non procedural instancing rendering system can indeed cause some issues on Mac depending on the specific Unity version and graphics card. (Unity's implementation of GPU Instancing on Mac is quite bad). However, I have only had minor performance issues with it so far, it is the first time that I am hearing of freezes/crashes. I'll see if I can reproduce this and improve compatibility with Mac. Even unsupported shaders should give a clear error message and not a crash, so no time wasted here :)
     
  10. benthroop

    benthroop

    Joined:
    Jan 5, 2007
    Posts:
    262
    Hey this is just an outstanding piece of work. I'm on the trial currently but will very likely pick it up.

    Curious what your recommendation is for grass bending and/or addition/removal of grass detail objects at runtime? Is that a feature you see in the horizon in this package, or is there another solution you recommend?
     
  11. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    Thanks! I am currently developing interactive grass :) I will be posting an official announcement about it later this week in this thread.
     
  12. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    Nature Shaders Announcement
    The focus of Nature Renderer has always been to provide performant rendering for vast amounts of grass.

    The shaders in Nature Renderer have been an important focus for me since the beginning. And lately I have been working on larger new shader features that are moving more and more outside of the scope of Nature Renderer.

    A lot of resources are going into building these shaders and I believe that they deserve the attention and resources to continue being expanded. That is why I have decided to release Nature Shaders as a separate paid package on the Asset Store that I will continue to expand with advanced rendering features:
    • Interactive Vegetation
      The first major new feature is fully interactive vegetation. In alignment with our philosophy it works for all render pipelines and requires no complicated setup.
      Status
      : Ready for early access.

    • Wind Simulations
      Built upon the wind that you know and use with Nature Renderer. I will add fully dynamic wind simulations to support local wind zones and other effects.
      Think of things like explosions, wind from attacks, wind from fans or other objects in the scene.
      Status
      : Research and prototype phase.

    • Seasonal and Weather variations.
      I want to add seasonal variations to materials so you can dynamically change colors and textures. As well as weather effects such as wet materials.
      Status
      : Idea phase.
    What does this mean for Nature Renderer?
    The current shaders package has been renamed to Nature Shaders Essentials and will continue to include all the essential shader features and updates.

    The advanced and complex new features described above are separate and will be added to the full (new) Nature Shaders package.

    Early-bird discount
    We will have a large early-bird discount (around 75% off) for all users of Nature Renderer, for the first 2 weeks.

    The shaders have been an important part of Nature Renderer since the beginning and I believe that you should have easy access to the next step.

    You can request early access and ensure that you will be notified for the early-bird discount here:
    Request Early Access and Early-Bird Discount >
     
    Ultroman, Rewaken, Tzirrit and 6 others like this.
  13. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,527
    Nice to see nature shaders coming!
    I would love it to be integrated into vegetation engine, so I can use the vegetation engine overlays with nature renderer shaders, making those systems works seamless together, do you think this is possible?
     
    Rewaken, protopop and johaswe like this.
  14. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    I will look into it, but it is most likely not possible. (Mixing different shaders is rarely possible). However, it shouldn't be too difficult to add a similar feature to Nature Shaders.
     
  15. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    Nature Renderer version 1.3.8 is now available through the built-in updater and will be available on the Asset Store within the next few days. Go to Help > Nature Renderer > Check for Updates to download it.

    New:
    • Shaders are now automatically included in build to prevent issue where shaders would be missing, resulting in objects not rendering.
    • Added notice in inspector to clarify that Shadow Distance is only applied to detail objects that use procedural instancing.
    • Emission support for shaders. (@rosor )
    • Support for Floating Origin. (Enable in "Advanced" section of Nature Renderer component)
    Fixed:
    • Fixed issue where erasing detail objects would not work.
    • Fixed issue where detail distance would not load from the Unity terrain settings correctly.
    • Fixed IndexOutOfRangeException when loading detail objects.
    • Fixed flickering issue when using deferred rendering pipeline in combination with 2D grass textures.
    • Fixed issue when moving terrain.
    • Fixed issue where changing shaders in material would reset the properties.
    • Fixed issue where terrain details would not render in build if there is no Global Wind component in the scene.
    • Fixed issue where billboards would not render normal map in built-in render pipeline.
    • Fixed rare “Invalid Quaternion” error.
    • Fixed issue where details would not render in build when targeting OpenGL.
    Changed:
    • Improved placement algorithm to prevent any kind of noticeable pattern from forming.
    • Detail Render Distance can now be increased up to 1,000 when set through script.
    • Default wind is no longer applied to objects in the scene if there is no Global Wind component in the scene to have consistent behavior between the editor and in a build.
    • Improved object fading in the distance.
    Removed:
    • Removed support for per-vertex translucency accuracy due to inconsistent behavior between render pipelines.
     
    Lars-Steenhoff likes this.
  16. Kagami12

    Kagami12

    Joined:
    Aug 9, 2015
    Posts:
    6
    Thank you very much for fixing this issue! I've tried it out in my project and it works great.

    Thank you.
     
  17. PROTOFACTOR_Inc

    PROTOFACTOR_Inc

    Joined:
    Nov 15, 2009
    Posts:
    4,054
    Holy cow! You did add the emission to the shaders. I guess I'm going to unleash some creativity.

    Regarding the placement algorithm, if I update with the latest version of nature renderer, will the grass be re placed without the pattern? I was indeed noticing the pattern effect at some angles.
     
  18. benthroop

    benthroop

    Joined:
    Jan 5, 2007
    Posts:
    262
    Hey Max this all looks great!

    I appreciate how focused your functionality is and how it just works with regular Unity terrain features. The Unity terrain situation for years has been a hodge podge of assets that all had to integrate with each other, which was necessary because the built in terrain was so limited. Now that Unity has been making strides with terrain (and rendering with srp), I appreciate a more limited feature set that does one thing REALLY well. You have hit that mark with Nature Renderer (and soon Shaders). Looking forward to continuing to use it.
     
    Visual-Design-Cafe likes this.
  19. Ultroman

    Ultroman

    Joined:
    Mar 10, 2014
    Posts:
    110
    This is really cool!

    I'm having trouble, though, when trying to hide/show the terrain. Everything rendered by the NatureRenderer script seems to take about half a second to "pop in" when enabling the GameObject with the Terrain and NatureRenderer components on it, while the Terrain pops in instantly. Disabling the NatureRenderer component itself leaves white color being rendered where the plants would be. How do I make the plants show up at the same time that I turn the terrain on? I'd like to instead just flick the "Draw" boolean of the Terrain-component and do something similar for the NatureRenderer, so they aren't completely unloaded.

    Btw, this is for a transition for entering/exiting a house, where we just stop rendering the outside environment.
     
  20. CreatureSurvive

    CreatureSurvive

    Joined:
    May 3, 2014
    Posts:
    17
    I started getting a persistent compute shader error after updating to v1.3.8.54. it breaks procedural instancing in my case.

    Code (CSharp):
    1. Compute shader (Nature Renderer): Property (Instances5) at kernel index (3) is not set
    2. UnityEngine.ComputeShader:Dispatch(Int32, Int32, Int32, Int32)
    3. VisualDesignCafe.Rendering.GpuBatcher`1:AddInstances(BatchAdd[]) (at C:/Visual Design Cafe/Projects/Nature Renderer/Unity/Nature Renderer URP/Assets/Visual Design Cafe/Plugins/com.VisualDesignCafe.NatureRenderer/Runtime/VisualDesignCafe.Rendering/GpuBatcher.cs:304)
    4. VisualDesignCafe.Rendering.GpuBatcher`1:AddInstances(ComputeBuffer, Int32) (at C:/Visual Design Cafe/Projects/Nature Renderer/Unity/Nature Renderer URP/Assets/Visual Design Cafe/Plugins/com.VisualDesignCafe.NatureRenderer/Runtime/VisualDesignCafe.Rendering/GpuBatcher.cs:259)
    5. VisualDesignCafe.Rendering.InstanceIndirectRenderer:Batch(Camera) (at C:/Visual Design Cafe/Projects/Nature Renderer/Unity/Nature Renderer URP/Assets/Visual Design Cafe/Plugins/com.VisualDesignCafe.NatureRenderer/Runtime/VisualDesignCafe.Rendering/InstanceIndirectRenderer.cs:717)
    6. VisualDesignCafe.Rendering.InstanceIndirectRenderer:FinalizeOnMainThread(Camera) (at C:/Visual Design Cafe/Projects/Nature Renderer/Unity/Nature Renderer URP/Assets/Visual Design Cafe/Plugins/com.VisualDesignCafe.NatureRenderer/Runtime/VisualDesignCafe.Rendering/InstanceIndirectRenderer.cs:639)
    7. VisualDesignCafe.Rendering.InstanceIndirectRenderer:Render(Camera, Plane[], Single, Boolean, Int32&, Int32&, Int32&) (at C:/Visual Design Cafe/Projects/Nature Renderer/Unity/Nature Renderer URP/Assets/Visual Design Cafe/Plugins/com.VisualDesignCafe.NatureRenderer/Runtime/VisualDesignCafe.Rendering/InstanceIndirectRenderer.cs:345)
    8. VisualDesignCafe.Rendering.Nature.DetailRenderer:Render(Boolean, Boolean) (at C:/Visual Design Cafe/Projects/Nature Renderer/Unity/Nature Renderer URP/Assets/Visual Design Cafe/Plugins/com.VisualDesignCafe.NatureRenderer/Runtime/VisualDesignCafe.Rendering.Nature/Render/DetailRenderer.cs:360)
    9. VisualDesignCafe.Rendering.Nature.NatureRenderer:Render(Camera) (at C:/Visual Design Cafe/Projects/Nature Renderer/Unity/Nature Renderer URP/Assets/Visual Design Cafe/Plugins/com.VisualDesignCafe.NatureRenderer/Runtime/VisualDesignCafe.Rendering.Nature/NatureRenderer.cs:606)
    10. VisualDesignCafe.Rendering.Nature.NatureRendererSrp:OnBeginFrameRendering(ScriptableRenderContext, Camera[]) (at Assets/Visual Design Cafe/Plugins/com.VisualDesignCafe.NatureRenderer/NatureRenderer.SRP.cs:28)
    11. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
    12.  
    for now I've downgraded, Just a guess that it might be metal specific, or related to unity 2020.1. If you need more info on my setup, its the same one I mentioned in #358
     
  21. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    Yes, the grass will be re-placed automatically. There is no need for you to do anything.
     
    PROTOFACTOR_Inc likes this.
  22. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    You are bringing up a good point. If you disable Nature Renderer (or the game object) then the internal buffers are cleared. So if you activate the object again then all the details will be reloaded and streamed-in, which takes a few frames. I will add a "Draw" boolean for the next update so that you can temporarily disable rendering.

    What you can do in the current version is the following:
    1. Create a new layer in your project. (I'll call it "Outside" in this example)
    2. Set the layer of the terrain game object to "Outside".
    3. Disable rendering of the "outside" layer in the camera culling mask while the player is inside a building.
    disable-nature-renderer-rendering-with-culling-mask.jpg
     
    Ultroman likes this.
  23. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    Thanks for reporting this. I can't reproduce it myself but I have an idea of what might be causing this. I'll make some changes and send you a new build in a few days so that you can give it a try.
     
  24. Ultroman

    Ultroman

    Joined:
    Mar 10, 2014
    Posts:
    110
    Thank you! Such a "Draw" boolean will make it much more flexible to work with, not to mention streamlined.
    And thanks for a good workaround which I don't know how I didn't think of *facepalm*
     
  25. CreatureSurvive

    CreatureSurvive

    Joined:
    May 3, 2014
    Posts:
    17
    Thanks for looking into it, if there are any other details you need just let me know.

    As a side question, is there anyway to choose a version to download with the custom package manager? For instance there was a version between the asset store version and the latest release and it doesn’t seem I can redownload it. Since I was still testing this asset, it didn’t make it into my version control before I ran into this issue with the latest update. So I actually downgraded 2 versions because I couldn’t access the one in between.
     
  26. henmachuca

    henmachuca

    Joined:
    Oct 14, 2016
    Posts:
    105
    Hi everyone!
    I'm looking for a good solution to use in a project with a top down perspective, and I would like to know if this asset would do the trick for that?
    Another thing is that I downloaded the free trial of the asset, but the shadows from the grass are flickering. Is this a known issue? Does it have a work around?

    Thank you.
     
  27. gskinner

    gskinner

    Joined:
    Aug 28, 2014
    Posts:
    43
    The demo scene runs at around 28fps on my GTX780 ww/ Ryzen 3700x. URP in Unity 2019.4.10.

    Is this expected? Test on a 2070 as well and it was around 50fps.
     
  28. CreatureSurvive

    CreatureSurvive

    Joined:
    May 3, 2014
    Posts:
    17
    I can’t answer your question about top down perspective, I believe that is more dependent on the grass shader, and the mesh geometry used.

    As for the flickering shadows, would you happen to be using the 2020.2 beta? I tested that the other day just out of curiosity, and it seems it causes flickering on shadows possibly due to cascading (though I didn’t think to check at the time), anyway running on 2020.1.(6?) and I have no issues with shadows. Though I believe the latest officially supported version is 2019.4.x.
     
  29. henmachuca

    henmachuca

    Joined:
    Oct 14, 2016
    Posts:
    105
    Indeed I started using the LTS version (2019.4.9f1) and the shadow issue seems to be fixed. Let's hope that the developper fix this issue that is happening in later unity versions.
     
  30. henmachuca

    henmachuca

    Joined:
    Oct 14, 2016
    Posts:
    105
    I have another issue.
    I'm using Gaia, and I noticed that when I turn on the Nature Renderer script that goes into the terrain, the grass textures that come standard with gaia becomes weird... almost like the texture was flickering.
    It's hard to see it in a picture, but the further the grass is from the camera, the worst it gets.

    Is this a bug? Or I am unable to use grass textures with the script enabled?

    Thank you
     
  31. amynox

    amynox

    Joined:
    Oct 23, 2016
    Posts:
    178
    Hi,
    NR (last version on store) is causing a crash only on Player Build.

    Basicly the crash happen only after i destroy a spot light (torch)...

    Here is the log :
    Code (CSharp):
    1.  
    2. NullReferenceException
    3.   at (wrapper managed-to-native) UnityEngine.ComputeShader.SetInt(UnityEngine.ComputeShader,int,int)
    4.   at VisualDesignCafe.Rendering.GpuBatcher`1[T].AddInstances (VisualDesignCafe.Rendering.GpuBatcher`1+BatchAdd[T][] batches) [0x00054] in C:\Visual Design Cafe\Projects\Nature Renderer\Unity\Nature Renderer URP\Assets\Visual Design Cafe\Plugins\com.VisualDesignCafe.NatureRenderer\Runtime\VisualDesignCafe.Rendering\GpuBatcher.cs:276
    5.   at VisualDesignCafe.Rendering.GpuBatcher`1[T].EndBatch () [0x00055] in C:\Visual Design Cafe\Projects\Nature Renderer\Unity\Nature Renderer URP\Assets\Visual Design Cafe\Plugins\com.VisualDesignCafe.NatureRenderer\Runtime\VisualDesignCafe.Rendering\GpuBatcher.cs:235
    6.   at VisualDesignCafe.Rendering.InstanceIndirectRenderer.Batch (UnityEngine.Camera camera) [0x000dc] in C:\Visual Design Cafe\Projects\Nature Renderer\Unity\Nature Renderer URP\Assets\Visual Design Cafe\Plugins\com.VisualDesignCafe.NatureRenderer\Runtime\VisualDesignCafe.Rendering\InstanceIndirectRenderer.cs:720
    7.   at VisualDesignCafe.Rendering.InstanceIndirectRenderer.FinalizeOnMainThread (UnityEngine.Camera camera) [0x00076] in C:\Visual Design Cafe\Projects\Nature Renderer\Unity\Nature Renderer URP\Assets\Visual Design Cafe\Plugins\com.VisualDesignCafe.NatureRenderer\Runtime\VisualDesignCafe.Rendering\InstanceIndirectRenderer.cs:639
    8.   at VisualDesignCafe.Rendering.InstanceIndirectRenderer.DispatchComputeShaders (UnityEngine.Camera camera) [0x00029] in C:\Visual Design Cafe\Projects\Nature Renderer\Unity\Nature Renderer URP\Assets\Visual Design Cafe\Plugins\com.VisualDesignCafe.NatureRenderer\Runtime\VisualDesignCafe.Rendering\InstanceIndirectRenderer.cs:227
    9.   at VisualDesignCafe.Rendering.Nature.NatureRenderer.DispatchComputeShaders () [0x000a3] in C:\Visual Design Cafe\Projects\Nature Renderer\Unity\Nature Renderer URP\Assets\Visual Design Cafe\Plugins\com.VisualDesignCafe.NatureRenderer\Runtime\VisualDesignCafe.Rendering.Nature\NatureRenderer.cs:806
    10.   at VisualDesignCafe.Rendering.Nature.NatureRenderer.Update () [0x00001] in C:\Visual Design Cafe\Projects\Nature Renderer\Unity\Nature Renderer URP\Assets\Visual Design Cafe\Plugins\com.VisualDesignCafe.NatureRenderer\Runtime\VisualDesignCafe.Rendering.Nature\NatureRenderer.cs:788
    11. (Filename: C:/Visual Design Cafe/Projects/Nature Renderer/Unity/Nature Renderer URP/Assets/Visual Design Cafe/Plugins/com.VisualDesignCafe.NatureRenderer/Runtime/VisualDesignCafe.Rendering/GpuBatcher.cs Line: 276)
    Unity 2020.1.6f and URP 8.2

    thanks for your help
     
  32. amynox

    amynox

    Joined:
    Oct 23, 2016
    Posts:
    178
    I'm experiencing the same issue (shadow flickering) on Unity 2020.1.6f and URP 8.2. The asset desciprtion was mentionning that is compatible with Universal RP 7.0+ · Unity 2019.3+ so i was expecting it to just work in Unity 2020.1 (as its not a beta)
     
  33. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    Downloading a specific version is not possible at the moment. I am spending most of my time on Nature Renderer itself, so the package manager is still very basic. But you can always send me an email (with your invoice number), and then I'll send you a specific version.
     
  34. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    It should work fine for a top-down perspective. I do recommend to use your own grass meshes instead of the quads that come with Nature Renderer, quads don't look that great from a top-down perspective.

    Can you share a screenshot/video of the flickering issue? I am not aware of any shadow related issues so I am not sure what kind of flickering it is.

    I have seen this before and I believe it was because of a rendering path mismatch, or a texture setting.
    Can you try the following:
    - Select your camera and change the Rendering Path to "forward"
    - Select the texture and ensure that the Filter Mode is set to Bilinear or Trilinear.
    - Ensure that Generate Mip Maps is enabled as well.
    - Increasing the Aniso Level of the texture should also help.
     
  35. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    Thank you for reporting this. I am looking into this and trying to reproduce the issue, but no luck so far. Does this happen consistently?

    2020.1 + URP 8.2 is fully supported and should work fine. Can you share a screenshot/video of the shadow flickering issue? It is not an issue that I am aware of, and I have never seen it before, so I am not quite sure what kind of flickering is happening.
     
  36. CreatureSurvive

    CreatureSurvive

    Joined:
    May 3, 2014
    Posts:
    17
    Thats no problem, happy to see Nature Renderer takes priority. It's not crucial for me, so I will wait for the update.

    I was under the impression that the shadow flickering only affected 2020.2b so I didn't bother to report it myself, but seeing as others reported it on 2020.1.6f here is a video of the issue. I am on 2020.1.6f myself and I don't experience the issue, only in 2020.2b is it present for me. The only way I was able to resolve the flickering was by disabling procedural instancing. At first I thought it was due to shadow cascades, but that doesn't have any affect on the flickering.
     
  37. amynox

    amynox

    Joined:
    Oct 23, 2016
    Posts:
    178
    Yes it happen everytime ! Important note : it happen only in a build NEVER in Editor !

    Basicly:
    1) i light up my torch
    2) desotry the torch with Point light (+Oclussion Camera that occlude "volumetric shadow" - I'm using Volumetric Lights -https://assetstore.unity.com/packages/vfx/shaders/volumetric-lights-164149 -)
    3) the whole game crash !
    4) When looking at the crash log it has to do with NR...

    I'm sorry i would love to give more indepth feedback but it's really hard to debug without the code source + that the issue is only happening on the build !
     
  38. JRRReynolds

    JRRReynolds

    Joined:
    Oct 29, 2014
    Posts:
    192
    Have you tried having a test scene with only 1 camera, a normal point light, and NR and then having the point light deleting itself after a few seconds to see if it crashes. A lot of times assets don't play nicely with others. I can say that's probably especially true with something as integrated as detail rendering and culling. The volumetric lights may be problematic when working with NR. I know was having a problem with an anti-aliasing solution and NR so I just had to forego using that specific anti-aliasing.

    While I agree in general and on principle that source code should be included with every asset, some developers chose not to for obvious business reasons. It would be unfair to demand source code just because 2 assets aren't playing nicely with each other. Unless the developer has that specific asset you are talking about and can reproduce the issue, you may just have to pick one or the other.

    Also you may want to paste the exact line that involved NR in the crash log to help, maybe the author has an idea as to what is causing it instead of just stating it had to do with NR. Another possibility would be to reach out to the author directly and see if you can send them your project for debugging.

    I really do hope the author decides to share source code some day but as long as he or she is active on the forums it's not really a big deal. The problem usually comes up is that later down the line an author stops updating the asset and then the community is unable to do minor fixes or version updates without the code. Hopefully it won't happen here because from what I can see it's an excellent product.
     
  39. amynox

    amynox

    Joined:
    Oct 23, 2016
    Posts:
    178
    Thanks for your adivces. i already sent the log to the author. It seems like NR is not doing a null check or something similar (please see my previous post)

    @Visual-Design-Cafe please dont hesitate to ask if you need something that can help you debug/fix the issue.

    Thanks
     
  40. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    Nature Renderer version 1.3.9 is now available through the built-in updater, and will be on the Asset Store within the next few days. Go to Help > Nature Renderer > Check for Updates to download the update.

    New
    • Added “Draw” property to Nature Renderer component to enable/disable rendering. (@Ultroman )

    Fixed
    • Fixed compatibility with WebGL.
    • Fixed error “Nature Renderer (compute shader) Property (Instances) at kernel index (x) is not set.”
    • Fixed NullReferenceException that could occasionally happen when removing a camera.
    • Fixed “Missing _MainTex property” error in shaders.
    • Fixed shader compile error when using Nature Shaders Master node in a new shader graph.
    • Fixed issue where objects would be invisible when there are no wind settings in the scene, in Universal and High-Definition render pipelines.
     
    Ultroman, amynox and hopeful like this.
  41. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    This is most likely the cause of the crash. If the point light uses an extra camera, then Nature Renderer will most likely initialize for that camera as well. If the camera is suddenly deleted then it might cause this issue.

    I found that it is possible that Nature Renderer still updates once after the renderer for the camera is disposed. This should be fixed in the latest update (1.3.9) that I just published. Although, I can't guarantee that the crash is fixed as well.
    Can you download the update and give it a try?

    If it still crashes, then could try a build without the volumetric light in it? That should help me verify if the volumetric light camera is indeed the cause.
     
  42. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    Thanks for the video, that helps a lot to identify the problem.
    I am looking into it, but so far I can't reproduce this in any way. It is most likely a combination of specific project settings. Is it possible for you to share that scene with the project settings so that I can debug it?

    @amynox Do you perhaps have a scene/test project that you could share with me so that I can reproduce the shadow flickering issue?
     
  43. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    It sounds a bit low, but it depends on your project settings as well. It is common for the Unity editor to run everything on the highest possible graphics settings, which can slow things down a lot. The demo scene also has every possible graphics option enabled, so that scene does not necessarily have the best performance.

    You can check the profiler to see if there are any specific bottlenecks that are causing performance problems. If you have a very consistent and stable framerate then it is most likely the rendering time of the shaders that is causing most of the performance impact.

    As a reference, my laptop with a GTX 1060 is running the demo scene at 60+ fps in the editor (full-screen):
    Edit: Not sure why "opaque" is not showing up in the GPU profiler there (it should). Unity may be putting it in the wrong category.
    nature-renderer-urp-demo-scene-performance-in-editor.jpg
     
  44. Migueljb

    Migueljb

    Joined:
    Feb 27, 2008
    Posts:
    562
    How do I set the Detail Distance to whatever number I need it to be say 500 to 1000? I understand performance wise what will happen but I am rendering 360 videos so I need distance to be farther for the renders. Also when I put that number to say 500 or 1000 I'm assuming shadow distance and procedural instancing need to be somewhat matched so the look matches up so to speak. Any direction or info how to achieve this would be great.
     
  45. CreatureSurvive

    CreatureSurvive

    Joined:
    May 3, 2014
    Posts:
    17

    I can’t share that specific scene unfortunately due to paid assets, but I will see if I can reproduce this in a scene without paid assets and send you a package. I should hopefully have time to get to that this evening.
     
    Visual-Design-Cafe likes this.
  46. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    You can set the values directly on the Nature Renderer component through script:
    Code (CSharp):
    1. GetComponent<VisualDesignCafe.Rendering.Nature.NatureRenderer>()
    The following properties should be useful for you:
    • The rendering distance for the detail objects (max is 1000, even when set through script):
      float DetailDistance

    • The start (x) and end (y) distance at which to reduce the density of the grass.
      These values are the same as in the inspector:
      Vector2 ReduceDensityDistance

    • How much the density should be reduced. (Same as in the inspector):
      float ReduceDensityAmount

    • The shadow distance for detail objects:
      float ShadowDistance
     
  47. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    @Visual-Design-Cafe , Does Nature Renderer play nicely at all with GPU Instancer? Could I run both at the same time with NR doing GPU instancing and occlusion culling etc for grass, vegetation, trees, terrain detail etc but GPUI doing buildings and other GameObjects/Objects on the terrain? Would I want to? In the alternative, can NR do GPU instancing and occ culling on other objects in scene like buildings too?
     
  48. amynox

    amynox

    Joined:
    Oct 23, 2016
    Posts:
    178
    Hi @Visual-Design-Cafe,
    I've installed the last version of Nature Render on the store.

    NR still crash the game when i suddnely destroy the spot light+camera.

    Here is the new error log :
    Code (CSharp):
    1. Uploading Crash Report
    2. NullReferenceException: Compute Shader was disposed or not loaded
    3.   at VisualDesignCafe.Rendering.GpuBatcher`1[T].AddInstances (VisualDesignCafe.Rendering.GpuBatcher`1+BatchAdd[T][] batches) [0x00306] in C:\Visual Design Cafe\Projects\Nature Renderer\Unity\Nature Renderer URP\Assets\Visual Design Cafe\Plugins\com.VisualDesignCafe.NatureRenderer\Runtime\VisualDesignCafe.Rendering\GpuBatcher.cs:332
    4.   at VisualDesignCafe.Rendering.GpuBatcher`1[T].EndBatch () [0x0006c] in C:\Visual Design Cafe\Projects\Nature Renderer\Unity\Nature Renderer URP\Assets\Visual Design Cafe\Plugins\com.VisualDesignCafe.NatureRenderer\Runtime\VisualDesignCafe.Rendering\GpuBatcher.cs:243
    5.   at VisualDesignCafe.Rendering.InstanceIndirectRenderer.Batch (UnityEngine.Camera camera) [0x000dc] in C:\Visual Design Cafe\Projects\Nature Renderer\Unity\Nature Renderer URP\Assets\Visual Design Cafe\Plugins\com.VisualDesignCafe.NatureRenderer\Runtime\VisualDesignCafe.Rendering\InstanceIndirectRenderer.cs:723
    6.   at VisualDesignCafe.Rendering.InstanceIndirectRenderer.FinalizeOnMainThread (UnityEngine.Camera camera) [0x00076] in C:\Visual Design Cafe\Projects\Nature Renderer\Unity\Nature Renderer URP\Assets\Visual Design Cafe\Plugins\com.VisualDesignCafe.NatureRenderer\Runtime\VisualDesignCafe.Rendering\InstanceIndirectRenderer.cs:642
    7.   at VisualDesignCafe.Rendering.InstanceIndirectRenderer.DispatchComputeShaders (UnityEngine.Camera camera) [0x00035] in C:\Visual Design Cafe\Projects\Nature Renderer\Unity\Nature Renderer URP\Assets\Visual Design Cafe\Plugins\com.VisualDesignCafe.NatureRenderer\Runtime\VisualDesignCafe.Rendering\InstanceIndirectRenderer.cs:230
    8.   at VisualDesignCafe.Rendering.Nature.NatureRenderer.DispatchComputeShaders () [0x000a3] in C:\Visual Design Cafe\Projects\Nature Renderer\Unity\Nature Renderer URP\Assets\Visual Design Cafe\Plugins\com.VisualDesignCafe.NatureRenderer\Runtime\VisualDesignCafe.Rendering.Nature\NatureRenderer.cs:821
    9.   at VisualDesignCafe.Rendering.Nature.NatureRenderer.FixedUpdate () [0x00001] in C:\Visual Design Cafe\Projects\Nature Renderer\Unity\Nature Renderer URP\Assets\Visual Design Cafe\Plugins\com.VisualDesignCafe.NatureRenderer\Runtime\VisualDesignCafe.Rendering.Nature\NatureRenderer.cs:798
    10. (Filename: C:/Visual Design Cafe/Projects/Nature Renderer/Unity/Nature Renderer URP/Assets/Visual Design Cafe/Plugins/com.VisualDesignCafe.NatureRenderer/Runtime/VisualDesignCafe.Rendering/GpuBatcher.cs Line: 332)
    PS: concerning the shadow flickering i will send you a demo scene in PM ...

    Thanks for your help
     
  49. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    You should be able to run both at the same time. They are completely different systems so they should not interfere with each other. I have not specifically tested it though.
    Adding support for other objects in the scene is on the long-term roadmap. But I do not expect it to be supported any time soon.
     
    Duffer123 likes this.
  50. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215