Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

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. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    Version 1.3.10 of Nature Renderer 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 latest version.

    Fixed:
    • Fixed “compute shader is disposed or not loaded” exception.
    • Fixed compatibility with PS4.
    Changed:
    • Density is now reduced correctly when setting the density of the terrain lower than the density (target strength) that was used when placing detail objects. This matches the behavior of the Unity terrain in Unity 2019+, instead of the old behavior of Unity 2018.4 LTS.
     
  2. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    The exception has been fixed in the latest update. It was caused by Unity unloading the compute shader.
    However, I still have not been able to reproduce the crash/error that you described. I tried with a point light and an additional camera in a build, but everything works fine.

    Can you try the following to verify that this crash is indeed caused by Nature Renderer?
    • Try building with the point light and Nature Renderer, but without the volumetric light
    • Try building with the volumetric point light, but without Nature Renderer.
     
  3. Natalynn

    Natalynn

    Joined:
    Apr 21, 2013
    Posts:
    197
    Can you use multiple Nature Renderers or will it conflict or cause issues? For example in the unity terrain stitching. I tried this, and seems like it loads very slowly.
     
  4. Slaghton

    Slaghton

    Joined:
    Sep 9, 2013
    Posts:
    139
    Would adding the feature of having grass scale when two terrain textures intersect be possible in the future?


    I'm using around 49 terrains with a handful using nature renderer atm (2018.4 standard rp) with normal fps.
     
  5. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    Yes, Nature Renderer works fine with multiple terrains. Having multiple smaller terrains should have better performance than a single large one, so it is strange if it loads slowly for you. What exactly is loading slowly?
     
  6. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    I am working on adding more controls for grass placement, so this should be possible in a future version.
     
  7. vlastan

    vlastan

    Joined:
    Nov 15, 2015
    Posts:
    44
    Any news regarding tree instancing ? :)
     
  8. Monil

    Monil

    Joined:
    Apr 24, 2012
    Posts:
    101
    Hi,

    any news regarding vegetation interaction ?
     
  9. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    It is still on the roadmap and I am working towards it, with small internal changes in each update so far. But Unity made some major changes to Shader Graph in the latest versions that are in preview, so I have to redirect quite a bit of my attention to fix shader compatibility first.
     
  10. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    It is done and ready for release in early access. I was planning to have it published already, but I have been in bed with a heavy fever for a week now, so I haven't been able to push the "publish" button yet. It should be available later this week.
     
    Monil likes this.
  11. Robosaru

    Robosaru

    Joined:
    Mar 31, 2013
    Posts:
    9
    Does Nature Renderer work with HDRP 9 (Unity 2020.1) or HDRP 10 (Unity 2020.2)?
     
  12. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    No, not yet. We are working on compatibility for those versions but it may take a while. Unity made some major changes to Shader Graph that remove support for a lot of our features.
     
  13. lukasynthetic

    lukasynthetic

    Joined:
    May 20, 2020
    Posts:
    28
    Hello, I'm using Nature Renderer with Synty Studios Nature pack(on Mac). I get a warning that custom shader cannot do procedural instancing. So I followed the guide: I edited the shader used by plants, adding provided information. But cannot see any difference - still getting the same warning. I added the tag, both #pragma and reference.
    The shader was made using Amplify Shader Editor (as seen in header). I do own ASE but don't know how to use it yet . Any help would be greatly appreciated.
    There is a significant delay showing grass after pressing play.
    Should I paste the code here?
    Thanks
     
  14. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    I just replied to your email, please take a look. (I am assuming that email was from you, since it was the exact same question. If the email was not you then please upload the shader here and I'll take a look at it for you).
     
  15. vlastan

    vlastan

    Joined:
    Nov 15, 2015
    Posts:
    44
    @Visual-Design-Cafe Does Nature Renderer's shaders use Geometry shaders to simulate wind effect?
    I am using GPU Instancer and trees do lose the wind animation once they get instantiated.
    upload_2020-10-23_20-23-17.png
     
  16. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    The shaders do not use any geometry shaders. Only simple vertex shaders, which should work everywhere.
    Most likely it is because the shaders are set up to use Nature Renderer by default, so they do not work with GPU Instancer out of the box.
    The best workaround I can think of is to open the Tree Leaves, Tree Bark, and Tree Billboard shaders and change the following code:
    Code (CSharp):
    1. #pragma multi_compile_instancing
    2. #pragma instancing_options procedural:SetupNatureRenderer
    3. #pragma target 4.0
    4. #pragma multi_compile_fog
    to
    Code (CSharp):
    1. #pragma multi_compile_instancing
    2. // #pragma instancing_options procedural:SetupNatureRenderer
    3. #define NODE_NATURE_RENDERER_INCLUDED
    4. #pragma target 4.0
    5. #pragma multi_compile_fog
    That should disable the Nature Renderer integration.
    You may also have to change the shaders to support GPU Instancer, based on GPU Instancer's documentation.
     
  17. lukasynthetic

    lukasynthetic

    Joined:
    May 20, 2020
    Posts:
    28
    Yes it was me ☺️. Thanks for reply. I tried on new project and it did work. I also had to change the LOD shader as well as some of the vegetation was using it. Thanks a lot for your help!
     
  18. Ultroman

    Ultroman

    Joined:
    Mar 10, 2014
    Posts:
    110
    Would it be possible to enable us to "pre-warm" the internal buffers while the Nature Renderer has Draw disabled? If I start inside my house and go outside, it still takes those frames to buffer, despite Nature Renderer being enabled, because it has never had even a single frame with Draw enabled yet. I'd really love to NOT have to write some code to edit culling masks or use an entire layer to solve this (I already use more layers than I'd like). It'd be super-nice to be able to call a function on the Nature Renderer instance I want to have prepared when I load the game.
     
  19. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    You should be able to call Stream( camera ) on the Nature Renderer component, and pass your main camera to it. That will stream-in the data for that camera, even if drawing is disabled. (Make sure to call it every frame, while rendering is disabled)
    I have not specifically tested this, but it should work. I'll double-check it for you later today when I am back in the office.
     
    Ultroman likes this.
  20. Ultroman

    Ultroman

    Joined:
    Mar 10, 2014
    Posts:
    110
    Thanks a whole heap! Seems to be working :D
     
    Visual-Design-Cafe likes this.
  21. Terminus001

    Terminus001

    Joined:
    Nov 1, 2015
    Posts:
    121
  22. sasob8

    sasob8

    Joined:
    Jul 11, 2017
    Posts:
    25
    Hi, i had 2 issues, solved 1, and now only one remains :)

    1. When using URP/Nature shaders/Grass i get an error in console:
    "Material doesn't have a texture property '_MainTex'

    My setup: Windows, Unity 2020.1.10, URP, MapMagic

    Thank you!
     
    Last edited: Nov 3, 2020
  23. Gargarel

    Gargarel

    Joined:
    Nov 3, 2020
    Posts:
    1
    Hello, could you please add an option to disable the package manager auto functionality? Having it popup every day to let me know that I should update or that I'm up to date is an annoyance I could really do without.
     
  24. MrCool92

    MrCool92

    Joined:
    Jul 13, 2015
    Posts:
    26
    upload_2020-11-4_11-11-1.png

    Produces GC every frame in the editor. EditorUserBuildSettings type can be cached...
     
  25. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    This is most likely the specular reflection of the material.

    Based on your screenshot I am assuming that you added a 2D Grass Texture (and not a prefab) for the grass. When using only a grass texture, a default mesh and material is created. The default mesh uses normals that are pointing up, and the default material has a smoothness value of 0.15 which shows a bit of specular reflection. The combination of those two will result in this effect.

    What you can do is:
    1. Create a new material in your project, and select the "HDRP/Nature Shaders/Grass shader" for it.
    2. Assign this new material to the Material Override field in the Nature Renderer component. This will ensure that the material is used for all 2D Grass Textures.
    3. Set the "Glossiness" value of the material to 0. Setting the value to 0 will remove most of this effect.
    You will still see a bit of a highlight. This highlight is part of the lighting model of HDRP, and still shows because the normals of the mesh are pointing up. To "fix" this you will need a custom mesh with normals that are pointing forward.

    If you do not have any 3D model for grass and you have no experience with creating 3D models then feel free to let me know. I can create a simple grass model for you and send it.
     
    Terminus001 likes this.
  26. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    You should be able to safely ignore this error. It is caused by an internal bug in Unity and should not have any effect on your project.

    If having this error in your console is causing any kind of problem with your build pipeline or project then please let me know and I can send you a modified version of the shader to hide this error.
     
  27. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    I'll see if I can add it for the next update.
    It shouldn't pop up every day though, so there might be an update stuck in the queue.
    You can delete the file "Library/com.VisualDesignCafe.PackageManager.queue-install.json" to clear the queue. That should usually get rid of the popup. (The "Library" folder is in your project root, and not within the Assets folder)
     
  28. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    You are right, thank you for pointing this out. Looks like I missed caching one type. I'll fix it for the next update.
    It only happens in the editor though, so it should not have any impact on the performance in a build.
     
    hopeful likes this.
  29. Vad3rInHale

    Vad3rInHale

    Joined:
    Apr 19, 2015
    Posts:
    96
    I just upgraded Nature Renderer from sub 1.3 version, for additional performance improvements, and where I was using 'custom provided' light probes - but I can't seem to get this to work again in the new version (I read you can't do procedural instancing and light probes, but I'd like to do the old CPU way). Have you checked this recently or have it working? Thanks :)
     
    Last edited: Nov 5, 2020
  30. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    I just double checked it for you, and the light probes system is forced to be disabled in the 1.3.x updates. The system is still fully functional though, and it was just the setting that was not converted correctly from 1.2.x to 1.3.x. I'll enable the system again for the next update, which should be available after the weekend.
     
    Vad3rInHale likes this.
  31. MrCool92

    MrCool92

    Joined:
    Jul 13, 2015
    Posts:
    26
    More GC in build. This is with deep profile enabled.

    upload_2020-11-5_14-34-58.png
     

    Attached Files:

  32. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    Nature Renderer version 1.3.11 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 it.

    New:
    • An error is now shown in the Nature Renderer component if one of the shaders used by detail objects has a shader compile error.
    • It is now possible to choose how mesh normals for 2D grass textures are generated (either pointing up or double-sided). (@AndorfTheWhite Using double-sided normals should fix the lighting issue that you were having)
    • Nature Shaders: It is now possible to completely disable Wind and Translucency. This improves performance if the features are unused.
    • Nature Shaders: It is now possible to flip normals for backfaces.
    • Nature Shaders: Recalculating normals with wind animations can now be controlled with the “Recalculate Normals” field.
    Fixed:
    • Fixed ThreadAbortException that could occasionally happen when editing.
    • Fixed issue where distance culling would not work correctly when using third-party shaders and caused objects to pop-in in chunks.
    • Fixed light probe sampling. (@vanhalen17 )
    • Fixed GC allocations for a few internal properties. (@MrCool92 both have been fixed. Thank you for reporting them.)
    Changed:
    • Streaming settings can now be changed through code.
    • Nature Shaders: Renamed “Vertex” wind control method to “Automatic”.
    • Nature Shaders: Moved “Object Height” and “Object Radius” fields to below the Wind Control field.
    • Nature Shaders: Moved “Fade Out” to transparency section, and “Fade Out Wind” to wind section.
    • Nature Shaders: Reduced the total number of shader variants used by the shaders to improve import and build time.
    Removed:
    • Nature Shaders: Removed “UV” wind control method.
     
  33. Terminus001

    Terminus001

    Joined:
    Nov 1, 2015
    Posts:
    121

    Thanks a lot, this does the trick!
    No need for you to make a grass 3D model, thanks anyway

    I'll try using the functionality in the new update :)
     
    Visual-Design-Cafe likes this.
  34. MrCool92

    MrCool92

    Joined:
    Jul 13, 2015
    Posts:
    26
    thanks for the update!

    I am still having some GC allocs..

    when I get near the terrain
    upload_2020-11-9_14-18-5.png
    and when I fly around the terrain from time to time
    upload_2020-11-9_14-9-15.png
     
    razamgar likes this.
  35. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    These ones are expected and are by design. If you move around the terrain then new details get streamed-in and placed. If the new details don't fit in the existing internal memory pool then the pool is expanded and some new memory is allocated. This memory pool is managed by Nature Renderer, and is not released by the Garbage Collector, so it should not have any impact on performance for your project.
     
  36. MatkoSimecki

    MatkoSimecki

    Joined:
    Aug 14, 2020
    Posts:
    6
    Hello,
    I am using The Vegetation Engine in conjunction with Nature renderer and I have a couple of questions regarding the asset and how it works in a bigger scene(1500x1500 in my example). (Open world)

    So, the first issue is, that I am getting over 700mb of pooled memory and a stuttery scene when I try to fly around the scene at a higher speed. (It's the same in the built version of the project.) This might be connected to what MrCool92 said.
    The second issue is that when I try to paint the Grass mesh (that has been converted by TVE asset) on terrain, I get this strange artifact where I don't see anything painted on the terrain, only one mesh that is enlarged and is sitting on top of the view camera. (1. Picture)This has been an issue from before and might be connected to material or something different. Keep in mind that I tried to paint the same converted mesh on a different project and there it works.

    My questions are.

    What setup or changes do I need to do in regard to the first issue. Is it normal that when you fly around fast in a game you load chunks faster and the result is low frame rates or stutters until it loads the chunks? Is it possible to preallocate pooled memory?

    Are TVE assets compatible with that in situations like an open world where you have to draw more than 20 different details on a terrain?

    How big of terrain does this asset support and how complex this terrain can be in regards to the number of different details (or trees)?

    The terrain has also Microsplat on it, does that affect it in any way?

    Lastly, can this support multiple terrains being loaded without having any frame drops, lets say, that it works the same stable way as one big terrain?

    This large frame rate drop wasn't an issue in the older version of Nature Renderer. It only occurred after updating it and updating TVE.
     

    Attached Files:

  37. Muravu

    Muravu

    Joined:
    Nov 30, 2014
    Posts:
    53

    I would like to know this as well.
     
  38. razamgar

    razamgar

    Joined:
    Apr 7, 2020
    Posts:
    14
    +1 on this one. It is an issue which seems to have affected us as well. Hope @Visual-Design-Cafe chimes in.
     
    Last edited: Nov 12, 2020
  39. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    When flying around the terrain Nature Renderer streams-in new detail objects. How fast they are loaded and the impact on performance depends on your terrain. The more detail objects you have, the longer it takes to load, and the bigger impact on performance you will get. And the faster you move around, the faster detail objects need to be loaded (thus, causing stuttering if too much needs to be loaded at once).

    What you can do to improve this:
    1. Disable streaming so that all detail objects are loaded at startup. (Only suitable for small terrains since it takes a lot of memory.)
    2. Open the "Streaming" section and reduce the Stream Processor Limit. This will reduce the amount of processors that are used to stream-in data. Note that this will increase the overall load time, but reduces stuttering. You should only do this if the details are loading in fast enough, and stuttering is the only problem.
    3. The best solution is to reduce the total number of objects on the terrain. And the best way to achieve this is by editing your meshes and merging individual grass objects (left in screenshot below) into a grass patch (right in screenshot).
      This will reduce the total number of objects while keeping the same density. Just merging 3 or 4 objects into a small patch will already speed up loading by 3 to 4 times (and reduce memory usage by 3 to 4 times).
      I can recommend this for everyone, even if you don't have specific performance issues. Because it is just a great way to speed things up.
      merged-meshes-into-grass-patch.jpg
    Yes, TVE assets are compatible. But it is not guaranteed that all features are working perfectly. It depends on the developer of TVE if everything is implemented.
    If you have any issues then I recommend to temporarily change the shader to "Nature Shaders/Grass" to check if it is a compatibility issue. If the Nature Shaders/Grass is working, then it is a TVE-specific issue. If it also doesn't work with "Nature Shaders/Grass" then it is a bug in Nature Renderer (please report it if this is the case).

    The recommended maximum size of a single terrain is 4096x4096. There is no limit on how many terrains you can have, and no limit on the amount of different detail objects/trees. The main concern will be memory usage, so it is best to keep an eye on the memory and find a good balance between memory usage and total number of different objects.

    No, that should have no influence.

    Yes, multiple terrains is recommended and is usually faster than one big terrain. Having multiple terrains usually saves a lot of memory usage.

    Which specific version were you using before? I don't recall changing anything that affects the frame rate this much, but I'll double check the change logs for you.


    (Edit: @sylcc @Muravu Just tagging you as well so you get a notification)
     
    Muravu and razamgar like this.
  40. BOXOPHOBIC

    BOXOPHOBIC

    Joined:
    Jul 17, 2015
    Posts:
    505
    Hey, there a forum for nature Renderer. I wonder how did I miss it :|

    @MatkoSimecki Hi, I'm Cristi, the TVE dev. I just checked NR + TVE + HDRP + 2020.1.12 and on my end, I have roughly the same framerate. Could you share your render pipeline, unity version, platform, etc?

    NR
    Capture.PNG

    TVE
    upload_2020-11-12_15-30-50.png

    Cheers!
     
    Lars-Steenhoff likes this.
  41. MatkoSimecki

    MatkoSimecki

    Joined:
    Aug 14, 2020
    Posts:
    6
    Thank you very much for these detailed answers. :)

    Regarding which version, I think I've narrowed it down to the latest TVE update 2.0.0.
    Might be something wrong there. (talking about the issue on the picture).
    Edit: I've talked to the guy responsible for the asset and he says it works normally for him.

    Version without spikes was 1.3.4
     
  42. MatkoSimecki

    MatkoSimecki

    Joined:
    Aug 14, 2020
    Posts:
    6
    LTS 2019.4.14f1
    upload_2020-11-12_14-52-4.png
    upload_2020-11-12_14-52-22.png
     

    Attached Files:

    Last edited: Nov 12, 2020
  43. BOXOPHOBIC

    BOXOPHOBIC

    Joined:
    Jul 17, 2015
    Posts:
    505
  44. MatkoSimecki

    MatkoSimecki

    Joined:
    Aug 14, 2020
    Posts:
    6
    So I've gone back to the older version of NR that was 1.3.4 and it seems to work normally there, no huge lag spikes or anything. The setup is the same as with the latest version.
    Doesn't matter how fast I go with the camera around the scene, framerate stays the same. As soon as I go back to the latest version, it starts stuttering.
    I am guessing you've changed something up until the latest version that is affecting that since I've tried every other way of fixing it which had no positive result.

    upload_2020-11-17_9-59-11.png
    This is the setup (same on 1.3.11, haven't touched anything except for updating the asset)

    I am probably gonna use the older version for now until something is figured out from this.
     
    razamgar likes this.
  45. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    Nature Renderer version 1.3.12 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 it.

    New:
    • A default mesh for a grass patch is now included.
      This mesh is included as a prefab called "Default Grass Patch". You can use the mesh to create your own prefab and material to set up your grass. This is great as an alternative for 2D grass textures, as the mesh is much more performant and allows for more precise tweaking.
    Fixed:
    • Fixed parsing error in HDRP when using 2D grass textures on a device that uses system settings with number formats that differ from English.
    • Fixed issue in Shader Graphs where normal would incorrectly output in Object Space instead of Tangent Space.
    • Fixed error “Material does not have a texture property _MainTex”.
    Changed:
    • Updated documentation links.
     
    Lars-Steenhoff likes this.
  46. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    Thank you for the details. I am looking through the logs for you to see what changes there have been, and I am running tests to compare the performance between the versions. I'll get back to you once I have a definitive answer (it may take a while).
     
    Muravu likes this.
  47. Muravu

    Muravu

    Joined:
    Nov 30, 2014
    Posts:
    53
    Looking forward to it, older version fixed the issue for us as well.
     
  48. Noogy

    Noogy

    Joined:
    May 18, 2014
    Posts:
    132
    Hello @Visual-Design-Cafe, I'm very interested in Nature Renderer. Does it only work with Unity terrains? Is there any support for mesh objects? Thanks!
     
  49. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    Thank you for your interest! Nature Renderer only works with terrains, as it relies on Unity's terrain data. There is no support for mesh objects at the moment, and it is not on the roadmap for the foreseeable future.
     
    Noogy likes this.
  50. masterche18

    masterche18

    Joined:
    Oct 25, 2020
    Posts:
    1
    I have a question would this support procedural generation of environments or levels?