Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question GPU instancing for skinnedmeshrenderer realtime (not baked) legacy animaton

Discussion in 'Animation' started by ParhamXTT, Apr 15, 2023.

  1. ParhamXTT

    ParhamXTT

    Joined:
    May 24, 2020
    Posts:
    28
    I am making a medieval RTS game that has 200 unit types , 200 worker types, 200 peasant types, 200 lord types and 200 animal types. my game should be able to render at the very very very least 100,000 animated 3D high quality characters on a zoomed out camera and at the very very very least 1,000,000 animated 3D high quality characters on the map. Ultimate Epic Battle Simulator 2 can handle 7 million 3D high quality characters on map and is made with Unity and does not use baking animation data to textures or meshes or anything like that. animation is realtime and both GPU Instanced and GPU Skinned. GPU Skinning is enabled for my project and all materials have GPU Instancing checkbox enabled and all materials are based on Unity default HDRP shaders so no custom made shader is written by me. I can get a few thousand characters in my game but frame rate will be lower than 15 fps if my camera is rendering more than 1000 characters. if camera is not rendering a lot of characters, frame rate is around 144 fps (where it should be). I used profiler and frame debugger and realized that only weapons of my characters are GPU_Instanced and the characters themselves can not be GPU_Instanced due to the fact that my characters use SkinnedMeshRenderers. I am a good CSharp programmer but I know nothing about c++ or blueprints and I really hate moving to Unreal Engine 5. please help me find a way to GPU_Instance Skinned mesh renderers.
    I consider buing some packages but I want to first make sure other people who purchased them can achieve mass crowd 3D realtime animated characters with those packages.
    one of the packages is GPU Instancer - Crowd Animations.
    I baked my animations before using different baking packages and techniques but all of them needed over 1 Terabytes of RAM for the end user (gamers who play my game after I release my game). no gaming PC has more than 128 GB RAM and 99 percent of gamers have 32 GB or less. I decided to make my characters low_poly but it still needed 384 GB of RAM for the end gamer. so I stopped thinking about baking animations.
    here are a few videos from my game :





    and more on my YT channel.
    my PC specs is :
    CPU : AMD Ryzen 9 7950X
    RAM : 128 GB DDR5 3600 MHz
    GPU : Sapphire AMD Radeon RX 7900 XTX Nitro+ vaporX
    Motherboard : ASRock B650E-PGRiptide-Wifi
    SSD1 : 1 TB NVME PCIE4.0 OS
    SSD2 : 2 TB NVME PCIE4.0 Crucial P5 unity and projects
    HDD1 : 5 TB USB external
    Monitor1 : 3440x1440 @144 Hz Freesync premium HDR
    Monitor2 : 1920x1080 @ 75Hz
    OS : Windows 11 Enterprise 64 bit
    No antivirus or other CPU heavy software installed
    Unity versions used for my project :
    2023.1
    2022.2
    2022.1
    2021.1
    2021.0
    2020.1
    2019.0
    2018.1
    2017.1
    5.6
    5.4
    5.0
    my animations are legacy to reduce CPU overhead
    IK is not so important but nice to have
    root motion is important but I can use navmesh speed to fake it by code
    last frame of animation must have OnAnimationEnded event so I can tell my characters what animation to play next via code.
    animation blending is not nessecary but it would be nice to have
    I am working on this project since 2015 and I am considering to move to Unreal 5 if my Skinnedmeshrenderer GPU_Instancing problem is not solved in unity. please help either with :
    1-introducing me a massive 3D crowd animation package that works on HDRP with Unity 2023.1b7
    2-telling me if the package "GPU Instancer - Crowd Animations" solves my problem or not.
    3-writing a SkinnedMeshRenderer script for me that supports GPU_Instancing out of the box (I spend you 400 euros with paypal)
    4-introducing me to any other method that solves my problem except for baking methods.
    5-introducing me to DOTS and ECS fully funcioning animation package which can handle massive crowds without frame rate drop (that works on Unity 2023.1b7 HDRP or higher)
    6-writing a custom DOTS/ECS animation package for me that works with Entities version 1.0 (I spend you 400 euros with paypal)
     
  2. Rukhanka

    Rukhanka

    Joined:
    Dec 14, 2022
    Posts:
    204
    Rendering of massive numbers of animated objects is complex task. "GPU Instancer" can help you in this task. Also there is ECS 1.0 animation package: "Rukhanka Animation System"
     
    ParhamXTT likes this.
  3. DreamingImLatios

    DreamingImLatios

    Joined:
    Jun 3, 2017
    Posts:
    4,223
    First off, if you aren't familiar with this thread, take some time to read up on it: https://forum.unity.com/threads/dots-animation-options-wiki.1339196/

    Actually it does use something like that. It stores animations in graphics buffers and does all the animation processing using compute shaders. It is also doing a lot of procedural blending and IK to reduce the number of animation frames.

    At the scale you are looking for, I don't think you can get away from GPU-based animation. However, if you scale back a little, it is possible to push 100K+ with Kinemation if you very carefully author your skeletons, LODs, and shaders. That's a special feature of Kinemation though. Vanilla Entities Graphics doesn't do culling and LODs correctly (it will render the right pixels, but it won't improve performance).