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. mtGameDev

    mtGameDev

    Joined:
    Oct 19, 2012
    Posts:
    89
    is it possible to use Natural Renderer beside Vegetation Studio ?
    Does Natural Renderer optimize a terrain that is made with vegetation studio ?
     
  2. Bwacky

    Bwacky

    Joined:
    Nov 2, 2016
    Posts:
    209
    Nature Renderer is more of an alternative to Vegetation Studio for rendering. In URP/HDRP your best bet is NR.
    Using them together makes little sense, NR currently optimizes grass and tree support is coming soon. The only thing VS has majorly going for it compared to NR is rule-based vegetation placement, which to my knowledge will also someday come to NR. Just a matter of patience
    +1, randomization for XYZ in trees would be amazing, even more so being able to rotate them on our own after spawning but that's probably a lot of work to get going.
     
    kenncann likes this.
  3. Wolfos

    Wolfos

    Joined:
    Mar 17, 2011
    Posts:
    951
    You can still use good old TerrainEdge for rule-based detail placement, in combination with Nature Renderer.
     
  4. Vad3rInHale

    Vad3rInHale

    Joined:
    Apr 19, 2015
    Posts:
    96
    It seems like Nature Renderer is overriding the render queue in my painted Details, setting it to ~2500

    Is there any way to not have it set this?
     
  5. jack_benton

    jack_benton

    Joined:
    Dec 18, 2016
    Posts:
    3
    Hi there, I'm using HDRP shaders and the grass don't render in the Camera view, only grass shadows are visible.
    But they render fine in the Editor view. I checked the demo scene and it's the same.

    I'm using Unity 2019.3 and HDRP 7.1.8.
     
  6. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    No, that won't be possible. Nature Renderer would replace Vegetation Studio in this case. Vegetation Studio uses its own rendering system and does not make its data available to other rendering systems, so we can't support it.

    As @Black-Abyss said, we are working on tree rendering and rule-based placement as well.
     
    Bwacky likes this.
  7. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    I'll add it to the list of things to look into. Technically speaking it would be possible, but it would require custom UI and tools since Unity's terrain tools do not support it.
     
    Bwacky and Lars-Steenhoff like this.
  8. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    I looked into it for you and it is indeed always overridden to 2500. It is usually the most efficient for alpha testing to render the detail objects with this render queue, but I can add an option for you to use a custom render queue. I'll add it and send you a custom build later this week.
     
    JmprDev likes this.
  9. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    This is a known issue in that specific version of HDRP. There is unfortunately nothing that I can do to fix it, and the only fix is to update to a higher HDRP version. Unity 2019.3 with HDRP 7.3.1 should work fine.
     
  10. Wolfos

    Wolfos

    Joined:
    Mar 17, 2011
    Posts:
    951
    Sorry, didn't spot this one.
    Random Y rotation would already be a great improvement to increase (perceived) variation in trees. Being able to rotate them ourselves would also be useful in some situations, but not what I'd call a requirement.

    The rotation would have to be deterministic somehow. Can't have it be different in a build. That might mess up things.
     
    hopeful likes this.
  11. Bwacky

    Bwacky

    Joined:
    Nov 2, 2016
    Posts:
    209
    In some scenes, on some terrains - while my trees work perfectly fine, the grass sometimes just floats above my scene view camera. Any ideas what could be causing that? Screenshot to show what I mean. I don't know how I actually cause it or why it pops up.

     
  12. Wolfos

    Wolfos

    Joined:
    Mar 17, 2011
    Posts:
    951
    What shader are you using for the grass?
     
  13. Bwacky

    Bwacky

    Joined:
    Nov 2, 2016
    Posts:
    209
    Problem fixed thanks to you - updated Boxophobic Vegetation Engine and had to reinstall the Nature Renderer support for it. That explains why it seems to happen at random - I randomly update my assets once every few weeks.
     
    dinhvix and Visual-Design-Cafe like this.
  14. Vad3rInHale

    Vad3rInHale

    Joined:
    Apr 19, 2015
    Posts:
    96
    Would appreciate that! I've got some large bushes that need to be rendering behind my transparent effects :)
     
  15. hepphep

    hepphep

    Joined:
    Feb 1, 2013
    Posts:
    24
    Hi!

    Is it currently possible to get HDRP decals to be rendered on nature renderer plants? If I remember correctly, it used to work in some earlier version, but cannot find a way to enable it now
     
  16. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    I have a fix ready for you. Could you send an email to support@visualdesigncafe.com with the render pipeline that you are using? Then I'll send you a download link.
     
  17. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    I double checked it for you and it is not possible at the moment. The code for that needs to be added to the shaders, I am looking into it for you to see how much work that would be. If it is doable then I'll add it for the next update.
     
  18. hepphep

    hepphep

    Joined:
    Feb 1, 2013
    Posts:
    24
    Thanks!

    Another thing I was wondering is if there is any way (or in plans in future) to be able to disable wind for given game objects without changing their material. I have tree objects that I want to be able to be cut down and I would like to disable wind while they are falling down and while they are lying on ground (as it causes quite a stuttering when they are wrongly aligned to wind calculations as well as moving). I could of course change the whole game object for them when they start to fall, but as I have no need to do it otherwise, I'd rather just set some flag on some component for them to disable wind.
     
  19. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    The wind is handled by the shaders, which are controlled by materials, so the only way to disable wind is to edit the material (it is technically impossible to do it any other way). If you don't want to manually create two variants for each material then you can edit the materials at runtime when cutting down the tree.

    For example:
    Code (CSharp):
    1. using VisualDesignCafe.Nature;
    2.  
    3. // Loop through all renderers in the tree to find the materials.
    4. foreach( var meshRenderer in GetComponentsInChildren<MeshRenderer>() )
    5. {
    6.     var sharedMaterials = meshRenderer.sharedMaterials;
    7.     for( int i = 0; i < sharedMaterials.Length; i++ )
    8.     {
    9.         // Create a copy of the material, since we only need to edit the material for the tree that is cut down.
    10.         var copy = new Material( sharedMaterials[i] );
    11.         sharedMaterials[i] = copy;
    12.  
    13.         // The NatureMaterial class can be used to easily modify materials that use nature shaders.
    14.         var natureMaterial = new NatureMaterial( copy );
    15.         natureMaterial.Wind = NatureMaterial.WindMode.Off;
    16.         // "Validate" should be called after editing any material properties. This will update the keywords and other internal settings for the material.
    17.         natureMaterial.Validate( false );
    18.     }
    19.     meshRenderer.sharedMaterials = sharedMaterials;
    20. }
    Note that this example creates unique materials for each tree. You may want to cache and reuse the materials so that all cut-down trees use the same material.
     
  20. szynal

    szynal

    Joined:
    Apr 16, 2014
    Posts:
    8
    Hello, Is there a way to enable this feature or only when using older version?
    • LOD calculations now ignore camera field of view.
    In my game I have items like camera and binoculars with huge magnification lenses. With normal Lod calculation, when zooming all grass and stuff should be loaded from culled state if item on screen percentage is large enough.

    I can try adjusting detail render distance when FoV decreasing, but maybe there is some other way?

    And second question, is there a method to reduce loaded draw cells? With large render distance, all cells in radius are loaded, what I want is load only cells in front of camera (like camera frustum + some offset).

    Thanks a lot, the tool is amazing and my scene FPS is so much better.
     
    Last edited: Feb 12, 2021
  21. biscito

    biscito

    Joined:
    Apr 3, 2013
    Posts:
    138
    hey hi

    any news about the 2020.2 version ?
    also does it work on with the nintendo switch ?

    best
    richard
     
  22. TanselAltinel

    TanselAltinel

    Joined:
    Jan 7, 2015
    Posts:
    190
    I don't know anything about Nintendo Switch support but I'm using Nature Renderer with 2020.2 and it works just fine.
     
    biscito and Wolfos like this.
  23. Wolfos

    Wolfos

    Joined:
    Mar 17, 2011
    Posts:
    951
    The asset should work on Switch, but the shaders might not.
     
    biscito likes this.
  24. biscito

    biscito

    Joined:
    Apr 3, 2013
    Posts:
    138
    did you manage a 60 fps ? with a lot of vegetation ?
     
    TanselAltinel likes this.
  25. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    Unity 2020.2 is fully supported since version 1.4.0.

    Nintendo Switch should work fine. All the features and shaders are compatible with Switch, but I don't have a dev kit here so I have not been able to verify full compatibility myself. (If there is any issue on Switch then it is definitely fixable)
     
    biscito likes this.
  26. biscito

    biscito

    Joined:
    Apr 3, 2013
    Posts:
    138
    w
    update, i can see the grass on PC, but not in the switch, i don't know if it's a shader thing or a resources problem,
     
    Last edited: Feb 24, 2021
  27. Wolfos

    Wolfos

    Joined:
    Mar 17, 2011
    Posts:
    951
    I had a similar problem on the Xbox platforms and it was fixed by adding a wind zone in the scene.
     
    biscito likes this.
  28. biscito

    biscito

    Joined:
    Apr 3, 2013
    Posts:
    138
    ok nintendo said " We do not support Third party plugins. You should reach out to their support.
    GPU instancing should work on the Switch

    i guess this is because of the dll, is there a way around ?
     
  29. TanselAltinel

    TanselAltinel

    Joined:
    Jan 7, 2015
    Posts:
    190
    Depending on the other settings, I can get 4K 60 FPS with Nature Renderer.
    But you gotta make sure that everything is set up correctly, using Nature Renderer Shaders, or custom shaders implemented over them. Also, can't stress this enough, but enable GPU instancing.

    For a pet project, I have hundreds of trees and thousands of grass with 5000 draw distance set in camera. With a good occlusion, correct volume settings, I am able to get 4K 60 FPS.

    I.e. this is a very old an example:
    https://twitter.com/Tanshaydar/status/1312683756298395648

    And this is the 4K video of it:


    I have a very large terrain with all of it having painted grass.

    Nature Renderer mostly works out of box, but rest of the scene setup & other settings usually play a bigger role.
     
  30. biscito

    biscito

    Joined:
    Apr 3, 2013
    Posts:
    138

    Yes the grass shader is very optimized, the performance are unbelievable yes! the only problem is that the grass don’t show up in the switch,
     
  31. Wolfos

    Wolfos

    Joined:
    Mar 17, 2011
    Posts:
    951
    Does it show up if you use the standard shader?
     
  32. biscito

    biscito

    Joined:
    Apr 3, 2013
    Posts:
    138
    if i change the grass shader, it work on the switch, but on the PC and on the switch, i go from 1,4k tris to 1M tris
    so i guess there is something, in the shader, but i'm no shader expert.. i have no idea how to modify it, or force it to build

    i think it's the way the shader is set up

    (edit 21h)
    ok so trying to build with the shaders in "always include" give me some error :

    Universal Render Pipeline/Nature Shaders/Grass has too many Shader variants(10616832).To resolve this, go to Project Settings > Graphics and remove this Shader from the Always Included Shaders list.For more explicit control over how Unity includes specific Shader variants in a build, use a ShaderVariantCollection.
     
    Last edited: Feb 25, 2021
  33. biscito

    biscito

    Joined:
    Apr 3, 2013
    Posts:
    138
    Is’t not the shader. I created an empty scene, with one terrain, I put some grass using the nature renderer instancing and I also put the same grass prefab directly in the scene

    I can see the grass prefab on both switch and pc,

    so the shader is working

    but the grass using nature rendered instancing is only visible on the PC,

    If I change the grass shader to a basic urp shader, I don’t think it’s using the nature renderer instancing, because the tris on screen goes from 1.6k to 1million
     
    Last edited: Feb 26, 2021
  34. biscito

    biscito

    Joined:
    Apr 3, 2013
    Posts:
    138
    well there is a issue ,)
     
  35. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    The triangle count changes due to the way Unity counts the triangles:
    • When using Nature Shaders all the object instances are generated procedurally on the GPU, which can't be counted by Unity, so the total triangle count does not show up correctly.
    • When using other shaders the object instances are calculated on the CPU first, and are then sent to the GPU for rendering. In this case Unity can count the triangles correctly and the total triangle count shows up as 1 million.
    The actual number of triangles being rendered is the same in both cases. It is just the counter that shows an incorrect amount.

    It sounds like the rendering issue is caused by the Procedural Instancing feature of Nature Renderer. Can you try to make a build with "Procedural Instancing" (in the Nature Renderer component) disabled? (The performance will be worse, but it is just to identify the issue)
     
  36. biscito

    biscito

    Joined:
    Apr 3, 2013
    Posts:
    138
    I made a test animating the “Procedural Instancing" bool the grass show up, then disappear as soon as it’s on, (in the switch)
     
    Last edited: Feb 27, 2021
  37. marcrem

    marcrem

    Joined:
    Oct 13, 2016
    Posts:
    340
    Hi,

    Since there's no way to dig through the source code of NR, I wanted to know if NR keeps a reference to detail layers in its component, hidden somewhere?

    I deleted a detail layer on a terrain and now every time it loads I get this weird error that I can't find anything about on the internetZ: Detail removed : Invalid detail layer 26

    This is called by an OnGUI method so I doubt this should have any effect on our build, but still, something's weird there. Detail layer 26 isn't there anymore, so what's looking for it?
    Thanks!
     
    Last edited: Feb 28, 2021
  38. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    Thanks! That should give me a good start to figure out what the problem might be. I'll send you a debug/test build later this week.
     
    biscito likes this.
  39. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    No, Nature Renderer does not store any data or references at all. Everything is loaded dynamically, so if there is an issue like this then restarting Unity should always fix it. If it keeps showing up then I recommend submitting a bug report to Unity, it is most likely an error from Unity and not related to Nature Renderer.
     
  40. marcrem

    marcrem

    Joined:
    Oct 13, 2016
    Posts:
    340
    Thanks!
     
  41. biscito

    biscito

    Joined:
    Apr 3, 2013
    Posts:
    138
    great !!
     
  42. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    @biscito I have sent you an email with a new version that should fix the issue. (At least, I am assuming it was you that sent the support email. If not, please let me know and I'll send you a build as well)
     
    biscito likes this.
  43. biscito

    biscito

    Joined:
    Apr 3, 2013
    Posts:
    138
    Ok !!! Got it !! It works !!! You’re the best !!
     
    Last edited: Mar 6, 2021
    Visual-Design-Cafe likes this.
  44. betaFlux

    betaFlux

    Joined:
    Jan 7, 2013
    Posts:
    112
    How do I get rid of the Nature Shaders Beta UI in the lower left corner during development other than removing the Shaders completely? I tried unticking "Interaction" in the custom terrain grass shader, but it's still showing.

    Are the shaders purchasable by now?
     
  45. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,527
    I hope this renderer will be updated to work on normal meshes, not only terrain meshes.
    I love to take advantage of the faster rendering on all my vegetation, also the manually placed on meshes.
     
  46. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    I can finally say: Yes! Nature Shaders is available now. It has just been published and the official announcement is coming tomorrow (I am still updating the website text and some URLs).
    Here is the link to the store page: https://assetstore.unity.com/packages/slug/189644?aid=1011lK8Q
     
    betaFlux likes this.
  47. Visual-Design-Cafe

    Visual-Design-Cafe

    Joined:
    May 23, 2015
    Posts:
    721
    It is something that is on the list for a next update. It will most likely be added along with the tree rendering, since it needs the same system. No promises though, as it is still in research.
     
    Lars-Steenhoff likes this.
  48. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,527
    Thats great to hear! Hope the research will be succesfull
     
  49. betaFlux

    betaFlux

    Joined:
    Jan 7, 2013
    Posts:
    112
    Alright, that's great news!
     
  50. Rastapastor

    Rastapastor

    Joined:
    Jan 12, 2013
    Posts:
    589
    I bought the Nature SHdaers, is it possible to ahve a flat shading on grass for stylized stuff ?

    upload_2021-3-9_17-6-5.png

    Normals -> Same / Flip dont work
     
    GrapePaste likes this.