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

[RELEASED] GPU Instancer

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

  1. Agatho_Kakological

    Agatho_Kakological

    Joined:
    Dec 27, 2019
    Posts:
    16
    @LouskRad Hii I generated a scene using gaia and then applied GPUI to the house prefabs on the scene, previously i was getting 27-35FPS but now after adding GPUI I'm getting 10 fps hardly, any solutions
     
    Corfekun likes this.
  2. holdingjason

    holdingjason

    Joined:
    Nov 14, 2012
    Posts:
    135
    Yes really hope they are on holiday or something as well. Just moved completely off of Veg Studio Pro which was no where near as fast as what I am getting using GPUI. This blows it away, granted you have to know and think a bit more on what to do but NOT that much more. Crushing my FPS rate and stops the annoying hickups I was getting before in VSP.
     
  3. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Hi. Thanks for the help, but I did try the second method but it does not add instances. It does register prototype, but it does not add inatances using this way. I know my method of adding instances using matrix is working because if I register prototype in editor time it does work.

    So the problem is if I register prototype in run time as your second method, adding instances using matrix does not work.
     
  4. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Code (CSharp):
    1. GPUInstancerPrefabPrototype prefabPrototype = GPUInstancerAPI.DefineGameObjectAsPrefabPrototypeAtRuntime(gpuInstancerPrefabManager, protoType.gameObject);
    2. GPUInstancerAPI.InitializeGPUInstancer(gpuInstancerPrefabManager, prefabPrototype);
    3. GPUInstancerAPI.InitializeWithMatrix4x4Array(gpuInstancerPrefabManager, prefabPrototype, ma);
    ma is correctly generated, and prototype is registered but no instances are added.. :(

    Even the document says the method to add instances with prototype registered with DefineGameObjectAsPrefabPrototypeAtRuntime is something else. So using matrix method is not working with that. But there are no method to make this possible.
     
    Last edited: Jun 26, 2020
  5. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,641
    The code works because I use it in that way. You need to do some debugging to understand the real reason why it doesn't work. I don't remember to have had particular problems in the past. Are you using the right shaders? The shader must be converted by GPUI to work.
     
  6. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Yeah, the shader is the right one. it is the converted shader. After attempting to add instances to the manager, and check the manager in inspector, I get 0 count.

    when I use edit mode to add prototype and use the exactly the same matrix array, it does add instances. So both shader set up and matrix set up is correct. humm..
     
  7. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    904
    Hi everyone,

    The GPUI team was on a short break and now we are back. I will read and answer questions in order below:

    Please take a look at this wiki article and see if it solves the problem.

    The LOD cross-fade issue is caused by Unity changing their implementation of the cross-fading system. As of now, there are technical limitations that prevent us to customize this and implement a generic cross-fading solution. I can only say that we can do this implementation if and when Unity changes the way they have implemented and limited our access to customizing the cross-fading system.

    What matters for GPUI is the GPU where the rendering is done (i.e. the client computer). You can manage your data in the server and render it using GPUI in client computers within the designed usage of GPUI.

    Your registration of the prototypes seems correct like this. It might be that the matrices used for the registered prototype are the culprit. If you are still having problems with this, you can email us a sample project and we can investigate the problem.

    GPUI uses two different compute shaders; where the camera calculation compute shader decides which instances are culled, and the visibility compute shader decides which instances to append based on the former. You could investigate the code to modify these compute shaders, but implementing a generalized solution for instance group culling would not be feasible.

    What I would suggest instead is implementing your own custom logic to enable and disable the instances based on such groups, and you can use this along with the existing frustum/occlusion culling of GPUI for the enabled instances.

    This is usually related to having many lights in your scene, where in forward rendering each light would run an add pass - resulting in the scene being GPU bound already. In deferred rendering you do not have this problem as there is a dedicated buffer (GBuffer) for this.

    Having said this, some post processing effects might also be slowing the scene down in forward rendering. You could also try using the included Depth/Normals shader instead of the built in one to see if it helps.

    Please take a look at the best practices wiki to see what would make good candidates for adding to GPUI as prototypes. Also, please make sure that you do not see any errors or warnings in the console related to GPUI - which might also be slowing the scene down.

    The reason why GPUI uses a shader variant collection is to get its generated shaders to your build automatically. Since it is in the Resources folder, this is handled without any additional input, but if you need to move this file out of the Resources folder, your solution would also result in the same.

    The number of compute shader calls depend mainly on LODs and shadow settings. Apart from this, your target platform, instantiation logic, etc could also increase or decrease this amount.

    There are three compute shader dispatches that are usually at work when rendering a prototype. Steps are:

    1) culling and LOD calculations
    2) appending of the instance
    3) appending of the instance shadows

    Mostly they use the same systems, with the only difference being that the Detail Manager uses 2D spatial partitioning - which is optimized for terrain details. With this additional step, there might or might not be a performance gain depending on your terrain size, amount of terrains, prototype count, etc.
     
  8. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Code (CSharp):
    1. Matrix4x4[] ma = new Matrix4x4[o.pos.Count];
    2.  
    3.                 for (int i = 0; i < o.pos.Count; i++)
    4.                 {
    5.                     ma[i] = Matrix4x4.TRS(o.pos[i], Quaternion.identity, Vector3.one * 0.25f);
    6.                 }
    7.  
    8.                 var prefabPrototype = GPUInstancerAPI.DefineGameObjectAsPrefabPrototypeAtRuntime(gpuInstancerPrefabManager, protoType.gameObject);
    9.                 GPUInstancerAPI.InitializeGPUInstancer(gpuInstancerPrefabManager, prefabPrototype);
    10.                 GPUInstancerAPI.InitializeWithMatrix4x4Array(gpuInstancerPrefabManager, prefabPrototype, ma);
    This is snipset of the code I am using to register my prototype and instances. I have confirmed that o.pos array is coming in correctly. It's either I am dumb and made stupid mistake, or this way is not supposed to work?

    The prototype does register this way. It just doesn't add any instances.
     
  9. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,641
    @castor76 that code looks correct to me, the problem must be somewhere else. Unluckily it can be so many things that it is hard to guess.
     
  10. holdingjason

    holdingjason

    Joined:
    Nov 14, 2012
    Posts:
    135
    *UPDATE* Ok so started digging more deeply into you api documentation and think I see that you already have examples for this at least I think so.

    "Updates and synchronizes the GPU Instancer detail prototypes with the modifications made in the manager at runtime. Use this if you want to make changes to the detail prototypes at runtime. Prototypes in the manager must be modified before using this. For example usages, see: DetailDemoSceneController and TerrainGenerator"

    So glad your back. Do you have a timeline on Map Magic 2 yet, you had mentioned that it would be updated in your next release.

    On that subject the reason we are looking into that is we have a decent sized open world and looking for ways to optimize the terrain and objects. MM 2 does that of course though not sure if a custom system might not still be more efficient tailored for our needs. SO if we rolled our own using GPUI do you have some recommendations basically we would be pooling a set of terrains, moving the terrain, updating its terrain data, wanting at that point to "refresh" the gpu detail manager that is hooked to that pooled terrain (I am guessing refreshing the detail manager on the fly at runtime is possible and hopefully fast). Game objects not on involved directly with the terrain is no biggy since that would just be using your non game object solution and loading and unloading the data as needed as you moved around.

    So really the question is about the best way to deal with terrain chunks and the details with those terrains in regards to GPUI? This relates back to my previous question on if there was much difference between using prefab manager and non game object loading vs detail manager which is why I was asking that question. One obvious solution is to not use the detail manager for terrains and everything is a prefab but not sure how that would work with grass etc?

    So really looking for some guidance on what would be the best solution. Must have some way to handle the details on generated/pooled terrains since you are planning on integrating with map magic 2.

    Thanks, terrific product and really appreciate the work you have done on this.
     
    Last edited: Jun 26, 2020
  11. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,641
    @LouskRad

    The reason why GPUI uses a shader variant collection is to get its generated shaders to your build automatically. Since it is in the Resources folder, this is handled without any additional input, but if you need to move this file out of the Resources folder, your solution would also result in the same.

    The number of compute shader calls depend mainly on LODs and shadow settings. Apart from this, your target platform, instantiation logic, etc could also increase or decrease this amount.

    There are three compute shader dispatches that are usually at work when rendering a prototype. Steps are:

    1) culling and LOD calculations
    2) appending of the instance
    3) appending of the instance shadows


    It's not the first time you tell me about the shaders collection being in the resource folder, but in reality, it doesn't answer my question. I couldn't find the code that explicitly loads that collection and I do not add it in the preload shaders collection list, so I am wondering if I have to care about it somehow to be sure that those shaders are preloaded not just used.

    Regarding the computer shaders, we do not use LODS, but I still see 3 LOD calls per prototype, so I think I need to investigate that further, is that right?

     
  12. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    I "think" I have finally figured out why instances were not showing up. I think it is because after registering the instances, I turn the gameobject of the manager off to toggle it back on for the later usage. But when I do that , I think the instances are lost. The same goes if I disable manager, all added instances are gone..

    Is this by design? It would be cool to have them kept but disabling or deactivating the manager gameobject to simply stop rendering the instances and rerender upon reactivating.

    If there is a good reason why the instances are destroyed on deactivation of manager gameobject instead of just not rendering them, I understand. But having to keep re-add all the instances again is a bit of pain when registered prototypes does stay kept with manager....
     
  13. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    1,276
    Oh, okay! That seems very doable :) But don't I need to update the InstanceBuffers (InitializeGPUBuffer), slowing down everything? Or would this be negligible? I know I wouldn't need to create a new instanceDataArray, just update the array values / instancecount / buffercount, would that be enough, or do I need to upload the new data to the GPU, every frame?
     
    Last edited: Jun 26, 2020
  14. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,641
    ah! I think we register prototypes from just loaded prefabs, not instanced gameobjects. I am not sure how it works with instances gameobjects, I wouldn't expect GPUI to add any extra monobehaviour on them to keep track of the changes.
     
  15. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    904
    Yes it is by design. Since for general use we cannot assume why the manager is being disabled, this is intended to prevent unnecessary memory usage and/or leaks. If you wish to keep instance data but disable rendering, you can use the SetInstanceCount API method to set the instance counts to 0 - effectively disabling their rendering.

    The MM2 integration will indeed be in our next update. We have delayed submitting this update (a week or so) to add a few more features, including a multi-terrain support for the TreeManager. This will help with the performance on multiple terrains with your trees, but this does not apply to the DetailManager. You can add your prefab type details to the TreeManager though.

    The Resources folder is a special folder type in Unity, whatever is in this folder (and whatever is referenced by those that are in this folder) always gets in your builds - including the shaders referenced by a ShaderVariantCollection.

    As for the compute shader dispatch calls, please notice that these are not draw calls, and these 3 steps are dispatch calls for all instances regardless of their LOD counts.

    The InstanceCount for GPUI is responsible for the entire array, so it would not work for segments of this array (e.g. culling instances in the middle of the array). Thus you would need to modify the the new data to the GPU also; one example would be to setting your instances to the GPUI buffer in your own custom compute shader before GPUI's LateUpdate usage.
     
  16. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,641
    @LouskRad thanks. Even if it's the resource folder, you still need to use

    Code (CSharp):
    1.  ShaderVariantCollection shaderVariantCollection = Resources.Load<ShaderVariantCollection>(GPUInstancerConstants.SETTINGS_PATH + GPUInstancerConstants.SHADER_VARIANT_COLLECTION_DEFAULT_NAME);
    to load it.

    In your code Resources.Load<ShaderVariantCollection> is used only in the place above, which is used in "
    SetDefaultShaderVariants"

    However, as far as I can see, "SetDefaultShaderVariants" does nothing in a built client. So yeah I am still confused. I am confident I am missing some piece of code, but I want you to confirm it and you must forgive me, but your explanation is still not clear.

    As far as I know the code should do something like :

    Code (CSharp):
    1. var collection = Resources.Load<ShaderVariantCollection>(GPUInstancerConstants.SETTINGS_PATH + GPUInstancerConstants.SHADER_VARIANT_COLLECTION_DEFAULT_NAME);
    2.  
    3. collection.WarmUp()
    but even with code, shaders could be loaded too late (it would be optimal to load shaders in the GPU memory as soon as possible, but this could be an obsolete concept nowadays, it's just what I remember from my old good days as gfx coder)

    Edit: I think I understood why I am confused. You are talking about loading shaders, I am talking about "preloading" them, the equivalent of putting the shader collection in here:

    upload_2020-6-26_20-1-21.png

    I still don't know if to have the best performance I should put your collection in there. That array doesn't just load shaders, it preloads them, which my guess means that it also put load them to the GPU memory as early as possible.

    Regarding the dispatches, I will be back to it once I have more info on my side (I want to study the code more before to ask more questions)
     
    Last edited: Jun 26, 2020
  17. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    I have one more question if I may.

    If I set my array of matrix and supply it to GPUInstancer, will it draw in that particular order? Or is it upto GPU to just draw them in any order it wants per frame?
     
  18. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,641
    GPUI doesn't sort the calls at all, but since the batches are quite big anyway it doesn't matter much. The order is probably not the order of submission, but it depends on how the drawcalls are going to be batched. I guess it may draw them in the order of the prototypes registered.
     
  19. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    I was talking about within the batch of per prototype. Where I build array of matrices. Was wonderijng if the gpu will render in the order that I built that array.
     
  20. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,641
    It's an interesting question. I didn't check the compute shaders yet, so it's for @LouskRad. GPUInstancer compute shaders are not hard to read, but my current understanding of a compute shader pipeline is too limited. My guess is that GPUI is exploiting GPU instancing and indeed I wouldn't be surprised if the order of the instances is the order of the matrices in the array.
     
  21. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    695
    @LouskRad
    But if I don't use GPU Instancer, LOD cross fade works well natively in Unity HDRP ...
    Can't somehow use the "native" way Unity is doing it?

    By the way, I have sent two emails to the support email regarding the Culling problem and two new problems that are happening to me.

    I have a presentation in 3 weeks and right now it is impossible for me to use GPUI for that presentation demo
    ... So I have a pretty serious problem.
    Would it be possible to give me a Fix/Solution for this time ??? I would greatly appreciate it ... Answer me in the emails if you want.

    Regards
     
  22. juliobds

    juliobds

    Joined:
    Dec 27, 2011
    Posts:
    25
    @LouskRad Just to let you know GPUI isn't working on iOS at all. I tried building the Asteroid example scene and running it on my iPad and I got the following error:

    Execution of the command buffer was aborted due to an error during execution. Caused GPU Hang Error (IOAF code 3)

    I tried rebuilding and using the simulator and the same thing happened. At this moment GPUI is completely unusable on iOS. Unless I missed a critical step, but I couldn't find any specific steps for mobile on the documentation.

    I'm using the latest version of GPUI on the asset store, using URP, and tried with both Unity 2019.4.1f1 and 2020.1.0b13. I'm on macOS Catalina 10.15.3 and Xcode 11.5 .

    I'm running this on a bit of an older machine but it worked in the editor:
    MacBook Pro (Retina, 15-inch, Late 2013), 16GB Ram, NVIDIA GeForce GT 750M 2 GB

    If you cannot reproduce the issue let me know and we can initiate a support email thread.
     
  23. MrDigitalBoss

    MrDigitalBoss

    Joined:
    Feb 28, 2020
    Posts:
    2
    @LouskRad Have a big issue with Gpu Instancer.When instancing grass with it,dynamic blending system according to player position which works at grass's shader,just don't works.How to fix that issue?
     
  24. jaeeunpark

    jaeeunpark

    Joined:
    Feb 3, 2020
    Posts:
    4
    How can I use diffuse profile for HDRP foliage shader?
    I put some definitions on top of shader and diffusionprofilehash as below, but foliage shows only shaded black.
    Am I missing something?

    Definitions
    #define _MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1
    #define _MATERIAL_FEATURE_TRANSMISSION 1

    hard coded setting diffusion profile
    surfaceDescription.DiffusionProfile = asfloat(uint(1081006321));
     
  25. alex_1302

    alex_1302

    Joined:
    Aug 20, 2019
    Posts:
    54
    Hi LousKRad.
    I am using gpu instancer tree Manager. it works fine, but i have a situation and maybe you can help me:
    - i am working in a multiplayer fps. and when the player shoots to a tree i make the tree falls down. to make that effect when the level is loaded i put a capsule collider on every tree on the terrain (is s slow process because my terrain is big), and with every collider i set the tree index of the associated tree, so when the players shoots a tree i get from the collider the tree instance index of the tree, and then i use RemoveInstancesInsideCollider of gpui to delete the tree and then i instance a new tree, but like a regular gameobject (with the same tree prototype, in the same position, with the same rotation and the same scale) of the hitted tree), i get the tree data using my capsule collider. But i was thinking that if there was a method like QueryInstancesInsideCollider (it doesn't exists) returning the tree instances. it would be great, because it
    should eliminate the need for locate a collider in every tree position. My questions: could you help me to get a way to get the tree instances inside a collider ?. I think that it could be very useful to many users like me.

    Thanks ind advance. and i hope you have a nice day.
     
    Last edited: Jul 2, 2020
  26. kanestudio

    kanestudio

    Joined:
    Jan 29, 2018
    Posts:
    7
    Hi LousKRad.
    I have some problems with Grass shadows. The grass is in the shadow side but in the distance the grass completely lit, but when i move the camera near the grass the shadows show up. Did I make any wrong with settings? My setting: camera rendering path: Deferred, Shadow distance 300, Grass using Meadow Environment assets.
     

    Attached Files:

  27. axvr

    axvr

    Joined:
    Aug 8, 2015
    Posts:
    18
    Require OpenGL ES 3.1 (Android 8). So this can't work on Oculus Quest (Android 7.1.1) VR?
     
  28. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    904
    Yes, GPUI does neither use the ShaderVariantCollection for loading shaders, nor warming them up. It is only used for shaders to be included in the builds.

    we saw that they were ordered by prototype and instance data, but I cannot say for sure since this would depend on Unity's draw API implementation (and the GPU).

    Thank you for the feedback. We will check if anything has changed on the new Unity versions for the iOS side that will require a change in the GPUI code.

    Most likely the blending system you are using is not compatible with procedural instancing.

    We haven't tested this, so I can't offer any advice on it right now.

    Since the instance data is handled in the GPU, accessing instances with a readback would not be ideal. One way to go about this would be to use the trees with the Prefab Manager (instead of terrain trees with the Tree Manager) and customize the behavior according to your needs.

    This should be related to pipeline render settings and the shader/material or light settings. GPUI shadow settings would not have such an effect as in your video.

    GPUI does not officially support Occulus Quest, because the platform offers limited compute shader support.

    We have had reports from our users that they successfully use GPUI in Occulus Quest, and mainly by limiting their projects to the requirements of this device. However, we have not tested GPUI in this platform and cannot give you the specifics of a correct setup.
     
  29. MrDigitalBoss

    MrDigitalBoss

    Joined:
    Feb 28, 2020
    Posts:
    2
    @LouskRad How can I make compatible it for procedural instancing? Could you suggest any idea for that,please? (I use shadergraph)
     
  30. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    904
    I cannot comment on that without knowing what the shader is doing and how.
     
  31. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    904
    Hi everyone,

    GPUI v1.4.2 is now available on the Asset Store. With this version, there will be some important changes that you can find below:

    Unity versions: To support the new and changing features of Unity, new GPUI versions from v1.4.2 on will now only officially support Unity 2019.1.10 and later versions. The latest GPUI version before this (v1.4.1) will still be available to download and you can use it for Unity versions before 2019.1.10.

    Assembly Definition Files: To integrate better with the new Unity package workflows, GPUI now will include Assembly Definition Files (asmdef). This might in some cases cause a first time import problem. If you are having any issues after importing this version, please re-import the GPUInstancer folder first to see if this solves the issue. If not, please remove the previous GPUI version from your project and make a clean install from the Asset Store.

    Map Magic integration: This version introduces support for Map Magic 2. Also, with this version, the map magic integration files will be available in seperate packages. This means, if you need to use GPUI with either MM1 or MM2, you will need to extract the corresponding integration package from the /GPUInstancer/Extras folder. Please also note that because of this, if you are already using the previous MM1 integration, you will need to manually delete the following integration files before extracting the pcorresponding MapMagic integration package:

    /GPUInstancer/Scripts/Integration/GPUInstancerMapMagicIntegration.cs
    /GPUInstancer/Scripts/Editor/Integration/GPUInstancerMapMagicEditor.cs

    Finally, with this version the Tree Manager now provides improved support for multiple terrains. For details on this, you can take a look at this wiki article.

    Important: Please make sure to backup your project if you are updating from a previous version of GPUI

    Here is the full changelog for GPUI v1.4.2:

    New: Multiple Terrains support for Tree Manager
    New: Map Magic 2 integration
    New: Added API methods to set buffer data using NativeArrays
    New: Added Assembly Definition files

    Changed: MapMagic integration files added to an extra unitypackage which can be extracted on demand

    Fixed: When generating new prototype data Tree and Detail manager overriding existing one if the file names are the same
     
    ElevenGame and Bzuco like this.
  32. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,641
    @LouskRad I am already working with it. So first of all: big yay for nativeArray support I was looking forward for it. However, I would need it to be used for variations too.

    I am also looking forward for the async support in 2020, but I won't use it until 2020 is out of beta anyway.
     
  33. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Hi. @LouskRad

    This is my finger crossing situation, but I am trying the GPUI with URP version 9.0

    And now even the simplest set up isn't showing the instancing. They are all registered and looks correct in the inspector, so I am assuming that the problem is with the shader. I have regenerated all the shaders but still.. nothing. :(

    Can anyone confirm that GPUI does work with URP version 9?

    --=== Edit ===--

    Never mind, I think it has to do with Amiplify Shader Editor created shader for some reason. I have recreated all the nodes again exactly how it was, and now it works for some reason. I think there has to be some fiddly bits in the generated shader from Amplify Shader Editor... Hopefully it keeps working...
     
    Last edited: Jul 10, 2020
    sebas77 likes this.
  34. Monil

    Monil

    Joined:
    Apr 24, 2012
    Posts:
    102
    Hi @LouskRad,

    how to activate cross-fade animation for trees?
    (Lod Cross Fade and Animate Cross-Fading are checked in GPU Instancer Tree Manager)
    I noticed that the included demo also has an instant transition between tree and billboard, I attach video

    NatureManufacture trees



    SpeedTree

     
    Last edited: Jul 10, 2020
  35. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    @LouskRad ,

    Hi - looking at purchasing this product but would be great to know:-

    - just how far integrated is it with Map Magic 2? (ie. how much work then to get it working with MM2)?;
    - if I am using MicroSplat with MM2 is that going to cause problems?; and
    - also, if I am on top of that using The Vegetation Engine, is that going to cause problems?

    I would really welcome your thoughts on these worries first. Many thanks in advance!

    [edit]

    I got carried away and, having seen the MapMagic integration vid, I purchased GPU Instancer (I own Map Magic 2). I also noted the Map Magic 2 integration in the latest release info for GPU Instancer.

    Unfortunately, I cannot see the GPU Instancer main menu link but under Tools in the Menu I have some options but again no Integrations option and no integration option with Map Magic 2.... ? 'MAPMAGIC2' and 'MM_NATIVE' are in my Scripting Define Symbols and I am on Linear Color Space if that makes a difference? I am also .Net 4.X. Unity 2019.4.4f1 (LTS).? No errors reported btw either.

    [edit]

    I've submitted a support ticket on your site and emailed a screen capture.
     
    Last edited: Jul 19, 2020
  36. macube

    macube

    Joined:
    Jul 16, 2017
    Posts:
    37
    Hey,
    is skinned mesh renderer for gpu instancer working now?!
     
  37. eof2007

    eof2007

    Joined:
    Apr 18, 2020
    Posts:
    8
    Good day!
    I am new to development and ask for help in sorting out these issues.
    I was able to connect the GPU Instancer, but it doesn't work as I want it to.
    1. The transparency of objects between the camera and the player does not work (I checked on several different shaders).
    2. The baked lighting map disappears.

    GPU Instancer does not support working with transparent objects and baking lighting?
     
  38. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,641
    I have a problem with LOD that I cannot figure out. The LOD looks great on this scene

    upload_2020-7-21_8-35-33.png


    but the same cube looks random on this scene:

    upload_2020-7-21_8-37-27.png

    where it's read it should be all red, not sure why some are red and some are brown

    Especially in the distance, it doesn't make sense. This is LOD 1:

    upload_2020-7-21_9-5-49.png

    but it's interleaved with LOD 0

    upload_2020-7-21_9-6-26.png

    bug or wrong settings that I can't figure out?

    In this scene I changed the color to make it more obvious:

    upload_2020-7-21_12-29-2.png
     
    Last edited: Jul 21, 2020
  39. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    @LouskRad , re post last Friday, tried everything and GPU Instancer still not recognising Map Magic 2 and, whereas some other GPU Instancer functionality is accessible via Tools in the Menu, there is no 'GPU Instancer' main title in the Menu.
     
  40. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    904
    Thank you for your feedback. We will add nativeArray support for variations to our roadmap. As for async support, we will investigate this when 2020 is out of Beta.

    Hi there, and thank you for the videos.

    If you are using HDRP or URP, GPUI does not support cross-fading in these pipelines.

    Hi there,

    I have mentioned this in reply to your support request as well, but I will also write here in case anyone else faces the same issue. As of v1.4.2, you need to extract the corresponding package to your Map Magic version to see the Integrations Menu items.

    Please take a look at this wiki article for further information.

    For skinned mesh support, you can take a look at the GPU Instancer - Crowd Animations extension asset.

    Both of these are not supported by GPUI. You can take a look at the known limitations here.

    LOD calculations are based on the bounding boxes of the prototype meshes. However, assuming you are using instances of the same prototype in those screenshots, this should not have happened. If you can send us a sample project showing this issue, we can investigate it.
     
    Duffer123 likes this.
  41. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,641
    Hello,

    I just realised that while the prototype is the same, the scale of each instance can be different. However, while this explains most of the cases, there is something that still doesn't convince me. It needs more investigation and I will email you the extra details once I got them.
     
  42. Monil

    Monil

    Joined:
    Apr 24, 2012
    Posts:
    102
    Hi, I use the built-in standard pipeline unity 2019.4.1f1 deferred, what settings in unity or shader keywords do you recommend to check?
     
    Last edited: Jul 21, 2020
  43. jaeeunpark

    jaeeunpark

    Joined:
    Feb 3, 2020
    Posts:
    4

    Adding foliage to tree preset causes slow in editor scene(not in runtime). I presumed tree mechanism runs culling one by one. As far as I know GPUInstancer runs only in runtime. In editor mode, unity uses internal tree and detail system.

    My question is, if I use multi-terrain, is it ok with multiple GPUdetailManagers for each additional terrains.
     
  44. 838nHex

    838nHex

    Joined:
    May 14, 2014
    Posts:
    14
    Hello
    how can I set a Texture per instance in LWRP ?
    if thats not possible how can I path a value to an instance in a shadergraph shader.
    I tried the Cange Color Demo but failed to bring the
    uint index = gpuiTransformationMatrix[unity_InstanceID];
    to work.
     
    Last edited: Jul 23, 2020
  45. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,641
    Hello,

    I have some more questions, as I am trying to figure out how things work empirically and from the code, while optimizing GPUI on our min specs:

    1. There is a new parameter called Instancing Bounds Size that is used inside the Graphic.DrawMeshInstancedIndirect method. The Unity and GPUI documentation are not clear at all about it. It appears to be an option to execute culling, however, I don't understand why it's necessary with GPUI since culling is done in the compute shaders. Changing its value doesn't seem to affect the rendering either. 1 or 10000 doesn't make any difference in my test cases (remember I am in a gameobjectless scenario).
    2. Similar issue with Max Prefab Distance: Defines the maximum distance from the camera within which Prefab Manager prototypes will be rendered. Changing its value doesn't affect the result in any form. How come?
    3. Once the GPUI occlusion culling is enabled, is there a way to disable it at run time or viceversa? I am investigating how to turn it on and off while the game is running.
    4. Related to the previous point: the Occlusion Cull Offset field shouldn't be hidden if Occlusion Culling is off. I may decide to enable it at run time.
    5. LOD renderings SEEMS to be actually called in a specific order. It "seems" that far LOD are always rendered before closer LOD. If it's true that there is an order, can this be inverted to help with the fill rate?
    6. QOL feature: recently I found myself struggling to find the prefabs, in the prefab manager, that have LOD on. A filter would be very useful, unless you have other ideas.
    7. The following code, that I don't fully understand yet, should be avoided on URP pipeline since LodCrossFade is not available? if (!isInitial && runtimeData.prototype.isLODCrossFade)
      {
      DispatchCSInstancedVisibilityCalculation(visibilityComputeShader, instanceVisibilityComputeKernelId, runtimeData, false, 0, 2);
      }
    8. InitializeWithMatrix4x4Array doesn't support NativeArray. It doesn't seem right to have the update supporting it, but not the init.
     
    Last edited: Jul 31, 2020
  46. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    @LouskRad , Is there way to implement variation buffer feature to Amplify Shader by graph, instead of having to manually edit the shader using text editor every time I make change to the shader? It is difficult to edit the shader every time I make change to the Amplify version.
     
  47. 838nHex

    838nHex

    Joined:
    May 14, 2014
    Posts:
    14
    or just simple, how can I run the ColorVariationsDemo on LWRP/UniversalRP ?
     
    Last edited: Jul 25, 2020
  48. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    @LouskRad ,

    With Gaia Pro, does the integration still work? Do I need to change the #IF to GAIA_2 for GX to to recognise? Most importantly, how will GPU Instancer play with GAIA Pro multi-tile/multi-terrain larger worlds...?
     
    Last edited: Jul 26, 2020
  49. Abnormalia_

    Abnormalia_

    Joined:
    Jul 23, 2013
    Posts:
    128
    Does this support "Single Pass Instanced" rendering mode for VR?
     
  50. Duende

    Duende

    Joined:
    Oct 11, 2014
    Posts:
    200
    Hello @LouskRad, I'm experimenting with your asset and I have some questions/problems.

    First, I am making a procedural video game where everything is generated at runtime, so the terrain are chunks. I'm testing your asset with grass, since it's a lot of grass should be able to be generated.

    Now the questions:
    1- For now I am adding grass as in the demo of the asteroids. Using RegisterPrefabInstanceList and InitializeGPUInstancer. I think that, as each chunk of terrain creates a grass list and then calls the RegisterPrefabInstanceList and InitializeGPUInstancer methods, then the SetRenderersEnabled method of the GPUInstancerPrefabManager class add a lot of work for the GC.
    That is, while a chunk calls that method (SetRenderersEnabled) 1024 times (the chunks are 32x32), when another chunk is created there are 2048 calls. If I create 16 chunks, it's 16384 calls when I create the last chunk.
    How can I optimize adding objects at runtime, for each chunk, with GPU Instancer?

    2- Until now, for any object like chunks or trees, I am using an object pool. Is it compatible or recommended to use an objects pool with GPU Instancer? Because once I do GPUInstancerAPI.RegisterPrefabInstanceList I lose control over the added grass, they are all part of the GPUInstancerManager item list, and it's expensive to know which ones to return to the pool.

    3- Continuing with the demo of the asteroids, to add the prefabs to the AsteroidObject list, they must first be added as prototypes in the GPUInstancerPrefabManager, and an .asset file is created with information from the prefab. Is it possible to get those files at runtime? Maybe adding prefabs as prototypes at runtime? Is it very expensive in performance?

    4- Maybe adding several GPUInstancerManager could solve some of these problems, is it recommended to add several GPUInstancerManager in scene or is it a very bad idea?

    Thank you. :)
    If you didn't understand something tell me and I will explain it again the best I can.