Search Unity

[RELEASED] GPU Instancer

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

  1. LouskRad

    LouskRad

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

    from the error message, it looks like at least one of your prefabs has missing script(s) on it. This would cause that issue while GPUI is adding its own script to your prefab. You can remove these missing references on your prefabs to solve this.
     
    Mortalanimal likes this.
  2. LouskRad

    LouskRad

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

    Looking at this asset, the issue is that its shaders are written with ShaderGraph. Since Unity still did not provide a way to inject #pragma definitions in ShaderGraph shaders, GPUI cannot execute its auto conversion process on such shaders.

    You can try using the generated ShaderGraph shader code to use it with GPUI's shader conversion features, or manually set up that generated code for GPUI.
     
  3. LouskRad

    LouskRad

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

    The pink grass is beacuse Unity still doesn't support terrain details in HDRP. However, GPUI does support this, and this is why you see your details rendered during play mode and in the simulation.

    One trick you can use is to add your grass as trees to the terrain instead of details. Unity would render them if they are defined as tree prototypes. If you do this, you can use the GPUI tree manager instead of the detail manager.
     
  4. xoodZ

    xoodZ

    Joined:
    Jan 8, 2018
    Posts:
    17
    Hello!
    Imported a Gaia Pro and your asset into a new project (2019.3b), and got errors in the console:
    Assets \ GPUInstancer \ Scripts \ Editor \ Integration \ GPUInstancerGaiaExtension.cs (54,45): error CS1061: 'Spawner' does not contain a definition for 'm_spawnerRules' and no accessible extension method' m_spawnerRules' accepting a first argument of type 'Spawner 'could be found (are you missing a using directive or an assembly reference?)
    Assets \ GPUInstancer \ Scripts \ Editor \ Integration \ GPUInstancerGaiaExtension.cs (58.75): error CS1061: 'Spawner' does not contain a definition for 'm_resources' and no accessible extension method' m_resources' accepting a first argument of type 'Spawner 'could be found (are you missing a using directive or an assembly reference?)

    I just deleted this script because I do not need integration with Gaia now. Just reporting an error.
     
  5. amarillosebas

    amarillosebas

    Joined:
    Feb 28, 2013
    Posts:
    30
    I just bought this asset, and I'm trying to read the documentation, but the website is loading extremely slow to the point it's not usable. I hope this gets fixed.
     
  6. Editali

    Editali

    Joined:
    Mar 9, 2016
    Posts:
    22
    Hi guys, I have a problem with GPUI. Something overdraws particles and all transparent shaders, after several hours I found that there are a single instance of every prefabs (prototypes) at the center of selected camera, so when I disable "GPUI Prefab Manager" they go away. Here are some screenshots:

    Render View:
    Untitled - 9.jpg
    Untitled - 8.jpg

    Scene View:
    Untitled - 1.jpg
    Untitled - 2.jpg
    Untitled - 3.jpg


    Does anyone know what is wrong and how to fix it?
    Thank you so much.

    Edit: In scene-view's camera every thing looks good, but render camera has this problem.
    Also I've also tested with both Serialized/Unserialized Registered Instances and it makes no difference.
     
    Last edited: Nov 27, 2019
  7. Editali

    Editali

    Joined:
    Mar 9, 2016
    Posts:
    22
    And this is another scene, you can see an instance of a tree and a bunch of other instanced objects (walls and floors) in the scene at the center of camera:

    2019-11-28_0-43-28.png
    2019-11-28_0-43-42.png
    2019-11-28_0-43-50.png

    Edit: Another overdrawing case, in scene-view, next to render-camera position.
    2019-11-28_1-11-06.png
    2019-11-28_1-11-09.png
    You can easily see there is something, that something is an invisible tree :D
     
    Last edited: Nov 27, 2019
  8. Karan90

    Karan90

    Joined:
    Mar 19, 2019
    Posts:
    9
    Hello. I was wondering if it will be helpful for creating Big Environments in Oculus Quest?
     
  9. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    638
    Thank you for the feedback. We will look into this. For now, you can still use GPUI from the Tools->GPU Instancer menu instead of the Gaia GX menu.
     
  10. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    638
    Hi there,
    looks like the problem is fixed now. It might be because of the increase in web site traffic given the Black Friday sales at the moment.
     
  11. LouskRad

    LouskRad

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

    if you see an instance overlaying at the position of your camera, it is most likely that the overlaying object uses a shader that is incompatible with GPUI. Most of the time the problem is with the instance id setup and/or the shadowpass of the shader.

    You can take a look at this wiki F.A.Q. article related to this problem to solve the issue.
     
    Editali likes this.
  12. LouskRad

    LouskRad

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

    Currently GPUI does not officially support the Oculus Quest. However, we have had reports from some of our users using GPUI for this platform with limited functionality.
     
  13. Editali

    Editali

    Joined:
    Mar 9, 2016
    Posts:
    22

    Hey LouskRad,
    I made changes according to F.A.Q solution, however nothing ever happened. According to the link above, shaders need to be setup for instancing, I'm using "Uber:Standard shader ultra" and "Nature Manufacturer" shaders, both are already instancing-enabled, moreover, as I said, changing shaders made no difference. All objects in the scene are instanced correctly (they look as I expect). Is there any way to reposition those camera-overlapping-instances somewhere else?
    Thanks




    Edit: I tried to dig in your codes, in GPUInstanceManager.cs @ Line:526 I added a constant offset to instancingBounds.center.

    instancingBounds.center = renderingCameraData.mainCamera.transform.position + new Vector3(0, 0, -20f);

    Now it looks fine, those ghost instances are gone somewhere else and they don't block camera anymore, now my question is: Will this change break something somewhere in project? It seems everything works fine.

    Thanks
     
    Last edited: Nov 28, 2019
  14. corjn

    corjn

    Joined:
    Feb 6, 2014
    Posts:
    93
    Hey @LouskRad,

    I'm making a game with a destructible and fragile structure. I'm using gpu instancer to instance each physics pieces of my structure. But I get some visible seam, as I use duplicates of 4 or 5 prefabs for the whole 400 pieces structure.

    Is it possible to make a shader variant for each pieces with a different UV offset, using gpu instancer (a bit like your color variation example, but with the UV offset variable) ? It would solve the tiling / seam problem.

    Thanks in advance for you time,
    Jonathan
     
    Last edited: Nov 30, 2019
  15. RoyHolzem

    RoyHolzem

    Joined:
    Nov 4, 2019
    Posts:
    1
    How can i fix this?
    Assets\GPUInstancer\Scripts\Editor\Integration\GPUInstancerGaiaExtension.cs(58,75): error CS1061: 'Spawner' does not contain a definition for 'm_resources' and no accessible extension method 'm_resources' accepting a first argument of type 'Spawner' could be found (are you missing a using directive or an assembly reference?)
     
  16. LouskRad

    LouskRad

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

    The ghost instances are probably the shadow pass rendering incorrectly in one of your prefabs. It could be the case that the Uber shader uses this shadow pass from either an include or a fallback shader, which is not setup for GPUI.

    You can test if the ghosting is caused by the shadow pass by disabling the "Use Original Shader for Shadows" option in the manager.

    The Unity instancing setup, while necessary, is not enough to setup GPUI. You also need to add the GPUInstancerInclude.cginc and setup pragmas as defined in the setup wiki page.
     
  17. LouskRad

    LouskRad

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

    It is indeed possible. One way to do this would be to use a texture atlas and use UV coordinate offsets for material variation.
     
  18. LouskRad

    LouskRad

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

    For now, you can delete the "Assets\GPUInstancer\Scripts\Editor\Integration\GPUInstancerGaiaExtension.cs" file from your project, and use GPU Instancer from the Tools menu.

    We will make an update for Gaia Pro in the next few days.
     
  19. SteenPetersen

    SteenPetersen

    Joined:
    Mar 13, 2016
    Posts:
    26
    Unity 2019.2.9f1 Scene "AddModifyTerrainsRuntimeDemo" terrain is pink. Grass is working well however. Changed the material to a Tif or png from psd, didnt help. not sure why that is happening, just thought Id point it out.
     
  20. LouskRad

    LouskRad

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

    we have just submitted a version update (v1.2.7) that includes a fix for this as well. The update should be available on the Asset Store in the next few days.
     
    SteenPetersen likes this.
  21. Editali

    Editali

    Joined:
    Mar 9, 2016
    Posts:
    22

    I have this problem with any other shaders, however, I tested with a brand new project with same shaders and there was no such a problem. In my current project it happens with all shaders, as I mentioned before, like with Nature Manufacturer's shaders. One more thing, I've disabled all shadows in my project so I don't think it relates to shadows. Lastly, that "offset" solved my problem and there is no artifact/problem in any scene.

    Thank you for your response.
     
  22. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    924
    Hi,

    some feedback on the occlusion culling:
    In my opinion the frustrum culling distance and occlusion culling distance should be two separate values/slides. I know this may not seem logical, but because of the occlusion culling algorithm limitation, using one slide only will affect the normal frustrum culling behaviour in a negative way.
    I didn't study the Hi-z gpu occlusion culling algorithm, so there must be a reason why you limit the occlusion offset to 0.01, but we found out that for our game the value of 0.1 worked better. I had to hack the code to make this working, I'd rather see this in one of the next updates if you think it's wise
     
  23. Neiyra

    Neiyra

    Joined:
    Apr 19, 2016
    Posts:
    4
    Hi, just purchased and tried to have a look at the demos. I set up a new project and the only thing I imported was GPUI, and I got compiler errors with Unity 2019.2.14f1 -
    Assets\GPUInstancer\Demos\AddModifyTerrainsRuntime\Scripts\TerrainGenerator.cs(553,17): error CS0103: The name 'alphaMap' does not exist in the current context

    Did I miss something? As a quick workover, I commented the lines out.
     
    Last edited: Dec 3, 2019
    Alex3333 likes this.
  24. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    638
    Hi there,
    and thank you for the feedback.

    We have just submitted a hotfix for this error. You can add the following line in the TerrainGenerator.cs file to fix this before the hotfix goes live:

    After Line 19, add:

    private float[,,] alphaMap;
     
    Neiyra likes this.
  25. TheWarper

    TheWarper

    Joined:
    Nov 3, 2013
    Posts:
    99
    Hi there, will 2019.3 support be coming soon?
     
  26. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    638
    Hi there,
    Yes, this is our priority at the moment.
     
    TheWarper and rrahim like this.
  27. iMancha

    iMancha

    Joined:
    Sep 22, 2014
    Posts:
    11
    Hi @LouskRad

    The game I'm working on was built from scratch using the 2019.3 beta and now on the final release everything is working perfectly and I'm a bit concerned about a downgrade to 2019.2.

    I've just bought this asset along with the Crowd Animations Asset, it all looks very promising and I believe it will increase the games performance, although I do get a stable 60 FPS at the moment, but the device heats up after a few rounds of game-play so I am hoping it will solve the overheating problem.

    What issues are occurring in 2019.3? Is it only the LWRP to URP naming conventions or other issues too? I'm tempted to modify the code(if that's allowed), but if an ETA for URP support is around the corner, then I'd prefer to wait.
     
  28. Leon-Reis

    Leon-Reis

    Joined:
    Sep 1, 2014
    Posts:
    7
    New Update its total fail .
    Now its showing this error :

    Assets\GPUInstancer\Demos\AddModifyTerrainsRuntime\Scripts\TerrainGenerator.cs(553,17): error CS0103: The name 'alphaMap' does not exist in the current context

    The only way to Fix it was ((( Deleting TerrainGenerator script )

    Ater that LOOKs liked was worikng , but NOOO ! its not.

    After you create the prefab , and try to run the game. We get this error.
    //////////////////////////////////////////////////
    Shader error in 'GPUInstancer/Universal Render Pipeline/Lit': failed to open source file: 'LitInput.hlsl' at line 120 (on d3d11)

    Compiling Vertex program with FOG_EXP2 PROCEDURAL_INSTANCING_ON _MAIN_LIGHT_SHADOWS _SHADOWS_SOFT _MAIN_LIGHT_SHADOWS_CASCADE _ADDITIONAL_LIGHTS _ADDITIONAL_LIGHT_SHADOWS
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_RGBM_ENCODING
    ////////////////////////////////////////
    And this one too.

    ////////////////////////
    Assertion failed on expression: '0 == m_CurrentBuiltInBindMask'
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)
    ////////////////////////


    By the way , this last error shows every frame on editor and never stop. So .. the tool its totally broken. I think its becouse of the Gaya tool setup. And now my Game dont work anymore.. Congratulations.


    Ohh i almost forget . ALLL prefabs got invisseble trying to use the GPU Instancer. ( ofcourse , becouse its not working ).


    Other feedback i can give you its. Those errors happens with GpuInstacer Shader. I changed back to Universal shader and erros gone ..

    And Finally .... I am sending 2 pics . that is showing the GPU instancer ON ... have worst performance than when is OFF ... and ....everything is missing.
     

    Attached Files:

  29. blacksun666

    blacksun666

    Joined:
    Dec 17, 2015
    Posts:
    169
    @Leon-Reis did you try the fix 4 posts before yours as it was in reply to someone with the same problem as you (5 posts above yours)?
     
    LouskRad likes this.
  30. ANUBISKONG

    ANUBISKONG

    Joined:
    Nov 16, 2016
    Posts:
    24
    I made a turret, when I enable GPUI, its turret no longer rotates, but it can still fire in the correct direction. The prefaband GPUI setting of this prefab is also in the attachment.
    Im using Unity 2019.3.0f1 GPUI 1.2.7
    批注 2019-12-04 114516.jpg 批注 2019-12-04 115714.jpg
     
  31. LouskRad

    LouskRad

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

    URP support is indeed around the corner. We plan to submit a version update including this in a couple of days.
     
    Lars-Steenhoff and hippocoder like this.
  32. LouskRad

    LouskRad

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

    Currently the latest version includes a hotfix for the error you mentioned. However, URP support is currently unavailable and will be ready in a few days.
     
  33. LouskRad

    LouskRad

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

    Given the structure of your turret prefab, you need to use nested prefabs. GPUI does not use a transform buffer for children objects in the prefab to conserve memory, but if you use your rotating part as a prefab that is nested under the main turret prefab, and add both prefabs to the manager, GPUI will track the rotation.
     
  34. Leon-Reis

    Leon-Reis

    Joined:
    Sep 1, 2014
    Posts:
    7
    I thank you so much. I will will work in another part of my game, while i wait your tool. I really loved your tool. By the way. Can i simply use the Terrain as prefab ? Or do i ned something especial? I would love to have my terrain working with GPU instancer too. Thank you so much.
     
  35. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    25,941
    URP support seems handy! Sorry I haven't emailed been a bit busy this end. I'm certain this'll help any VR related performance issues for rendering lots of bits :)

    Hopefully anyway. I use shader graph to knock out most shaders and hope to perhaps if necessary do manual optimisations with copy shader etc later.
     
  36. combatsheep

    combatsheep

    Joined:
    Jan 30, 2015
    Posts:
    88
    Hi.

    I'm consider to purchase GPU Instancer.

    Does GPU Instancer have the pooling system?
    Or, do I need to use it with the pooling system asset, if I want to use it for firing a lot of bullets?

    Please tell me
    Thanks.
     
  37. Slowin

    Slowin

    Joined:
    Mar 6, 2015
    Posts:
    40
    Hi,

    I have a problem with GPUInstancer and Unity 2020.1.0a14.

    The Import process hangs on the file "GPUInstancerSettings.asset". I already tried to delete the library and removed the GPUinstancer folder completely and downloaded it again, but it still does not work.

    Anything I can do here? Right now, I'm not able to enter my project because of this.
     
    Last edited: Dec 5, 2019
  38. ANUBISKONG

    ANUBISKONG

    Joined:
    Nov 16, 2016
    Posts:
    24
    I changed all turrets, and got some errors When I add them into GPUI.
    批注 2019-12-05 201159.jpg 批注 2019-12-05 201203.jpg 批注 2019-12-05 201206.jpg
     
  39. ANUBISKONG

    ANUBISKONG

    Joined:
    Nov 16, 2016
    Posts:
    24
    When I turn on frustum culling and occlusion culling in culling settings, models start flashing
     
  40. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,178
    Im just checking if this is my issue too - I use Biomes with MapMagic and when I press play all of my trees and grass are gone. Is this the same issue you were experiencing?
     
  41. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    638
    Well, you can render terrain details and trees with their respective GPUI managers, but if you mean instancing the terrain itself, GPUI does not offer such a functionality.
     
  42. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    638
    Hi there,
    What you can do to use ShaderGraph is to right click on the output node and chose "Copy Shader" to copy it to the clipboard. You can then paste it to a new .shader file and rename to create a new shader. GPUI will auto convert such a shader if it is on a prefab's material that is added to a manager.
     
  43. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    638
    Hi there,
    and thank you for your interest in GPUI.

    GPUI offers a rendering solution and does not come with a pooling system. However, there are API methods that you can use to implement it with a pooling system.
     
    combatsheep likes this.
  44. LouskRad

    LouskRad

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

    Most problems in the beta and especially alpha versions of Unity (any version number that includes a 'b' or 'a' in it respectively) are usually caused by internal Unity errors. This is why GPUI officially does not support alpha and beta versions of Unity. You can delete the GPUInstancer folder completely from your /Assets folder which should let your project open again if there are no other problems. You can use GPUI in a project which uses any of the "final" builds of Unity (which include an 'f' in their version number).
     
  45. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    638
    Hi there,
    thank you for the screenshots.

    From the error message, it looks like an asset in your project, "EasySave" is throwing an error that is preventing GPUI from serializing its prototype for the manager. The rest of the errors would follow because the serialization was not successful.
     
  46. LouskRad

    LouskRad

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

    Please check the troubleshooting section of the F.A.Q wiki, and if it doesn't help, please send us a sample project showing this issue so we can identify it.
     
  47. LouskRad

    LouskRad

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

    since that post there have been a lot of version updates and the biome support was also added amongst them. The reason why your grass and trees are not showing might be shader related. You can give us some more detail about your project setup, or better send us a sample project showing this error so we can identify the problem.
     
    protopop likes this.
  48. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,178
    Thank you. I put together a small sample project and Ill send it by WeTransfer in a moment.

    Btw I like the fact that you can just turn the GPUI game object on and off to enable/disable it. It seems really cleanly coded and structured.

    Edit: It's sent. I include a note with it. Its Unity 2019.2.8, using MapMagic biomes and Microsplat. Thanks so much:)
     
    Last edited: Dec 6, 2019
  49. jebediahh

    jebediahh

    Joined:
    Feb 20, 2017
    Posts:
    23
    How would I go about accessing in code the gameobject for a tree that is handled by GPU Instancer... In order to do things like allow player to chop down a tree? Am I able to attach a script to the prefab that GPUI instantiates and treat it like i would any other game object in Unity?
     
    Last edited: Dec 8, 2019
  50. UnityRocksAlt

    UnityRocksAlt

    Joined:
    Dec 28, 2015
    Posts:
    137
    Is there anyway to toogle MeshRenderer at will through GPU Instancer?