GPU Instancer:Features

From GurBu Wiki
Revision as of 04:06, 12 December 2018 by GurBu Admin (talk | contribs) (Nested Prefabs support (Unity 2018.3 and later))
Jump to: navigation, search

About | Features | Getting Started | Terminology | Best Practices | F.A.Q.


[Documentation coming soon]


Contents

General Features


Tens of thousands of objects rendered lightning fast in a single draw call



[Documentation coming soon]


GPU frustum culling



[Documentation coming soon]


GPU occlusion culling



[Documentation coming soon]


Automatically configured custom shader support



[Documentation coming soon]


Supports HDRP and LWRP render pipelines



[Documentation coming soon]


Complex hierarchies of prefabs instanced with a single click



[Documentation coming soon]


Multiple sub-meshes support



[Documentation coming soon]


LOD Groups and cross-fading support (with animation or fade transition width)



[Documentation coming soon]


Automatic 2D Billboard Generation System



GPUInstancer-Scr-BillboardGenerator.png


GPU Instancer comes with a billboard generator system. A GPUI billboard is a simple quad that shows snapshots of the object from different angles depending on the camera viewing angle. GPUI's billboard generator is mainly designed for use with trees so it generates snapshots of view angles around the world y axis. This means that the billboards do not have view perspectives from up or down.


Bilboards are a great way to increase performance while having vast viewing distances. GPUI adds the generated billboard automatically as the final LOD level (even if the prefab does not have an LOD Group on it). You can also use a custom mesh and material for the billboard if you do not wish to use the billboard that GPUI generates.


Shadows casting and receiving support for instances (frustum culled instances still can cast shadows)



[Documentation coming soon]


Ability to use custom shadow distance per prototype and to choose the LOD to render shadows with



[Documentation coming soon]


Unity 5.6 support



[Documentation coming soon]


Well documented API for procedural scenes and runtime modifications (examples included)



[Documentation coming soon]


Ability to Remove instances inside bounds or colliders at runtime



[Documentation coming soon]


Ability to extend with custom Compute Shaders



[Documentation coming soon]


Example scenes that showcase GPU Instancer capabilities



[Documentation coming soon]


Prefab Instancing Features


Ability to automatically instance prefabs at your scene that you distribute with your favorite prefab painting tool



[Documentation coming soon]


Automatically Add-Remove prefab instances without any aditional code


1. Easiest way is to enable Auto. Add/Remove Instances option in the prototype options. When enabled, the Prefab Manager will add a script called "GPUInstancerPrefabRuntimeHandler" to the prefab object and handle all runtime changes automatically.

autoaddremoveinstances.png

2. Optionally you can add prefab instances through our API methods with the AddPrefabInstance and RemovePrefabInstance methods. Keep in mind that Add/Remove Instances At Runtime option should be enabled in the prototype definition for this API methods to work. Also Extra Buffer Size should have high enough number to add all the prefab instances generated at runtime.

addremoveinstances.png

3. Another option is to register the prefab instances and reinitialize the Prefab Manager with first calling RegisterPrefabInstanceList method and then calling InitializeGPUInstancer method.

using System.Collections.Generic;
using UnityEngine;
 
namespace GPUInstancer.Extras
{
    public class GPUIRegisterPrefabInstances : MonoBehaviour
    {
        // Keeping a static reference to the manager so it can be shared between scenes.
        public static GPUInstancerPrefabManager prefabManager;
        // The list of prefab instances in scene
        public List<GPUInstancerPrefab> prefabInstanceList;
 
 
        // In this example we fill the list in the Reset method which works when adding the component for the first time (or using the reset command in the inspector).
        // You can fill the list in any way you want.
        public void Reset()
        {
            // Add prefabs in the scene to the list
            prefabInstanceList = new List<GPUInstancerPrefab>(FindObjectsOfType<GPUInstancerPrefab>());
        }
 
