Search Unity

Question Grass on mobile device for 2023

Discussion in 'World Building' started by creat327, Feb 7, 2023.

  1. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,349
    Sure, will get back asap. I will both fix anything that might not have worked and add new demos for mobile specifically.

    Btw, i just read saw the assets used were from Unity (https://assetstore.unity.com/packages/3d/environments/landscapes/terrain-sample-asset-pack-145808)

    Those are available to include in assets in general, as most material from Unity own sample assets, so will check a bit more and maybe indeed include them in the asset in next version.
     
  2. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    Not all assets are from there. Check the readme please. The poly grass is not from there.
     
  3. mattb-unity

    mattb-unity

    Unity Technologies

    Joined:
    Feb 7, 2020
    Posts:
    55
    heh - I have not forgotten, I just got a bit slowed down. I've got your project loaded up though to take a look. Out of curiosity, what size terrain are you looking to create for your project, and what minimum spec device? Does your min spec device support compute shaders?
     
  4. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,349
    creat327 likes this.
  5. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    Checking the Google Android console it seems almost all devices already support OpenglES 3.2, so I guess that should be the minimum specs. Although I see lots of OpenglES 3.1 still selling (amazon kindle 7 from 2019 for instance) by the time we add things into a Unity release we probably should just forget about 3.1.

    I believe OpenglES 3.2 already supports computer shaders if that helps speed up things.

    As for terrain size... large. I usually do 1kmx1km or 4kmx4km

    On the other hand, keep in mind that I can run plenty of grass as a billboard on a Samsung Galaxy S6, which is 7 to 8 years old. From what I can tell, if you did the same with Tree Creator, it would work wonderfully. Basically have a bar on settings that after a certain distance, switches from 3d to a billboard, and then have Unity generate the billboards for you on the fly as it did with Tree Creator.

    To give you an idea, my Samsung Galaxy S6 displays about 50k trees using the Tree Creator system at 40 fps. With no tricks or assets required. So it worked pretty well.
     
    mattb-unity likes this.
  6. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,349
    Hi, i have started work on the new mobile demo, is it possible to send me the names of the prefabs and models that are needed for the mobile grasses, to get an idea of the needed workload.

    If know this will be able to start work on this today, as i cant yet download the new github project until tomorrow.

    Thanks
     
  7. mattb-unity

    mattb-unity

    Unity Technologies

    Joined:
    Feb 7, 2020
    Posts:
    55
    Just looking at the code, I see we have a pretty straight forward path for switching to billboards with trees, but don't have a similar path with details (grass). I can bring it up with my manager and see if we have time to add a "billboard distance" for details. Just fair warning, I would not get high hopes about it, but I will ask. Probably the "generate billboards on the fly part" is where the feature gets a bit tricky.
     
    creat327 likes this.
  8. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    that would be awesome
     
  9. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,349
    Mobile first tests on 1650x720 resolution on Samsung S22 plus
    With shadows off and on. The terrain is also fully pre-planted from editor everywhere for this demo, using the mass plant feature. Also uses the full InfiniGRASS desktop shader for now, without further mobile optimizations.



    Mobile first tests 1050GTX laptop
    Before adding optimizations 2 and 3 (billboards are enabled in both tests)


    After adding optimizations 2 and 3 (billboards are enabled in both tests)

    Hi,

    I have some great news :)

    I have found out that can do two extra major optimizations over the previous system, while making the new mobile demo.

    Overall three new big optimizations have now been added to InfiniGRASS over the current store version, giving an extra big boost to performance
    1. Added batched billboards for far LODs
    2. Added system to regulate the batchers distance checks that apply the LODs so is not calculated each frame but rather in intervals when the player moves above a distance threshold
    3. Added full disable of the grass grower objects, in the case where the interactive properties or grass erase is not needed

    The difference i get on the 1050GTX laptop in 14ms versus 3 ms with the 2 new optimizations (no 2 and 3) on (with billboards are enabled in both tests)

    The new mobile demo uses the dry grass model, that is the most mobile friendly for big grass coverage from the assets you had provided, and revert it to a billboard in the distance. I am now testing on mobile and will release a new demo soon. Currently i see around 120fps median and 200fps max in the Samsung S22 with full shadows on and 1150x540 res (shadow cast, receive and self shadow).

    EDIT: Added photos and results from tests on mobile Samsung S22 plus, with a downscale factor of 1.5 from the native phone resolution.
     
    Last edited: Feb 25, 2023
  10. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,349


    Tests on 1650x720 resolution on Samsung S22 plus, with shadows off and on.
    The terrain is also fully pre-planted from editor everywhere for this demo, using the mass plant feature. Also uses the full InfiniGRASS desktop shader.

    Hi,

    Four new big optimizations have now been added to InfiniGRASS, giving an extra big boost to performance
    1. Added batched billboards for far LODs.
    2. Added system to regulate the batchers distance checks that apply the LODs so is not calculated each frame but rather in intervals when the player moves above a distance threshold.
    3. Added full disable of the grass grower objects, in the case where the interactive properties or grass erase is not needed.
    4. Added assignment of grass to Layer per grass type, which allows to fine tune what is rendered at each time as needed using layer control on the scene cameras.

    Below is linked a first mobile demo for Android, using some of the above new optimizations. The demo runs at around 100fps in landscape mode in Samsung S22. In the demo can also plant extra grass & trees by tapping both fingers at once on the terrain & change grass type using the types button.

    Also have a second demo with using a more detailed model for all grass, as provided in your github assets, this is still rather fast on the mobile (results in the photos above).

    InfiniGRASS Android Mobile demo with mobile oriented assets (3-4 quads for close up grass)
    https://drive.google.com/file/d/1WaZbVTbpW1oKjMcwXi0qbc2NHjEsRK2P/view?usp=sharing

    InfiniGRASS Android Mobile demo with higher detailed grass model for close up grass
    https://drive.google.com/file/d/1u1zaRE_AgWMn_THjB-fHxieMUlhQftIq/view?usp=sharing

    EDIT 1:
    Added a demo with much higher draw distance for grass and much more optimized real time planting as well.

    InfiniGRASS Android Mobile demo with higher detailed grass model for close up grass and higher view distance for grass, also more optimized run time planting.
    https://drive.google.com/file/d/1oTYWRDkyXycO7ZqiRduZUgsxBSQFoqqU/view?usp=share_link

    ARTnGame - Instagram - Facebook - Twitter - Discord - Youtube - Reddit - Discount Offers
    (New offers - Upgrade from Sky Master ULTIMATE to Environment Building Bundle for only $99 and save $600 on ARTnGAME assets!)
     
    Last edited: Mar 8, 2023
  11. mattb-unity

    mattb-unity

    Unity Technologies

    Joined:
    Feb 7, 2020
    Posts:
    55
    Just to follow up -- I won't be able to work on adding this feature. Our Terrain system is pretty old, so most effort that goes into it is maintenance instead of features.
     
  12. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    any plans to create a better terrain system? Yes, it's super old.
     
    malkere likes this.
  13. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,349
  14. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,349


    Hi,

    I have some amazing news on the foliage on mobile front, I managed to get the system with zero wait time to get in scene and a massive performance boost as well. This new mode saves the grass in scene, so get a larger scene file, but does not use the Grass Manager to batch the grass at game start, so get in scene time is instant.

    Also the LOD manager works in a centralized way, giving an extra boost to performance.

    The image above is from Samsung S22, with massive grass draw distance, very detailed close up grass mesh and batched billboards in the background.

    The system offers a massive boost to mobile foliage performance and can get desktop level detail and shadows even at 60fps. I will be working on a demo where the player can move around the map and post it asap.
     
  15. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,349
    Hi,

    I have now added the two final APK Android demos for the new instant get in game mode and very detailed grass meshes.

    The first is with full features, like real time planting and run time permanent grass shaping and the second is with only the pre grown from editor grass.

    This new mode will be available in the next InfiniGRASS 2.1 version.

    InfiniGRASS v2.1 FULL FEATURES - Run time planting and Permanent grass interaction and shaping
    https://drive.google.com/file/d/1P31YvEdUqHwwd8vuVPUyOa3YYTTQ6MB2/view?usp=sharing

    InfiniGRASS v2.1 PRE GROWN GRASS
    https://drive.google.com/file/d/1_42YDovZQFsTrJJMp--QH3FNwYkn7Hth/view?usp=share_link

    Note that this is a stress test demo, with very detailed close up grass that is normally more suitable to desktop. Much more optimizations can be inserted over this, e.g. blend of detailed and quad based close up grasses.
     
    NeloElber55 likes this.
  16. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    @nasos_333 I understand you want to sell your asset. But please, this thread is about a particular demo project and how to optimize that demo project so that we can compare apples to apples. You keep posting about your asset updates every time you make an update on the store and already flooded the whole thread. This thread is not about your asset please. I will write to compare different tools when I have time, which is the idea of this thread. I will include yours too and try to be as impartial as possible with the pros and cons.

    Also your 2 apk files do not load. They don't run because they have missing files, I don't know how you can run them. From the logcat.
    4-21 14:23:40.562 18197 18287 E Unity : Material doesn't have a texture property '_MainTex'
    04-21 14:23:40.562 18197 18287 E Unity : (Filename: Line: 1462)
    04-21 14:23:40.562 18197 18287 E Unity :
    04-21 14:23:40.572 18197 18287 W Unity : The tree GameObject couldn't be instanced because the prefab contains no valid mesh renderer.
    04-21 14:23:40.572 18197 18287 W Unity : (Filename: Line: 172)
    04-21 14:23:40.572 18197 18287 W Unity :
    04-21 14:23:41.004 18197 18287 W Unity : TerrainCollider: MeshCollider is not supported on terrain at the moment.
    04-21 14:23:41.004 18197 18287 W Unity : (Filename: Line: 197)
    04-21 14:23:41.004 18197 18287 W Unity :
    04-21 14:23:41.004 18197 18287 W Unity : TerrainCollider: MeshCollider is not supported on terrain at the moment.
    04-21 14:23:41.004 18197 18287 W Unity : (Filename: Line: 197)

    i also just tested your latest software update and i got no different results from the previous versions. There are like 20 demo scenes, hard to tell which one you want people to look at. I tried latest Demo 2.1 stuff, but i only see high end mobile demos there. Which is the demo scene we should be looking for a regular mobile device?

    But again, this thread is not about your asset. It seems it turned into your personal beta testing thread. Please let's move your asset-related things to your asset thread, where you also post the same content. All your asset related conversations I will continue at your thread here:
    [-50% Weekend Sale✅]Infinigrass-GPU Optimized Interactive Grass-Trees-Meshes,work on mobile,HDRP-URP - Unity Forum
     
    Last edited: Apr 21, 2023
    genify likes this.
  17. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,349
    Hi, sure, will reply on the above in my thread
     
  18. fabrism77

    fabrism77

    Joined:
    May 5, 2019
    Posts:
    12
    I have been so silly to render with rendermeshinstanced and works fast AF on 6 yo phone
     
  19. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    you render a full terrain of grass with rendermeshinstanced on a 6 yo phone? and fast AF? can you attach a picture? hard to believe
     
  20. ProgramerKismin

    ProgramerKismin

    Joined:
    Mar 3, 2015
    Posts:
    3
    I think it depends on how it is implemented. After I tried comparing the standard Unity grass rendering, it was still very good. tested with old device redmi note 9 4gb ram
    note: you have to use a mobile shader to render it

    - with TerrainGrass really terible fps

    Screenshot_2024-02-12-22-33-25-440_com.DefaultCompany.MobileGrass.jpg
    - with standart grass mobile
    Screenshot_2024-02-12-22-41-05-573_com.DefaultCompany.MobileGrass.jpg

    Screenshot_2024-02-12-22-41-34-268_com.DefaultCompany.MobileGrass.jpg

    - final comparation

    Screenshot_2024-02-12-23-30-19-660_com.DefaultCompany.MobileGrass.jpg

    Screenshot_2024-02-12-23-30-42-032_com.DefaultCompany.MobileGrass.jpg
     
    Last edited: Feb 12, 2024
  21. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    i wouldn't call that fast AF and the amount of grass seems pretty small and quality like a 90s game. How much grass do you have in there per patch?
     
    Pookzob likes this.
  22. ProgramerKismin

    ProgramerKismin

    Joined:
    Mar 3, 2015
    Posts:
    3
    My cellphone is very old, so I optimized it a little (In the previous picture, the grass image is blurry). after several tries. apparently with a custom shader. unity tree is the real winner (I hope unity adds a terrain rotation feature in unity tree), one drawback is that it doesn't have rotation. if you want to change unitytree with rotation. You can change it with DrawMeshInstance with performance that is not much different. You can also use DrawMeshInstancedIndirect but most of the time it doesn't work on cellphones, (on PC you can get 2x faster fps with DrawMeshInstancedIndirect)

    - topdown mode
    Screenshot_2024-02-14-14-00-41-860_com.DefaultCompany.MobileGrass.jpg Screenshot_2024-02-14-14-01-19-660_com.DefaultCompany.MobileGrass.jpg

    - wide mode
    Screenshot_2024-02-14-14-13-17-027_com.DefaultCompany.MobileGrass.jpg Screenshot_2024-02-14-14-13-29-759_com.DefaultCompany.MobileGrass.jpg

    - why DrawMeshInstancedIndirect not work on mobile
    this test on pc
    renderpc.png
     
    Last edited: Feb 14, 2024
  23. ProgramerKismin

    ProgramerKismin

    Joined:
    Mar 3, 2015
    Posts:
    3
    DevDunk likes this.