Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

[RELEASED] GPU Instancer

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

  1. ManaPotionStudios

    ManaPotionStudios

    Joined:
    Dec 26, 2016
    Posts:
    11
    So I found GPUInstancerAPI.RemoveInstancesInsideCollider and GPUInstancerAPI.RemoveInstancesInsideBounds wich can remove all grass inside some areay. It's working ok. It will be great to have ability to create smooth gradient grass border though as it possible with SetDetailLayer. But anyway it's ok fo rnow
     
  2. Migueljb

    Migueljb

    Joined:
    Feb 27, 2008
    Posts:
    528
    I loaded up the Detail Instancing Demo in HDRP mode and I get this weird shadows from the grass following me as I look up and down. Any reason why this is happening?

    Also does the HDRP vegetation FoliageHDRP shader support translucency or sub surface scattering as well.
     
    Last edited: Mar 19, 2020
  3. Corvostudio

    Corvostudio

    Joined:
    Jul 19, 2015
    Posts:
    8
    Thank you.

    I still encounter a similar problem on PC:
    The grass doesn't show at runtime at first, but after a couple minutes it start working, but only near the camera.
     
  4. Joshua_strawchildgames

    Joshua_strawchildgames

    Joined:
    May 27, 2017
    Posts:
    60
    So... weird issue. When in editor and GPUinstancer is on, my frames drops down to 30 fps. When I disable it, it jumps back up to 120 fps. When I go into play mode, it jumps back up to 100ish fps.
     
  5. dl290485

    dl290485

    Joined:
    Feb 4, 2018
    Posts:
    153
    I need two questions answered:

    • Is there a way to update the instance list during runtime? I'm generating my map entirely in runtime. I was hoping the prefab objects (barrels, crates, etc) would be handled by this extension. In your video you click a button in the editor to update the list after adding or removing prefabs, but I hope you can tell me how prefabs created during runtime can also be covered?
    • With the above having a solution, can you also clarify if this will work on prefabs which are the child of another prefab? So if I'm spawning a prefab as basically a folder, which contains several other prefabs inside. I don't want the top level prefab covered, but the individual parts in it to be the instances.
    I really hope there is a good answer for this, because otherwise this asset was looking perfect to alleviate performance issues I'm having with my current project. Literally hundreds of sci fi barrels are placed in which are all the same mesh and materials, plus I also want the runtime occlusion culling too since I can't pre bake anything in the editor (since it starts essentially blank and generates in runtime).

    EDIT: OK looks like the manual says it can be updated in runtime either auto or with an API. Still would like to hear any tips though regarding this and also about prefabs which are children of prefabs.
     
    Last edited: Mar 25, 2020
  6. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    833
    Yes, GPUI takes all the mesh vertices in all LOD renderers and encapsulates them into a final bounds result; using it in its calculations. If you have renderers in different positions, this would increase the bounds and hence effect the LOD distances accordingly.
     
  7. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    833
    Hi there,

    Can you tell which Unity and HDRP versions you are using? (The foliage shader was created for HDRP 7). Also a screenshot will help us identify the issue better.

    The HDRP version of the Foliage shader is feature-wise exactly the same as its Standard Pipeline counterpart. It is designed to provide an out of the box grass solution in HDRP. However, if you wish to use HDRP specific features such as translucency, you can use a custom shader instead of the included foliage shader.
     
    Last edited: Mar 25, 2020
  8. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    833
    Please email us a sample project showing this so we can identify the issue.
     
  9. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    833
    I'm not sure I understand your question. GPUI does not render during edit mode unless you enable the simulation mode. You can check the Unity Profiler to see what may be using up your resources.
     
  10. reggie_sgs

    reggie_sgs

    Joined:
    Jun 29, 2014
    Posts:
    232
    Just e-mailed you. Wanted to make sure you saw it while you're answering questions.
     
  11. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    833
    Hi there,

    Yes, you can either use the features under the Runtime Settings, or manually manage your instances through the API.

    As for prefabs that are children of other prefabs (i.e. nested prefabs), you can take a look at this wiki article for the best practice when using them with GPUI.
     
  12. jb106

    jb106

    Joined:
    Jul 25, 2017
    Posts:
    2
    Hello again,
    I have a question about collab, the file GPUIShaderVariantCollection.shadervariants is considered like a change each time we want to push with our team. My guess is that this file is generated and different on each computer, so is there a possibility to ignore it with collab ? Would it be bad to do that ?

    Thank you ++
     
  13. Torches

    Torches

    Joined:
    Oct 11, 2018
    Posts:
    4
    LouskRad,

    I am using the latest version of the Crowd Animations with Unity 2019.3.0a7. Wonderful asset btw, everything is working as expected in the editor. However, when I run a build, none of the instances are getting rendered. I am instantiating them with PlayMaker and have all the runtime settings enabled (except start with rigidbody). The instances are getting created, I can still get collision on them, they just aren't getting rendered. The only way I have been able to get them to render in a build is to disable the Auto. Add/Remove Instances option in the manager or to disable the Prefab Runtime Handler script on the prefab and at that point I am no longer able to change animations or get transform updates, but they do render. Also, if I add some prefabs to the scene in the editor and register them in the manager, they still don't render in a build. Any suggestions or is there some step that I am missing?

    Edit: Figured it out, the Read/Write was disabled in the mesh import settings. After enabling all is good!
     
    Last edited: Mar 28, 2020
  14. mayorc1978

    mayorc1978

    Joined:
    Dec 30, 2013
    Posts:
    36
    Before buying I want to know a few things, if I want to convert Blender instances to this instances what would the wokflow be?
     
  15. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    816
    Hello,

    I just updated my project to use Unity 2019.3, HDRP 7.1.8 and I am getting a lot of this error in different lines and scripts from you package:

    Assets\GPUInstancer\Scripts\Core\Contract\GPUInstancerManager.cs(141,47): error CS1069: The type name 'XRSettings' could not be found in the namespace 'UnityEngine.XR'. This type has been forwarded to assembly 'UnityEngine.VRModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' Enable the built in package 'VR' in the Package Manager window to fix this error.

    Could you please indicate how to fix this?

    Regards,
    Carlos
     
  16. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    614
    Hi @LouskRad !!
    I am new with GPU Instancer since although I bought it a long time ago, I am not using it until now. I am in Unity 2019.3.7f1 on a project in HDRP v7.3.1.

    I have a problem. I am adding Megascan vegetation to my example scene with GPU Instancer as I show in the video. The problem is that all the vegetation that I add when hitting play disappears and is not shown in the gameplay.
    I've checked your example scenes and everything seems to work fine on them. But if I add any of my plants to the "GPUI Tree Manager, GPUI Detail Manager or GPUI Prefab Manager" in your scenes, the problem also occurs.
    My plants have the Unity Shader Lit. But I have also tried it with another shader that is prepared for GPU Instancer as following the instructions you have in the manual


    I have noticed that if I deactivate the "LOD Cross Fade" box, the vegetation is shown on the screen in play mode, as you can see in this video ...


    What am I doing wrong?
    Can you help me know what I am doing wrong or is it a GPU Instancer bug. I am looking at the documentation and videos, but at the moment I have not found anything to help me solve the problem.
    I await your response, regards
     
    Last edited: Apr 3, 2020
  17. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    833
    Hi there,

    The purpose of the GPUIShaderVariantCollection file is to include your GPUI materials in the build without taking any aditional measures. This works by GPUI keeping track of the material changes in your project. Each time there is a change in a material that is used by GPUI, this file would be updated.

    If you want to manually handle which shaders you will include in your project, you can disable this behavior from the GPU Instancer Preferences.
     
  18. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    833
    GPUI works based on User Created Prefabs (as opposed to the imported model prefabs). That is, how you model and import your models does not matter. Instead the workflow is such that the prefab you create out of your imported models is defined to GPUI and rendered by it.
     
  19. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    833
    Hi there,

    as the error message indicates, you need to enable the built in package 'VR' in the Package Manager:

    upload_2020-4-3_18-23-48.png
     
  20. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    833
    Hi there,
    and thank you for the videos.

    The cross-fade implementation of GPUI is designed for the Standard Pipeline, and as such should not be available in HDRP. We will look into fixing this issue in the next update.
     
    ftejada likes this.
  21. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    816
    LouskRad,

    Thanks for your prompt response I appreciate it. The problem is that my project is not for VR, it is for Xbox One. Is there a way to solve this without adding unnecessary packages to my project?

    Regards,
    Carlos
     
  22. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    614
    Hi! @LouskRad !!!
    I have a question, does GPU Instancer work configuring Unity for Job system and Burst compiler? I'm looking at the documentation and can't find any information about that
     
  23. ElevenGame

    ElevenGame

    Joined:
    Jun 13, 2016
    Posts:
    35
    Hello @LouskRad You are probably already aware, but just in case you are not, I wanted to inform you that Map Magic is soon getting updated to version 2.0 where some things might have changed. I have read in the forums that the asset store release for that is currently pending. And of course me and some other people would be happy to get an integration with GPUI working as soon as it is released.. Anyway, thanks for you great support! :)
     
    ftejada likes this.
  24. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    614
    @LouskRad Another thing I'm realizing is that "Is Oclussion Culling" doesn't seem to be working for me.
    Should this feature work in HDRP? Or am I just doing something wrong? I have read the documentation and I do not see where I am going wrong
    I show you video:


    On the other hand I do not know what is happening but in HDRP I am trying to use the "GPUI Detail Manager", but everything I paint in the terrain, also disappear when I hit play how was it happening to me with "LOD Cross Fade".
    I would think that is why you told me that GPUI still doesn't work "LOD Cross Fade" ... But I have checked your example scene "DetailInstancingDemo" and it seems to work fine.
    For my tests I have used the prefab of the stone that you use in "DetailInstancingDemo", to discard that it is some error of my models or something. But as you will see in the video below the problem also occurs in my scene.
    I leave video:


    Regards
     
  25. peeka

    peeka

    Joined:
    Dec 3, 2014
    Posts:
    93
    I am getting crash metal on iphone 6 IOS 12.4.6, and iphone 7 IOS 13.4, Execution of the command buffer was aborted dur to an error during execution. Caused GPU Hang Error (IOAF code 3)

    This can happen on AddRemoveInstancesDemo I have 2019.3.7f1, URP 7.3.1, gpu instancer Version 1.4.0

    on iphone 6 IOS 12.4.6, it crash right away
    on iphone 7 IOS 13.4 the exception will be thrown once, but doesn't crash for the AddRemoveInstancesDemo, but for my game, it will crash and start spamming error when I switch scene.

    let me know if you can reproduce.

    Thanks.
     
  26. danteswap

    danteswap

    Joined:
    Oct 27, 2013
    Posts:
    156
    Here Is My Problem of 2 Small Bill Board Instead Of 1, All My Trees And Plant Are Having This Problem .Also The billboard of small plants are way off their location so it looks like the small plant disappear

     
  27. danteswap

    danteswap

    Joined:
    Oct 27, 2013
    Posts:
    156
    And This Is the Second Problem Where When I Start the scene and enable GPUI Then The Batches And Triangles go high , now when i disable GPUI then The Triangles Go even High with Batches , In Order To Fix this I have to Pause the scene And Remove the Camera component From Main Camera And Then re add the camera component to the maincamera object and then resume the scene and reenable the GPUI . After That all becomes fine.How To Fix This
     
  28. chris_schubert

    chris_schubert

    Joined:
    Jan 8, 2019
    Posts:
    24
    Is it possible to use a No GameObject approach for anything beyond a certain radius?

    For example, I would like to have full game objects for things within 10m, and then have the modification collider turn off colliders/rigidbodies for anything from 10m to 50m, and then after 50m have No GameObject instances rendering.

    I have already implemented the NGO approach but not the distance component.
     
  29. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    1,064
    When I have low shadow distances, my tree's shadows end up popping in and out. Is there a way to stop this? I'd rather have it fade like normal objects do.
     
  30. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    833
    The VR package was not separate and was included in the previous version of Unity. At the moment it is enabled in new Unity projects by default. This library is referenced by the GPUI code in various places, so there is no easy way to remove the VR package (it also has no script define so cannot be bypassed). However, this would only add a small dll in your build without taking up additional resources, so there is not much to gain by removing it anyway.
     
  31. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    833
    You could use jobs and the burst compiler in your project; it would not effect GPUI. GPUI does not inherently use these systems.

    Occlusion Culling should work in HDRP although you should keep in mind that (a) culling is dependent on the depth texture precision, meaning culled objects usually start being culled at longer than expected distances and (b) in HDRP Unity has some issues with depth textures while handling a side by side comparison of the scene and game views where one can override the other's depth texture which might create inconsistent results with GPUI's occlusion culling. You can check the used depth texture from the hi-z occlusion generator component that GPUI adds on your camera.

    Having said that, if you can email us a sample project showing these issues, we can investigate them.
     
    ftejada likes this.
  32. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    833
    Hi there,

    yes, we are aware of the new Map Magic release. It will require some changes on our side of the integration - we will look into this once it is released.
     
  33. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    833
    Hi there,
    and thank you for reporting this issue.

    We will run tests with the same versions and investigate the issue.
     
  34. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    833
    Hi there,
    and thank you for the videos.

    I am not sure what causes these problems. If you could email us a sample project showing this issue, we can investigate them.
     
  35. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    833
    It is certainly possible, but you would need to handle your game objects in your scripts. You can have GPUI rendering your instances with the no-game object workflow. You can instantiate your game objects with their mesh renderers turned off within your desired distances. You can also improve upon this by pooling your game objects. However, keep in mind that while using the no-GO workflow, GPUI will only be handling the rendering of your instances, so runtime tools (such as the modification collider) would not work in this case.
     
  36. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    833
    Hi there,

    shadows are basically culled when you lower your shadow distance less then Unity's max shadow distance; so a fade out is not an option in this case.
     
  37. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    1,064
    Is it possible to extend the cull distance beyond Unity's current shadow distance, ensuring that the cull happens after it's faded away?
     
  38. danteswap

    danteswap

    Joined:
    Oct 27, 2013
    Posts:
    156
    Hello I have Sent You The Sample Project For First Video , Check If you got That Or Not
     
  39. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    162
    You can enable the Use Custom Shadow Distance option and set a higher shadow distance value than the one in Unity's quality settings.
     
    Ne0mega likes this.
  40. chris_schubert

    chris_schubert

    Joined:
    Jan 8, 2019
    Posts:
    24
    Thanks, I think I follow. After I submit an array of matrices for no-GO rendering, is there any way to enable/disable rendering of a single matrix? For example, a secondary array of bools that toggle rendering?
     
  41. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    816
    Hello LouskRad,

    I have the VR enabled in the project and the errors persist even after re-starting Unity with the VR enabled. I also tested disabling and re-enabling the VR package. What else can be done? Here is a screen shot of the errors.
    Errors_GPUInstancer_with_VR_enabled.jpg
     
  42. secondsight_

    secondsight_

    Joined:
    Mar 2, 2014
    Posts:
    146
    Hey,
    I´m using GPUI with MapMagic. Is there any way to save the import settings for assets ? Or do I have to reenter all the values everytime I reimport (after a change in MapMagic) ?
    Thanks !
     
  43. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    614
    @LouskRad Thanks for your answer.

    I have looked at the "depth texture" but I don't know what to check or how to do it.
    The precision of the "depth texture" is determined by its size? I have tried resizing at runtime anyway but nothing has changed. As I said, I don't know what I have to verify or how to do it. I leave a video in case he can clarify something for you.



    I send you to the email you told me, an empty project with a scene in the Unity 2019.3.0f6 version for you to investigate the problem. It is a different version than the videos that was version 2019.3.7f1, but I think it does not matter.

    I beg you please let me know with any solution.
    Cheers
     
  44. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    614
    Regarding this problem in the scene that I have sent you, it does not happen and the project where it happens to me I cannot pass it to you so that you can investigate. I will continue to closely observe this problem and if I can replicate it in another empty project, I will send it to you.

    Regards
     
  45. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    833
    You could send a Matrix4x4.zero for the instances you wish to disable.
     
  46. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    833
    Hi there,

    the error messages are still the same and they indicate the VR package is still missing. Please make sure you are enabling the correct package:

     
  47. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    833
    Hi there,

    Currently indeed the settings would be lost for the imported details and trees after a re-import. This is because the re-import actually creates new prototypes.
     
  48. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    833
    Hi there,

    We have tested Mtree with Unity 2019.3.9f1 (which is currently the latest verified build) and URP 7.3.1 and we could not reproduce this problem - the trees rendered as intended.

    The issue could be caused by the 2020 beta build, or with Mtree's support with URP 9 (which was not in the package).

    In any case, GPUI does not officially support beta Unity builds since there are usually bugs that get fixed in verified builds. The current latest supported Unity version for GPUI is 2019.3.9f1 with URP 7.x.
     
  49. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    816
    Yes, it is enabled 100 % sure. I actually saw that it was enabled, so I disabled it and re-enabled it and restarted Unity and I restarted the PC to be sure that everything was refreshed, but it didn't do it anything to fix the errors.
     
  50. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    833
    Well, the issue there is that when GPUI references the UnityEngine.XR.XRSettings library, and Unity cannot find it. We have removed the VR package in a test project and got the same error. When we have enabled it back, Unity was able to reference the library and there were no errors.

    I cannot comment why adding the package on your end does not fix this, except that it looks like a problem with the package manager on your project. Creating a new project and moving your assets over might fix the problem though (if you do not have any project native compilation errors).

    Other than that, I can't offer anything else since the issue is a Unity built in package issue in your project.
     
unityunity