        void Start()
        {
            // Find the prefab manager and set it to the static property
            if(prefabManager == null && GPUInstancerAPI.GetActiveManagers() != null)
            {
                GPUInstancerManager manager = GPUInstancerAPI.GetActiveManagers().Find(m => m is GPUInstancerPrefabManager);
                prefabManager = (GPUInstancerPrefabManager)manager;
            }
 
            // Register the prefab instance list to the manager
            if (prefabManager != null && prefabManager.isActiveAndEnabled)
            {
                GPUInstancerAPI.RegisterPrefabInstanceList(prefabManager, prefabInstanceList);
                GPUInstancerAPI.InitializeGPUInstancer(prefabManager);
            }
        }
    }
}


Nested Prefabs support (Unity 2018.3 and later)



[Documentation coming soon]


Add-Remove-Update prefab instances with or without instantiating GameObjects

With GPU Instancer, you can render prefab instances without instantiating GameObjects by supplying an array of Matrix4x4s.

    using UnityEngine;
    using GPUInstancer;
     
    public class NoGameObject : MonoBehaviour
    {
        // reference to Prefab Manager
        public GPUInstancerPrefabManager prefabManager;
        // reference to prefab
        public GPUInstancerPrefab prefab;
        // size of array and buffers
        public int bufferSize;
     
        // transform data array
        private Matrix4x4[] _matrix4x4Array;
     
        // Use this for initialization
        void Awake ()
        {
            // initialize the array with the max size
            _matrix4x4Array = new Matrix4x4[bufferSize];
            // set the data of the array
            for (int i = 0; i < _matrix4x4Array.Length; i++)
                _matrix4x4Array[i] = Matrix4x4.TRS(Random.insideUnitSphere * 15, Quaternion.identity, Vector3.one);
            // initialize the buffers with array
            GPUInstancerAPI.InitializeWithMatrix4x4Array(prefabManager, prefab.prefabPrototype, _matrix4x4Array);
        }
     
        private void Update()
        {
            if (Input.anyKeyDown)
            {
                // change the data of the array
                for (int i = 0; i < _matrix4x4Array.Length; i++)
                    _matrix4x4Array[i] = Matrix4x4.TRS(Random.insideUnitSphere * 15, Quaternion.identity, Vector3.one);
                // update buffers
                GPUInstancerAPI.UpdateVisibilityBufferWithMatrix4x4Array(prefabManager, prefab.prefabPrototype, _matrix4x4Array);
            }
        }
    }
     


Automatic detection and updating of transform position, rotation and scale changes



[Documentation coming soon]


Full or area localized rigidbody and physics support



[Documentation coming soon]


Instance based material variations through API (similar to Material Property Blocks)



[Documentation coming soon]


Enabling and disabling instancing at runtime per instance basis



[Documentation coming soon]


API to manage instanced prefabs at runtime



[Documentation coming soon]


Includes mobile demo scene with custom controllers



[Documentation coming soon]


Detail Instancing Features


Dense grass fields and vegetation with very high frame rates



[Documentation coming soon]


Included vegetation shader with wind, shadows, AO, billboarding and various other properties



[Documentation coming soon]


Support for custom shaders and materials



[Documentation coming soon]


Cross quadding support: automatically turns grass textures to crossed quads



[Documentation coming soon]


Ability to paint prefabs with custom materials on Unity terrain (with Unity terrain tools)



[Documentation coming soon]


Ability to use prefabs with LOD Groups on Unity terrain



[Documentation coming soon]


Further performance improvements with automatic spatial partitioning



[Documentation coming soon]


API to manage instanced terrain detail prototypes at runtime (examples included)



[Documentation coming soon]


Editor GPU Instancing simulation



[Documentation coming soon]


Tree Instancing Features


Dense forests with very high frame rates



[Documentation coming soon]


Speed Tree support with wind animations



[Documentation coming soon]


Tree Creator support with wind animations



[Documentation coming soon]


Included billboard baker and renderers



[Documentation coming soon]


Custom vertex color wind animation support for Soft Occlusion Tree shaders



[Documentation coming soon]


Third Party Integrations


Gaia integration



[Documentation coming soon]


Map Magic integration



[Documentation coming soon]