Search Unity

[Released] Advanced Terrain Grass

Discussion in 'Assets and Asset Store' started by larsbertram1, Sep 11, 2017.

  1. zedz

    zedz

    Joined:
    Aug 31, 2013
    Posts:
    250
    windows x86_64 // multiple unity versions 2019 & currently 2020.1.15
    IL2CPP (but mono the same)
    The built in render pipeline
     
  2. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    hmm, i just gave it another try:
    unity 2019.4.23f, windows x86_64, mono and legacy deferred - i used the full demo 02 and everything just works fine.
    do you get any errors?
     
  3. zedz

    zedz

    Joined:
    Aug 31, 2013
    Posts:
    250
    Maybe its not even ATG maybe its something else, the problem with the segfault it gives no error what caused it.
    I suspect ATG cause it was giving errors > a year ago,
    note I have changed the shaders a little to add bending to the normal pipeline

    I'll download the new version of ATG and see if that fixes it.

    EDIT: Still no go, I built the demo2 from 1.33 and that works so relax mate, its prolly something else, I'll have to dig into it some more
     
    Last edited: Aug 12, 2021
    andreiagmu likes this.
  4. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    looks cool!
     
    andreiagmu likes this.
  5. dipoamarjsb

    dipoamarjsb

    Joined:
    Mar 21, 2021
    Posts:
    6
    help me, i made an android mobile game and installed ATG on my terrain, but on some cellphones the grass looks big even though the grass is small
    upload_2021-8-20_17-50-30.png
    upload_2021-8-20_17-49-29.png
     
  6. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    doesn't look as if works at all: se ethat there is no randomness in the grass. it looks like just one grass instance per cell – which most likely indicates that the shader does not work.
    the graphcs api must support instanced indirect.so vulkan or lastest opelgles should be fine. older version may not be supported.
     
    andreiagmu likes this.
  7. dipoamarjsb

    dipoamarjsb

    Joined:
    Mar 21, 2021
    Posts:
    6
    upload_2021-8-20_19-36-44.png
    i am using this, should it be replaced with vulkan ?
     
  8. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    try vulkan, yes.
     
  9. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    An HDRP preview package is added and available now.
     
  10. damm0409

    damm0409

    Joined:
    Feb 5, 2021
    Posts:
    3
    Hi I recently got your ATG asset and setup some terrain with grass. I can't see anywhere in the documentation to make the stylized/BOTW type grass like you've got in one of your videos. Does your package come with the shaders (etc) for this (ideally in URP)? Thanks
     
  11. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    hi!
    the URP 10 + packages only contain updated shaders. but the both "urp support" packages:
    • ATG_URP_7.1.7_Support.unitypackage
    • ATG_URP_7.2_Support.unitypackage
    should contain the stylized demo you mentioned. the shader used here is just the "regular" atg grass shader.
     
  12. Mydel

    Mydel

    Joined:
    Apr 15, 2021
    Posts:
    12
    Hi, I'm trying to combine your asset with World Streamer 2, at the beginning everything loads correctly and no problem, but after switching to another piece of terrain the options reset and the grass is rendered at a very short distance again, maybe some suggestions what is the problem here or maybe how to untie it?
    upload_2021-10-5_11-40-56.png
    upload_2021-10-5_11-41-33.png
    But funny thing, only grass is missing, rocks and all the time.
     

    Attached Files:

  13. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    i am sorry, but i do not have any experience when it comes to world streamer.
    hmm, i am not sure if i get this properly: options are reset? which options?
     
  14. Mydel

    Mydel

    Joined:
    Apr 15, 2021
    Posts:
    12
    upload_2021-10-5_12-47-36.png
    First peace of terrain leaded with grass manager and we can see grass everywhere cull distance set on every terrain is 1000
    Orange line tells where first peace of terrain ends
    upload_2021-10-5_12-49-5.png
    after leaving the first part of the terrain, the render distance of the grass changes

    Also i see how debug.log changes from
    upload_2021-10-5_12-50-36.png
    to
    upload_2021-10-5_12-50-48.png

    and maybe you know why asset cant remove terrain?
    upload_2021-10-5_12-52-11.png
     
  15. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    looks like the settings on your terrains do not match?
     
  16. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    because the grass manager depends on it. you will have to disable/destroy the entore game object. not only the terrain component.
     
  17. Mydel

    Mydel

    Joined:
    Apr 15, 2021
    Posts:
    12
    On every terrain setting are same
    upload_2021-10-5_13-28-45.png
    upload_2021-10-5_13-29-7.png
     
  18. Mydel

    Mydel

    Joined:
    Apr 15, 2021
    Posts:
    12
    Maybe i will try contact someone from streaming asset, becouse on the other hand on scene where i got only world with grass manager everything works perfectly fine.
     
  19. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    a grass culling distance of 1000m might a bit over the top... depending on your grass density this will need a lot of vram.
     
    twobob likes this.
  20. Mydel

    Mydel

    Joined:
    Apr 15, 2021
    Posts:
    12
    Hey, its again me. Do you have any idea why im getting this error almost every second? upload_2021-10-26_18-54-10.png

    But while in playmode, when i switch to scene view and click on terrain that is cousing this error, it stops and works perfectly fine.

    Im looking for some suggestions what is happening, and maybe sobie idea how i can fix it.
     
  21. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    that line number does not lead to anything meaningful when i look into latest.
    anyway: do you use saved terraindata and are you sure it is up to date?
     
  22. Mydel

    Mydel

    Joined:
    Apr 15, 2021
    Posts:
    12
    Okey! saving terraindata fix it, thx!
     
  23. arminiuspp

    arminiuspp

    Joined:
    Jun 15, 2020
    Posts:
    54
    Hi, Currently having this error for some reason upload_2021-11-18_11-42-3.png upload_2021-11-18_11-42-22.png
     
  24. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    looks as if one of the materials is not set ptoperly.
    the grass manager inspector should inform you about this.
    if not change to debug mode and hae a look at the v_mat array. its length has to match the number of assigned prototypes and all entries have to be filled.
     
  25. arminiuspp

    arminiuspp

    Joined:
    Jun 15, 2020
    Posts:
    54
    Thanks, Fixed it!
     
  26. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    Will this be updated for URP 12 and it's deferred mode? :)
     
  27. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    i will have to look into this.
     
  28. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    Thanks. I did get URP 12 work in forward after changing this line from META pass:
    Code (CSharp):
    1. #pragma fragment UniversalFragmentMeta
    into
    Code (CSharp):
    1. #pragma fragment UniversalFragmentMetaLit
    from all three URP shaders. (URP 12's own Lit had the same change: https://github.com/Unity-Technologi...r-pipelines.universal/Shaders/Lit.shader#L335). Haven't looked into deferred passes myself.

    As extra note: URP's new depth priming option seems to break the rendering as well.
     
    Last edited: Nov 22, 2021
  29. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    thanks for the heads up. i will have to look into urp12...
     
    rz_0lento likes this.
  30. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    version 1.35 is available!

    # added URP 12.1 package.
    # fixed punctual lights not being rendered properly in forward if compute is disabled.
     
  31. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    version 1.3.5 nw officially supports URP 12.1.
     
    rz_0lento likes this.
  32. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    Awesome! Thanks for the quick fix, will give it a go :)
     
  33. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    @larsbertram1 actually, the store update misses the ATG_URP_12.1_Shaders.unitypackage (12.1 README is there though), I also verified it's also not listed on the store packages package contents list either (so not an issue on my end not importing it).
     
  34. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    ups! should be fixed now.
     
  35. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    Now it works, thanks :) Anything one could do for that urp depth priming with forward mode or is it out of reach for this type of asset?
     
  36. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    depth prepass (who the fxxk called it "depth priming"?) works perfectly on dx11.
     
  37. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    Yeah it's a weird name alright :) I found that depth prepass set to Forced does work if I have SSAO or Decal renderer feature enabled, otherwise it completely breaks the rendering when I hit play in "Full Demo URP" -scene. I guess there's something not initialized in such combination (not necessarily related to ATG in any way).
     
  38. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    ah, i focused on the new rendering features which rely on the depth normal pass. turned out the the depth pass was missing a tiny bit of code...
    the fixed version is online. so just grab it and let me know if it works for you as well :)
     
    rz_0lento likes this.
  39. joshsickhead

    joshsickhead

    Joined:
    Jan 9, 2020
    Posts:
    2
    Has anyone ever come across an issue with the standard unity grass rendering alongside the atg grass?
     
  40. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    atg will set the detail distance to 0. so no standard unity grass in play mode at all.
     
  41. Mydel

    Mydel

    Joined:
    Apr 15, 2021
    Posts:
    12
    Hey im trying to build controller that changes render distance in runtime. Im using RefreshGrassRenderSetting at this poit, and it works fine. But when i load new chunk of terrain all setting reset, do anyone have idea how can i onload change the rendering distance? and why it is not working?

    upload_2021-12-13_12-45-47.png

    with this i get error
    upload_2021-12-13_12-47-48.png

    null reference in culling group in GrassManager
    upload_2021-12-13_12-48-13.png

    any suggestions how to fix it?
     
  42. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    are you sure that the cullinggroup is already created for the new loaded terrains?
     
  43. Mydel

    Mydel

    Joined:
    Apr 15, 2021
    Posts:
    12
    Okey i figure it out, thx do oyu have any idea how i can change shadow casting mode in runtime? for each prototype and changing it with refreshing some kind to instatnly saw the resoult?
     
  44. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    this might aleady do the trick, yes.
     
  45. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    just had a quick look into the code:
    the grassmanager script contains a bunch of arrays which hold the definitions for all prototypes like v_mesh, v_material, ... and also: public ShadowCastingMode[] ShadowCastingMode;
    you can simply change it for the 2nd prototype like: ShadowCastingMode[1] = ShadowCastingMode.Off;
    no refresh needed as these properties will be looked up each frame.
     
  46. zedz

    zedz

    Joined:
    Aug 31, 2013
    Posts:
    250
    Im getting severe flickering of the grass if I have the following

    Application.targetFrameRate = 60;

    using compute or not doesnt make a difference
     
  47. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    which version of unity? which render pipeline?
     
  48. zedz

    zedz

    Joined:
    Aug 31, 2013
    Posts:
    250
    Standard pipeline, 2021.2.3 but IIRC also the previous version I used 2021.1.15

    Now I think about it, it also happens when I press ingame menu (but Ive been ignoring it for the last few months), give me an hour I'll look into it more

    edit: OK mate it looks like its the same issue, when I display the ingame menu, I also was setting Application.targetFrameRate = 60; in that function
     
    Last edited: Dec 29, 2021
  49. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    ok :) no idea what might be going on there.
     
  50. yurikrsk24

    yurikrsk24

    Joined:
    May 12, 2019
    Posts:
    2
    Hi! What could the error be related to? And how can it be fixed?

    GrassManager thread crashed: System.IndexOutOfRangeException: Index was outside the bounds of the array.
    at AdvancedTerrainGrass.GrassManager.InitCellContent (System.Int32 cellIndex) [0x0031e] in C:\HE_2020LTS\Assets\AdvancedTerrainGrass\Scripts\GrassManager.cs:1900
    at AdvancedTerrainGrass.GrassManager.InitCellContentOnThread () [0x00059] in C:\HE_2020LTS\Assets\AdvancedTerrainGrass\Scripts\GrassManager.cs:1700
    UnityEngine.Debug:LogWarning (object)
    AdvancedTerrainGrass.GrassManager:InitCellContentOnThread () (at Assets/AdvancedTerrainGrass/Scripts/GrassManager.cs:1704)
    System.Threading.ThreadHelper:ThreadStart ()


    The grass rendering stops after the error appears.

    upload_2022-1-21_20-23-7.png


    HDRP 10.8.1
    The component is attached to a 3x3 km terrain, with 4 types of grass.
    upload_2022-1-21_20-23-56.png