Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

[RELEASED] GPU Instancer

Discussion in 'Assets and Asset Store' started by LouskRad, May 3, 2018.

  1. kspeeder

    kspeeder

    Joined:
    Apr 9, 2018
    Posts:
    5
    hi, your hdrp demo scenes don't seem to be working properly, and if they are, theres no performance improvement at all. i'm also having issues with generating billboards and getting any tree assets to work with gpu instancer. have you tested your asset recently? i have been having issues with your out of the box solution and your tutorials are not helping much. is gpu instancer just not compatible with hdrp at all? i can't get the tree manager to work and theres no tutorial for that, and the wiki doesn't explain anything about what to do when following the instructions doesn't work. please help/
     
  2. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    481
    Hi there,
    Please first update to the latest Unity LTS version to make sure the issue is not caused by a solved Unity bug. If it does not help, please email us a bug report with a sample project following this guide and we can investigate.
     
  3. -Singularity-

    -Singularity-

    Joined:
    Jul 27, 2014
    Posts:
    122
    Hi, loving GPUI

    I have a problem with custom lighting though - point lights don't seem to effect GPUI instanced items when they are using a toon shader. (toon shader is build in amplify and seems to auto update for GPUI fine)

    Is this expected? Might have missed something.

    Directional and ambient seem to register fine

    Using built in on unity 2017.4 LTS
     
    Last edited: Jul 24, 2023
  4. sdargiewicz

    sdargiewicz

    Joined:
    Aug 2, 2018
    Posts:
    3
    Hi, is there a way to sync the Detail Managers to the terrain all at once? I use Microverse (a terrain generation tool) to set the details and often change the parameters such as the detail scale or the type of prefab. But since I have many terrains, and each terrain has it's own Detail Manager, it's awful to try and keep them in sync manually.

    Selecting multiple Detail Managers and trying to change settings doesn't work - only 1 actually changes. Deleting and recreating the managers from the Tools menu doesn't work - it keeps the same settings as when I deleted it. It's like you only get one shot to automatically add the detail managers. After that, you're on your own.

    Any ideas on how to handle this would be much appreciated!
     
  5. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    481
    Hi there,
    We used to have this on the Known Limitations:
    Since GPUI do not support versions prior to 2019.4 anymore, this was removed from the limitations.

    Hi there,
    Detail Manager has a method called GeneratePrototypes which you can call to read the prototype data from the terrain.
    Add the following method to a script and you should have a new option under "Tools->GPU Instancer->Regenerate Detail Prototypes" which will regenerate the detail prototypes.
    Code (CSharp):
    1. [MenuItem("Tools/GPU Instancer/Regenerate Detail Prototypes", validate = false, priority = 1102)]
    2. public static void GPUIRegenrateDetailPrototypes()
    3. {
    4.     GPUInstancerDetailManager[] detailManagers = UnityEngine.Object.FindObjectsOfType<GPUInstancerDetailManager>();
    5.     foreach (var detailManager in detailManagers)
    6.     {
    7.         detailManager.GeneratePrototypes(true);
    8.     }
    9. }
     
  6. -Singularity-

    -Singularity-

    Joined:
    Jul 27, 2014
    Posts:
    122
    That's perfect thankyou - need to decide if I can live with the pain of upgrading!
    Cheers
     
  7. Astfgl

    Astfgl

    Joined:
    Jan 19, 2014
    Posts:
    78
    Hi,

    This week I've been debugging some long-standing issues that we've had with GPU Instancer's occlusion culling, particularly on consoles but also on Mac. I've found two small but rather severe bugs in the Hi-Z occlusion generator that you'll probably want to fix.

    Firstly, the number of mip levels calculated for the Hi-Z depth texture is off by one. It's this line that it's about:
    Code (CSharp):
    1. _hiZMipLevels = (int)Mathf.Floor(Mathf.Log(hiZTextureSize.x, 2f));
    Inspecting the Hi-Z copy and downsample shaders in a GPU profiler confirms that the Hi-Z depth texture created by Unity has one more mip level than GPU Instancer thinks it does.

    The result of this is that the highest mip level of the Hi-Z depth texture never gets written to. On PC this doesn't really matter because by default textures are cleared to 0 on creation, so any object tested against this will always pass. However on other platforms textures are not always cleared, meaning that highest mip level will contain whatever random value happens to be in VRAM at that location. If this value is close enough to 0 it'll be fine, but if the value is too high then large objects will suddenly start appearing and disappearing at random as you move around.

    I've compared it to the mip count calculation from a different codebase, and the correct line should be this:
    Code (CSharp):
    1. _hiZMipLevels = 1 + Mathf.FloorToInt(Mathf.Log(Mathf.Max(hiZTextureSize.x, hiZTextureSize.y), 2f));
    That also allows occlusion culling to properly handle vertical aspect ratios. Changing the line to this fixed the problem we were seeing where trees would randomly and intermittently disappear and reappear.

    Secondly, the Unity depth texture that gets copied to build the Hi-Z depth texture is grabbed from the camera like this:
    Code (CSharp):
    1. unityDepthTexture = Shader.GetGlobalTexture("_CameraDepthTexture");
    This works fine on most platforms but on a few platforms this gets you a combined color + depth texture. The result of this is that the Hi-Z depth generator copies the R channel from the color buffer instead of the depth buffer. This obviously causes all sorts of occlusion culling errors, as brightness will be interpreted as depth. The clearest symptom of this is when objects are constantly flickering in and out of existence.

    The correct way to grab depth from the camera would be to use a RenderTargetIdentifier with the RenderTextureSubElement.Depth argument and pass this to SetComputeTextureParam. However this only works with command buffers, so it requires the UpdateTextureWithComputeShader method to be rewritten using a command buffer. Fortunately this isn't too hard to do, and doing so fixed the flickering foliage issue in our project.

    I've confirmed that these problems still exist in the latest GPU Instancer release (1.7.7) so hopefully this information helps.
     
    Dark-1-Games, Zaddo, GurhanH and 2 others like this.
  8. sdargiewicz

    sdargiewicz

    Joined:
    Aug 2, 2018
    Posts:
    3
    This worked wonderfully, thank you!
     
  9. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    481
    Hi there,
    Thank you for the feedback. We will investigate it and make the necessary changes in a future update.
    On a side note, we were using command buffers before but we had to change it because of issues on many SRP versions. Using a specific method can work on a specific Unity version with a specific render pipeline. But we have to take various Unity versions with different render pipelines across multiple platforms into consideration. So there will be most probably issues on other setups if we switch to command buffers. But I will consider implementing it as an option.
     
    Astfgl likes this.
  10. TaylorCaudle

    TaylorCaudle

    Joined:
    Feb 8, 2018
    Posts:
    152
    Hey there, quick question- I'm starting to setup my actual level design now, in my experience int he past I've basically structured it like this:

    ---> Modeled/Generated Terrain, with splatmaps and textures
    --->Vegetation instanced on top (using Vegetation Engine or VSPro, etc)
    --->GPU instanced meshes and Static Batching for buildings, props, etc.

    I'm trying to optimize things the right way, but basically i have a TON of atlassed-materials/textures, and I'm struggling to find the right way to balance the "repeatable, same-mesh, same-material, same-texture" props I'm scattering all over the place, with all the DIFFERENT meshes that use the same material. Right now, I have a copy of each material, one with instancing off, that I put on all my Batched meshes, so that the props that use the Instanced variant don't get disabled/included in the batching,

    But i was wondering how i might optimize things using your system- would i basically JUST use your Protoypes in place of my "repeatable instanced prefabs," or would it be a negligible improvement since theyre already using Instanced materials by default?
    I should note that SOME of these prefabs will have colliders, but others will be "background assets" with either low LODs or low poly geometry.
     
  11. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    481
    Hi there,
    Please see the Terminology and Best Practices pages to learn in which cases using GPUI is beneficial and how to use it correctly.
     
  12. Simunek

    Simunek

    Joined:
    Jul 15, 2016
    Posts:
    48
    Hi! I tried Unity 2022.3 LTS with GPUI, and it wasn't working properly. I would like to ask if it is officially supported or if I should just debug it harder. Thanks!
     
  13. Zaddo

    Zaddo

    Joined:
    May 19, 2012
    Posts:
    76
    I'm new to GPU Instancer and I'm working on understanding its usage. Despite going through the documentation multiple times, including the FAQ on using it with multiple terrains, and searching the forums, I'm still a bit unclear. There are three scenarios I need to address:

    1. Handling a large open world (consisting of 900 terrains) with a floating origin. Each scene has one terrain.
      • According to the documentation, I believe I need to include a dummy terrain in my main scene to add the Tree Manager. Then, I can utilize either the GPUInstancerTerrainRuntimeHandler component or the API functions AddTerrainToManager/RemoveTerrainFromManager to manage scene loading as the player traverses the world.
      • I'm uncertain about the statement in the documentation: "Please note that if the terrains that have this component have differing tree prototypes, this will result in an error." Does this mean that I must place all the trees used in the game on the dummy terrain in the main scene, as well as in all other scenes? Or is it possible for each scene to have a subset of trees specific to that scene?
    2. Managing prefabs in scenes:
      • Should I only have one Prefab Manager in my main scene and then add each prefab I want GPUI to handle into it? Or is it necessary to include an instance of the Prefab Manager in every scene?
      • The documentation suggests that I need to "Register Instances in Scene." Does this imply that I require a Prefab Manager instance in each scene? Does the optimization occur when each scene is loaded during runtime?
    3. Loading prefabs at runtime:
      • Currently, I implement a grid system to load small, interactive objects (like stones or sticks) close to the player at runtime. I'd like to use GPUI for this purpose and plan to use the AddPrefabInstance/RemovePrefabInstance functions.
      • It seems straightforward: I add these small objects when the scene loads and remove them when it unloads. I'll enable Frustum/Occlusion culling for this prefab and set the max distance to a small value, such as 50.
      • I must identify each of these objects as they can be picked up by the player. They each have a unique EntityID set on a component. I intend to use pooling to create instances, configure each one, and then add them to GPUI. Will this approach work effectively?
    Regarding my experience, GPUI seems to automatically update shaders in my project, which caused issues with my procedural worlds Gaia shaders. These shaders weren't even used in the scene where I added GPUI. Is there any way to control the changes that GPUI makes to my project?
     
    Last edited: Aug 10, 2023
  14. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    481
    Hi there,
    It is officially supported. We do not have any known issues specific to 2022.3. If you encountered a problem please make a bug report following this guide and we can investigate.

    Hi there,
    1- Each manager makes its own draw calls based on the prototypes that are defined on it. If you have 1 Tree Manager for multiple terrains, then the draw calls for the same trees on multiple terrains will be batched. If you have one Tree Manager per terrain, then draw calls only for one terrain will be batched.
    If you use 1 Tree Manager for multiple terrains, then every terrain needs to have the same tree prototypes with the same order.
    2- You can have 1 Prefab Manager on your main scene and then enable the Auto. Add/Remove Instances option for the prototypes.
    3- If you have a case where there will be frequent adding/removing/updating with many instances, it will be most efficient to use No-GameObject Workflow.

    GPUI creates auto. converted shaders when a prototype is added to one of the managers that uses a custom shader. You can disable this feature by disabling the Auto Shader Conversion option on GPU Instancer Preferences.
     
    Simunek and Zaddo like this.
  15. tomfulghum

    tomfulghum

    Joined:
    May 8, 2017
    Posts:
    69
    Hi there! We recently started using GPUInstancer to draw our foliage and it's been working great so far!
    We're using our own painting tool to place foliage in the editor and GPUI's No-GameObject-Workflow to draw them during play mode. The PrefabManager instance lives in a single persistent scene while the levels with foliage are separate scenes.

    With this setup, what would be the optimal way to utilize GPUI to also draw the foliage during edit mode? We want to avoid having to place a PrefabManager in every scene and can't guarantee that the persistent scene will always be loaded while editing a level. Currently we're just using Unity's RenderMeshInstanced, but this approach is beginning to cause performance issues.

    Thank you!
     
  16. ysundawa

    ysundawa

    Joined:
    Mar 2, 2020
    Posts:
    33
    Hi,

    Just upgraded my Unity to 2022.3 LTS, and found a strange behavior.
    Using MM2 Integration, I saw some Trees disappearing within certain distance, and reappearing within another distance. Seems like one of the LOD level make it gone from the camera.

    But this is only happen in Built, while in the Editor everything is fine.

    please let me know where should I start checking ..
    Many thanks ~
     
  17. ysundawa

    ysundawa

    Joined:
    Mar 2, 2020
    Posts:
    33
    Got 1 error in the build window as below :

    Shader error in 'GPUInstancer/Billboard/BillboardURP_GPUI': undeclared identifier 'unity_WorldToObject' at Assets/GPUInstancer/Shaders/Include/GPUIBillboardSGInclude.cginc(16) (on d3d11)

    Compiling Subshader: 0, Pass: Universal Forward, Vertex program with DOTS_INSTANCING_ON _BILLBOARDFACECAMPOS_ON
    Platform defines: SHADER_API_DESKTOP UNITY_ENABLE_DETAIL_NORMALMAP UNITY_ENABLE_REFLECTION_BUFFERS UNITY_LIGHTMAP_FULL_HDR UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BLENDING UNITY_SPECCUBE_BOX_PROJECTION UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS
    Disabled keywords: DIRLIGHTMAP_COMBINED DYNAMICLIGHTMAP_ON FOG_EXP FOG_EXP2 FOG_LINEAR INSTANCING_ON LIGHTMAP_ON LIGHTMAP_SHADOW_MIXING PROCEDURAL_INSTANCING_ON SHADER_API_GLES30 SHADOWS_SHADOWMASK UNITY_ASTC_NORMALMAP_ENCODING UNITY_COLORSPACE_GAMMA UNITY_FRAMEBUFFER_FETCH_AVAILABLE UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS UNITY_HARDWARE_TIER1 UNITY_HARDWARE_TIER2 UNITY_HARDWARE_TIER3 UNITY_LIGHTMAP_DLDR_ENCODING UNITY_LIGHTMAP_RGBM_ENCODING UNITY_METAL_SHADOWS_USE_POINT_FILTERING UNITY_NO_DXT5nm UNITY_NO_FULL_STANDARD_SHADER UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF2 UNITY_PBS_USE_BRDF3 UNITY_PRETRANSFORM_TO_DISPLAY_ORIENTATION UNITY_UNIFIED_SHADER_PRECISION_MODEL UNITY_VIRTUAL_TEXTURING _ADDITIONAL_LIGHTS _ADDITIONAL_LIGHTS_VERTEX _FORWARD_PLUS _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN
     
  18. DeadPoet

    DeadPoet

    Joined:
    Jan 7, 2013
    Posts:
    32
    one question. when do you expect an update for unity 2023? 23 has a lot of updates e.g. for HDRP, but its stili n beta: https://unity.com/releases/editor/beta in unity 23 the gpu instancer vegetation is sadly broken in HDRP. Do you think you will have an update in around half year?.
     
    Last edited: Aug 22, 2023
  19. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    1,152
    Hello!

    I have come across an ArgumentException on the following line of code (from the RemovePrefabInstances method of the GPUInstancerPrefabManager class, line 863):

    prefabInstanceList.RemoveRange(prefabInstances.ElementAt(0).gpuInstancerID - 1, count);

    Correct me if I am wrong, but this line of code will only work if the prefabInstances passed into the method are in the exact same order as their gpuInstancerIDs, with the first instance to remove having the smallest ID value, and there being no gaps in the IDs.

    For example, let's say the list of registered prefabs has these gpuInstancerID's:
    [1, 2, 3, 4, 5, 6]

    Now I want to remove some of these instances. I will only be able to remove prefab instances if I pass in a list that has the prefab with the smallest ID at index 0, with the rest of the items in the list having the next ID.

    For example:
    [1, 2, 3]
    [3, 4, 5, 6]
    [5, 6]

    But in a real game, the instances to remove will be unsorted and almost certainly contain gaps, because when destroying game objects in the world, the objects will be random.

    Examples of real world lists of prefab instances to remove (identified by gpuInstancerID):

    [1, 3, 5] - passing this to RemovePrefabInstances will result in prefab Instances 1 (correct), 2 (incorrect), and 3 (correct) being removed.

    [4, 2, 6] - This will result in Prefab Instances 4 (correct), 5 (incorrect), and 6 (correct) being removed.

    [6, 1] - This should actually result in an exception since 6 is the last prefab instance in your internal registered prefabs list.

    This results in the internal registered prefab instance list becoming corrupted, which results in errors and exceptions (such as the ArgumentException I am seeing).

    To rectify this, I believe you only need to remove line 863, then add the following line of code to the foreach statement that iterates over the prefab instances to remove:

    prefabInstanceList.Remove(pi);

    It is less efficient than using RemoveRange, but *shrug*. If the input prefabInstances list is sorted by gpuInstancerID, I believe a more efficient removal technique can be achieved by iterating backwards over the prefabInstances (to remove) and using:

    prefabInstanceList.RemoveAt(pi.gpuInstancerID-1)

    However, this would require anyone using this method to pre-sort the list, which you may not want to enforce.

    Best Regards

    Edit: I made the code change outlined above and the ArgumentException no longer occurs, so I believe my assumptions about this line of code being wrong are correct.
     
    Last edited: Aug 24, 2023
    sirleto likes this.
  20. GreaserMonkey

    GreaserMonkey

    Joined:
    Feb 10, 2019
    Posts:
    65
    Regarding Map Magic 2, should GPU Instancer work with Map Magic 2 infinite terrains?
     
  21. Dark-1-Games

    Dark-1-Games

    Joined:
    Mar 26, 2014
    Posts:
    99
    Hi there,
    Just dropping in to ask what the state of motion vector rendering is in GPU Instancer on URP?
    It is essential for TAA and FSR2, and we're looking to use GPU Instancer for rendering terrain details.
     
    sirleto likes this.
  22. ysundawa

    ysundawa

    Joined:
    Mar 2, 2020
    Posts:
    33
    I am not the creator, but from my experience, yes it works, as long we have a consistent prototype
     
  23. GreaserMonkey

    GreaserMonkey

    Joined:
    Feb 10, 2019
    Posts:
    65
    Okay, I've tried GPU Instancer with Map Magic 2 and it seems to work with infinite terrain but if player travels beyond initial terrain then trees and grass do not appear any more. I'm not sure if this is a bug or something wrong with my prototype.
     
  24. Oniros88

    Oniros88

    Joined:
    Nov 15, 2014
    Posts:
    144
    is it possible to use at all in HDRP?

    Any instancing used by this creates extreme flickering and artifacts with ambient occlussion, water system, volumetric clouds, TAA and motion blur due to motion vectors... Essentailly anything that requires motion vectors cannot be used if you use GPU instancing. Is motion vector support possible or planned?

    It's a shame because it allows me to put much more grass than normal in my scene, but I have to turn off those features.
     
    Last edited: Aug 31, 2023
  25. ironfiftynine

    ironfiftynine

    Joined:
    Jan 22, 2013
    Posts:
    71
    Good day. I made a terrain using a package called Microverse and I would like to use the Tree Manager for Terrains feature. I tried it and it was able to identify the painted trees as needed. However, the shader that these trees use is the SpeedTree_PBRLit included in the Universal RP package so it throws the error ShaderGraph shader does not contain GPU Instancer Setup. I checked the wiki for the ShaderGraph setup but given that the shader is set to readonly as it is part of the package folder, I can't change it as suggested in the Wiki. I also tried using the FoliageURP_GPUI_SG shader to make the prototype work but as expected, the trees looked different. Any suggested workaround for this case? Thank you.
     
    Last edited: Aug 30, 2023
  26. CasualDutchman

    CasualDutchman

    Joined:
    Jan 20, 2016
    Posts:
    37
    I love GPU Instancer, it really helps to add life to a scene, since it can handle lots of grass and other details. Love it.

    I do have 1 feature request and I am not sure if it would be hard to implement.
    'Use Culling for Shadows' currently culls on every LOD, but I would like lod 0 to not cull shadows.
    If I look away from a tree that I'm standing next to, I would like for the shadow to keep showing.
    Now, the shadow flickers on and off depending on whether the tree is in view or not.

    I know this is the intended outcome and the documentation warns the flicker will happen.
    But it would add so much more value for us. Thanks
     
    sirleto likes this.
  27. sirleto

    sirleto

    Joined:
    Sep 9, 2019
    Posts:
    116
    Question: does gpuinstancer "respect" Camera.layerCullDistances ?
    https://docs.unity3d.com/ScriptReference/Camera-layerCullDistances.html

    EDIT: I know that i can change the settings of distance per prefab in your UI, but i would prefer to use the unity layer system as i have then a more convenient way to group many different prefabs into reasonable distances.
     
    Last edited: Sep 1, 2023
  28. Bezoro

    Bezoro

    Joined:
    Mar 16, 2015
    Posts:
    131
    • Any way to add LOD crossfading for ShaderGraph Materials? I was hoping setting Support LOD Cross Fade would be enough, but no dice.
    The harsh pop is pretty distracting...
    The default terrain tree renderer can do it but GPUI turns all trees invisible if I try to turn it on.​
    • Is there any way to have GPUI render terrain grass 1 to 1 with what was painted in the terrain? The grass always shifts a bit when GPUI takes over.
    In my case its grass meshes with GPU Instancing, not the usual texture grass.​
    • Can GPUI do LODs for terrain grass? doesn't seem like it, I tried everything I could think of.
    I'm currently just painting grass as prefabs and using the GPUI Prefab Manager to handle them so I can use LODs but I'd rather have both options, especially since scattering thousands of prefabs can quickly turn a scene that would be 5MB into 50MB.​
    • In a game where the entire world is one scene made up of many chunks (prefabs that get streamed in and out based on distance from the camera), can GPUI handle the constant loading/unloading of prototypes? So for example grass/rocks/trees getting loaded/unloaded as the player moves around?
    Ideally these objects would be authored as prefabs (scattered/painted/placed using tools) for convenience and GPUI Prefab Manager would take over their rendering at runtime. I am worried that this usecase wasn't considered and could cause issues.​
    • Does GPUI do any chunking? Or is it calculating all instances all the time?
    Think of a large area filled with grass. If I am in one extremity of it am I still processing all those grass instances that could be kilometres away from me?​
     
    Last edited: Sep 16, 2023
    sirleto likes this.
  29. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    481
    Hi everyone,
    and sorry for the late replies. I was unavailable for the last couple of weeks. Now I will post the replies to your questions in chronological order. If there are any new/unresolved issues or if I miss some questions please send a support request following this guide. Thank you for your patience.
     
  30. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    481
    Hi there,
    You can use the StartEditorSimulation/StopEditorSimulation API methods to render instances in Editor Mode. However you will need the Prefab Manager to be present it the scene for it to function. Unfortunately there is no method to render without a manager.
     
    tomfulghum likes this.
  31. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    481
    Hi there,
    I did not have the chance to inspect 2023 HDRP yet. I will investigate it within the next couple weeks and make an update and/or inform about new limitations if necessary.
     
  32. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    481
    Hi there,
    RemovePrefabInstances method is designed for specific cases (e.g. streaming terrains) to remove instances in a fast manner. It is not for general use and it might cause issues, even with your modification, if used for other purposes. That is why this method is not included in the GPUInstancerAPI. If you need to remove multiple instances, recommended way is to call the RemovePrefabInstance API method for each instance.
     
  33. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    481
    Hi there,
    GPUI uses the DrawMeshInstancedIndirect method and it does not support motion vectors. We are not planning on making any fundamental changes to GPU Instancer currently. However, we are working on a new asset where we redesign the core system to overcome various shortcomings of the current system. This new design will also use the RenderMeshIndirect method which can be used with motion vectors. Please note however it is in development and it does not have a release date yet.
     
  34. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    481
    Hi there,
    Can you please make a bug report following this guide so we can investigate?
     
  35. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    481
    Hi there,
    You need to copy the shader to your Assets folder and rename and edit it to support GPUI. Then also modify the tree materials to use the new shader.
     
  36. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    481
    Hi there,
    We prefer not to add any more options since too many parameters start causing performance issues. However you should be able to add this behavior by changing one line of code:
    GPUInstancer/Resources/Compute/Include/Camera.hlsl line 26
    Code (CSharp):
    1. if (distance < shadowDistance && (!cullShadows || !isCulled || i == 0))
     
    CasualDutchman likes this.
  37. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    481
    Hi there,
    Unfortunately it is not supported. Since GPUI uses indirect GPU instancing, Unity can not apply position based culling on the instances (positions are set in the shader).
     
  38. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    481
    Hi there,
    GPUI requires a custom solution for crossfading. If you are using URP, please see the attached shader for an example on how to add cross-fading support to URP shadergraphs. I will look into adding a simpler solution for this in a future update.

    Detail instances are placed in random positions within their cells. If you have a high terrain size with low detail resolution, the cell size will be big. To reduce the changes caused by random values, you need to increase the Detail Resolution. But it will never be exactly the same when using terrain details.

    You can add prefabs with LODs to the Detail Manager (see the Fern_01_LOD object in DetailInstancingDemo).

    If you use Prefab Manager and have to add/remove many objects frequently, the most performant method is using the no-GameObject workflow.
     

    Attached Files:

    Bezoro likes this.
  39. richmerren

    richmerren

    Joined:
    Apr 23, 2014
    Posts:
    5
    Hello Guys, great asset.
    How do I use the Bone Updates feature with a non-gameobject workflow?
    I've been looking everywhere for the list that contains the matrix of the exposed bone updates and have not been able to find it.
     
  40. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    481
    Hi there,
    Bone Updates can only be used with Transforms out of the box. If you wish to implement a custom solution, please see the ApplyBoneUpdatesJob inside GPUICrowdRuntimeData.cs. You can use it as a baseline.
     
    richmerren likes this.
  41. GamePowerNetwork

    GamePowerNetwork

    Joined:
    Sep 23, 2012
    Posts:
    257
    Been using GPU instancer for a few weeks now with zero issue for terrain details and trees.

    However in my new scene using Synty assets, just a simple floor prefab added to the Prefab Manager shows up invisible when in play mode. There are no LODs for this prefab, just a mesh and colliders. The mesh shows in the scene view but invisible when I press play.
     
  42. DirtyHippy

    DirtyHippy

    Joined:
    Jul 17, 2012
    Posts:
    224
    Hi -

    Is there any way to get the last lod and cull LOD to crossfade correctly when animated crossfade is on? Meaning, crossfade into the last LOD from nothing, and vice versa, from the last LOD to nothing. Non-cull lod transitions crossfade correctly with animated on (just not the last transition). Also, crossfade works fine between the last lod and the cull lod with animated crossfade off. With it on, it simply just snaps visible/non-visible. I swear this once worked correctly. I've been seeing this for a while but never bothered to post about it. I just did a quick test with a standard shader cube with 2 lods where the GPUI max distance was significantly higher than the cull distance from the cull lod and was able to repro it (and verified with animated off, it correctly crossfades).

    Note: built-in, 2022.3.x
     
  43. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    481
    Hi there,
    In cases like these, most common issue is an incorrect shader setup. If the prefab is using a custom shader, please follow these instructions and make sure the shader is set up correctly.
    If this does not help, please contact the support email with a sample project following this guide and we can investigate the issue.

    Hi there,
    You can enable crossfading for the last LOD by removing "oldLodNo < 9 && lodNo < 9" checks at line 55 in GPUInstancer/Resources/Compute/Include/Camera.hlsl.
    I can not remember exactly why this check is there. It might just be a preference. But if you see an issue, please let me know.
     
    sirleto likes this.
  44. DirtyHippy

    DirtyHippy

    Joined:
    Jul 17, 2012
    Posts:
    224
    Hi, this won't work since lods that are out of the frustum will presumably have an lod of 9, so as you turn, the lods will fade in as they come into the frustum (this happens when I test it). I actually have implemented my own direct instancing layer in tandem with the custom layer I wrote using indirect instancing and GPUI, and I implemented all of the GPUI prototype features there, including animated crossfade. This was actually a bit tricky to get working correctly because there are a lot of edge cases around instances coming into and out of view.
     
    sirleto likes this.
  45. PixelDough

    PixelDough

    Joined:
    Apr 27, 2018
    Posts:
    46
    I'm having an issue in HDRP in 2023.2.0b12, preventing me from building. When I build, the Lit_GPUI shader has 7 errors. I'm having no issues in-editor, though, in play mode it works great

    Unity_Sp97aAUXif.png

    I understand this version of Unity is a beta, but I thought I would bring it up just in case it was something that has not been brought up yet. Or if there's already a known fix I have been unable to find :)
     
  46. Hugo99999999

    Hugo99999999

    Joined:
    Jun 8, 2022
    Posts:
    21
    Hello, I want to know why my model can't normal use GPU instantiation, my model is through PrefabUtility InstantiatePrefab instantiation of the API.
     

    Attached Files:

    • 144.png
      144.png
      File size:
      5.1 KB
      Views:
      5
  47. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    481
    Hi there,
    Thank you for the feedback. This is not a known issue. It is most probably a beta bug. I will look into it, if it carries on to a non-beta Unity version.

    Hi there,
    Please make sure that the prefab instances are registered to the manager. You can use the Register Instances in Scene button for the prefab instances that are added in editor mode. You can use the Auto. Add/Remove Instances option for the instances that are added in play mode.
     
  48. Hugo99999999

    Hugo99999999

    Joined:
    Jun 8, 2022
    Posts:
    21
    Hi GurhanH I found a problem when using the GPU manager, I added my script to the GPU instantiation API, and after running it my chain model was unusable. It doesn't move anymore. It seems to be limited by the GPU manager. When I cancel the GPU manager, my model can be used normally. I really want to use GPU instantiation, but this result is not what I want at present, please help me see how to solve this problem. I'm in a hurry. thank you
     
  49. Hugo99999999

    Hugo99999999

    Joined:
    Jun 8, 2022
    Posts:
    21
    I've already fixed the problem where the model doesn't move, and I forgot to check the settings under Runtime settings and when I check that, it moves normally. I have another problem. My current gameobject-free flow uses AA asynchronous loading to instantiate the gameobject from an empty scene. In my scene, I have two cameras, the first camera renders the main object and the second one renders its parts. How should I configure my GPU manager at this point so that I can use the best optimization for both cameras?
     
  50. Hugo99999999

    Hugo99999999

    Joined:
    Jun 8, 2022
    Posts:
    21
    I am now using two GPUI Prefab Managers to manage the two cameras in my scene, but I am using the "No Game Object Flow" scene script and the above reference is a GPUI Prefab Manager. How do I properly make the no Game Object flow use this multi-camera scene? Could you please take a look at it for me? thank you