Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

[RELEASED] GPU Instancer

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

  1. namdo

    namdo

    Joined:
    Feb 23, 2015
    Posts:
    177


    The issue im having. Ive tried both amplify occlusion and post processing occlusion. Do you see it?I turned off Occlusion culling but nothing changed.
     
    Last edited: Jan 3, 2019
  2. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    743
    Any ETA of the next update? Any new features?
     
  3. DiscoFever

    DiscoFever

    Joined:
    Nov 16, 2014
    Posts:
    266
    So using GPU Instancer in a simple scene (but with a lot of grass and trees) I get 'barely' 12fps. Why ? Without it I am around 60 fps ...

    Using MacBookPro with AMD 460 Metal + Unity 2018.2.20f

    Thanks

    Capture d’écran 2019-01-03 à 09.55.05.png Capture d’écran 2019-01-03 à 10.01.29.png Capture d’écran 2019-01-03 à 10.01.34.png
     
    Last edited: Jan 3, 2019
  4. Utopien

    Utopien

    Joined:
    Feb 15, 2016
    Posts:
    39
    hello your intancer look amazing so as your demo but can your astroid belt rotate around the planet ? can your intances be animated globaly with for exemple the parent or can it be aniamted individually or in group ??? if yes can you tell me the procidure causse i cant see in your doc any reference about animating an instance befor i by it plz thanks


    i am making space sim as accurate as possible and to do so i need my astroide feld to rotate around planet
     
    Last edited: Jan 3, 2019
  5. GurhanHazinedar

    GurhanHazinedar

    Joined:
    Apr 24, 2017
    Posts:
    161
    Hi @namdo
    I think it is a shader problem. One of the prefabs you are using probably has a custom shader which doesn't have instancing setup.
    There is a guide in our wiki about adding instancing setup to custom shaders: https://wiki.gurbu.com/index.php?title=GPU_Instancer:FAQ#Vertex.2Ffragment_Shaders
    It might be easier to find the problematic one if you test the prefabs you are using with GPUI on a new scene with couple of instances for each.
    If it doesn't help, you also can send us an email with the information about your prefabs and their materials-shaders, and we might be able to guide you about how to fix it.

    Hi @Harekelas
    We do not have an ETA for the update yet. We are working on some performance improvements and new options, we will announce the details when the implementation and tests are completed.

    Hi @DiscoFever
    Do you have any projectors in your scene? Usually water systems use it. Projectors doesn't work well with indirect GPU instancing. If this is the case, you can solve it by following this guide: https://wiki.gurbu.com/index.php?ti...my_Scene.2C_I_see_Artifacts.2FPerformance_Hit

    If not, I would recommend to take a look at the best practices, it might help to make a better setup for your scene: https://wiki.gurbu.com/index.php?title=GPU_Instancer:BestPractices

    Hi @Utopien
    Prefab Manager has an option called Auto. Update Transform Data under Runtime Settings. When this option is enabled, position-rotation-scale changes are automatically applied to instances. If you have a script or animation that rotates the asteroids, when you enable this option, it will work out of the box with GPUI.
     
    Utopien likes this.
  6. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    577
    @GurhanHazinedar I'm getting the following error:
    Code (CSharp):
    1. ArgumentException: Empty path name is not legal.
    2. System.IO.StreamReader..ctor (System.String path, System.Text.Encoding encoding, System.Boolean detectEncodingFromByteOrderMarks, System.Int32 bufferSize, System.Boolean checkHost) (at <ac823e2bb42b41bda67924a45a0173c3>:0)
    3. System.IO.StreamReader..ctor (System.String path, System.Text.Encoding encoding, System.Boolean detectEncodingFromByteOrderMarks, System.Int32 bufferSize) (at <ac823e2bb42b41bda67924a45a0173c3>:0)
    My asset serialization is set to binary as recommended for speed of other specific assets.. is this the issue here?
    Forgot to mention that I'm using Unity 2018.3.0f2
     
    Last edited: Jan 3, 2019
  7. Dobalina

    Dobalina

    Joined:
    Sep 6, 2013
    Posts:
    46
    Hello!:) I have a few simple questions about this package.

    In my scene, I reposition my terrain back to the middle of the world to correct float point accuracy issues. Currently with Unitys default grass, I see a profiler spike with thousands of Terrain.Details.BuildPatchMesh calls when my terrain is re-positioned. Would there be a reduction in 'BuildPatchMesh' calls with this package?

    Second question. If I apply my own custom material to the grass and make adjustments to that material during runtime, would all the grass visuals also update? ie, diffuse lerping / color tinting etc..
     
  8. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    743
    Glad to hear more optimization is on the way!
    I've been able to create my own collider streaming system for matrix4x4 usage in GPUI.
    Works great so far. But I found a strange issue:
    I have two scenes: Main Menu and Game Scene, only the game scene uses GPUI.
    I found that when I first launch the game and enter the game scene, all speed trees have their proxy under the GPUI Tree Manager Proxy, so they have the wind animation.
    But after I returned to the main menu scene, and comeback to the game scene, there is nothing under the GPUI Tree Manager Proxy gameobject. Is there any static variables controlling the proxy generation? Wouldn't like my players to restart the game each time returned to main menu to get the trees moving with wind.
     
  9. namdo

    namdo

    Joined:
    Feb 23, 2015
    Posts:
    177
    I tested it on a new scene and the same thing happens whenever im using occlusion. I'm using the Fantasy Adventure Environment asset and it only happens with the cliff shaders.

    I tried editing the shader with whats in that link but the shader turns pink with errors
     
  10. GurhanHazinedar

    GurhanHazinedar

    Joined:
    Apr 24, 2017
    Posts:
    161
    Hi @Ascensi
    I just made some test on 2018.3.0f2 with binary serialization and did not see any errors. Are you sure this error is related to GPUI? If so, can you please send us information on how to recreate this?

    Hi @Dobalina
    GPU Instancer has a API method called SetGlobalPositionOffset which can be used to change the position of instances at runtime and it works very fast (calculations are made in GPU memory). And GPUI Detail Manager disables the Unity Terrain details, so there won't be any performance hits caused by internal Unity methods related to detail rendering.

    For your second question, any change you make on the original material would not show on GPUI instances, because GPUI creates it's own materails for rendering. But you can edit properties of the materials using GPUI's internal MaterialPropertyBlocks. However, please note that you can not make instance based changes using this, every change you make would be applied to all instances of the prototype.

    Hi @Harekelas
    Thanks for reporting this issue. GPUI Managers have a static variable to keep a reference to proxies under GPUInstancerManager.treeProxyList. We will look into this and add a fix for the next update to clear it automatically. For now, you can set this variable to null when player switches to main menu scene.

    Hi @namdo
    We will make a test with FAE and AO and see what is causing the issue. Until then, can you please send us an email so that we can contact for sending a fix or if we require further information later on?
     
  11. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    577
    All I did was try to add a Variant prefab to the manager of a 3D model.. although maybe the custom shader conversion didn't take.. I used a 4k texture atlas on Megasplat -which should be fine. Megasplat was set to GPU instancing before adding it to GPUI. Maybe I'm missing something? There might be a bug with Megasplat with unity 2018.3.0f2 there seems to be trouble other people are reporting with various assets in this version of unity.
     
    Last edited: Jan 5, 2019
  12. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    743
    Thanks!
     
  13. TCROC

    TCROC

    Joined:
    Aug 15, 2015
    Posts:
    119
    Is it possible to edit properties of an instantiated material?

    Ex.) gameObject.GetComponent<Renderer>().material.color = Color.blue.

    I'm trying to avoid the need for StructuredBuffers because I don't think those are supported in AmplifyShader yet. Thanks. :)
     
    Last edited: Jan 5, 2019
  14. namdo

    namdo

    Joined:
    Feb 23, 2015
    Posts:
    177
    I was able to make it go away with amplify occlusion and setting per pixel normals to none. It seems to fixed so far.
     
  15. txarly

    txarly

    Joined:
    Apr 27, 2016
    Posts:
    197
    Hi,

    First ,Happy new year and congratulations for this asset, it is really useful.We have found a problem when we move the terrain to avoid the floating fix problem.The grass doesn´t move to the correct position like the rest of objects.We have prepare a simple test project with this bug so if you are kind to try it and see what can be the problem.

    Captura de pantalla 2019-01-07 10.00.05.png

    I send you the test project to the support E-mail, and wait for your news.
    Thank you very much in advance
     
    Last edited: Jan 7, 2019
  16. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    533
    Hi @GurhanHazinedar !!!!

    I bought your asset and it looks very good. I'm still learning how to handle it properly, but I'm having some problems being able to compile for PS4 platform.

    I have looked at the documentation above, but I have not found anything to help me.

    My version of Unity is 2018.1.3f1.

    When importing GPU Instancer I got this error by console:

    ErrorAlImportar.JPG

    As it was removed when pressing clear, I did not worry. But when making a build I got 67 errors and I can not complete the build. I leave capture:

    Error AlCompilar.JPG

    Could you help me solve these errors? Do I have to configure something special from GPU Instancer to builds on PS4?

    I await your response, regards.
     
  17. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    743
    Hi, when I use the matrix4x4 method to initialize GPUI when a terrain tile is generated in my scene, there can be a huge spike (delta time can reach several dozens of seconds). I use GPUI for all trees and small objects in my scene. Is there any suggestions on optimizing this apart from reducing the size of terrain tiles?
     
  18. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    605
    Yes, chances are this isn't reated to GPUI - it can even be caused by the relatively new nested prefab support in Unity. In any case, we cannot recreate this error by GPUI only.

    Well, GPU Instancing does not allow for material variations as such. That is why the use of StructuredBuffers are necessary if you need variation. If you want to avoid the use of StructuredBuffers, you can maybe use a texture to write the color variation info for the instances and read them back in your shader - but this could be more complicated than the StructuredBuffers depending on your project.

    Thanks for the feedback. We will investigate this issue and write back to you.

    Hi there and thanks!

    You can currently use the SetGlobalPositionOffset(GPUInstancerManager manager, Vector3 offsetPosition) API method to account for the offset of your floating point fix.

    We are currently working on automating this process for a general floating point fix.

    Hi there, and thank you!

    The uv2 warning is a Unity version specific issue which was resolved in 2018.2 versions as far as I know. It is usually resolved when re-importing the shader that gives the warning and does not cause any problems in versions prior to 2018.2.

    As for the PS4 shader errors, it looks like Unity has some casting compatibility issues when using some HLSL methods and building for PSSL. If this is the case, casting the parameter variables for the problematic methods in the shaders would probably fix the issues. We will look into this.

    Can you change line 102 in GPUInstancerInclude.cginc from

    Code (CSharp):
    1. float det = dot(unity_ObjectToWorld[0], w2oRotation[0]);
    into:

    Code (CSharp):
    1. float det = dot(unity_ObjectToWorld[0].xyz, w2oRotation[0]);
    and see if this resolves the issue?

    Also, do you see any errors other than the dot method in the console?

    Hi Harekelas,

    If you can send us the specifics of your implementation of the initialization method, we can take a look into it and see if we can come up with a better suggestion.
     
  19. txarly

    txarly

    Joined:
    Apr 27, 2016
    Posts:
    197
    Thanks LouskRad, but that is exactly what we did, but doesn´t work.The courious thing is that if we set the global detail distance to 961 or more it works, but setting lower, for example 350, the bug appears,that is why we send to your mail a test project so you can check it fast.Would be very kind if you can take a look.

    thanks again
     
    Last edited: Jan 7, 2019
  20. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    743
    Just sent you the code we made for MM integration.
     
  21. Rewaken

    Rewaken

    Joined:
    Mar 24, 2015
    Posts:
    79
    Hello there, I am getting following error
    UnityException: get_isPlaying can only be called from the main thread.
    Constructors and field initializers will be executed from the loading thread when loading a scene.
    Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start.
    In GPUInstancerEditorSimulator.cs on line 143 when it called Application.Isplaying
     
  22. GurhanHazinedar

    GurhanHazinedar

    Joined:
    Apr 24, 2017
    Posts:
    161
    Hi there,
    Can you please explain in which context you are getting this error? Looks like an external threading system causing this issue.
     
  23. Radu392

    Radu392

    Joined:
    Jan 6, 2016
    Posts:
    140
    Hello, there's a problem with the tree manager that only occurs at BUILD time. Here's the pic on how a redwood speedtree looks like at build time using GPUI:

    https://puu.sh/CubQa/de3c17d186.png

    And here's how it SHOULD look like (the tree on the left)

    https://puu.sh/CubUd/a98dec2025.jpg

    In the editor, everything is fine even during runtime. But in a standalone playthrough, the problem occurs. I think I identified the issue but I don't know how to fix it. As you can see in the second pic, I assigned the 'Branches_1' material to both index 1 and 2 to replicate the issue. The correct order should be 'Branches_1' at index 1 and 'Branches_0' at index 2. For some reason, 'Branches_0' is either lost or replaced by 'Branches_1' at build time. I'm using the Unity terrain except in this case to illustrate the problem. Any idea on how to fix this?
     
  24. razzraziel

    razzraziel

    Joined:
    Sep 13, 2018
    Posts:
    135
    Any progress? Also is there any difference enabling/disabling Custom Billboard with Amplify Impostors?
     
  25. GurhanHazinedar

    GurhanHazinedar

    Joined:
    Apr 24, 2017
    Posts:
    161
    Hi there,
    There might be a shader variant of the SpeedTree shader for GPUI that is not included in the build. Tree Manager replaces the original SpeedTree shader at runtime with GPUInstancer/Nature/SPDTree. If you add a copy of the material in Resources folder and change the shader to GPUInstancer/Nature/SPDTree, it should be included in the build.
    We are working on a system to automatically include shader variants in builds, but it is still at an early stage. So in some cases you need to change the material's shader to GPUI versions to make them included in builds.
    There is also more information on this subject here: https://wiki.gurbu.com/index.php?title=GPU_Instancer:FAQ#Shader_Variant_not_Showing_in_Build

    Hi there,
    When you have an LOD group with an Amplify Impostor on it, you do not need to use GPUI billboard system. It should automatically work with your LOD group settings, using Amplify Impostors, out of the box. Custom billboard option is there to use the impostor without adding it to an LOD group. The integration we are working on is to make this process automatic to speed up the setup. The end result would be the same when you manually add the impostor mesh/material.
    For more information: https://wiki.gurbu.com/index.php?title=GPU_Instancer:FAQ#Amplify_Impostors
     
    Radu392 and razzraziel like this.
  26. Rewaken

    Rewaken

    Joined:
    Mar 24, 2015
    Posts:
    79
    Hey, I am using job system to get position and passing them in GPUInstancerDrawmatrix4*4 method. But I am only calling it after my job is completed in Late Update
     
  27. zoltanBorbas

    zoltanBorbas

    Joined:
    Nov 12, 2016
    Posts:
    77

    Hi there,

    Based of your comment i assume that my low poly character with with a simple animator component Instanced by GPUI with a run time modifications enabled should play the animation when appropriate. Although my test shows a great deal of performance gain spawning 1000 characters :) , however the simple move animation is not seam to show ;( . I have checked the animator and it indicates changes of state from idle to move as it should however the characters legs do not move along.

    The screenshot bellow shows the test set-up.

    Any idea what am i doing wrong? Did i misunderstood that simple animations are supported by GPUI?

    upload_2019-1-11_9-48-10.png

    Thank you for your time and the great asset!!!
     
  28. zoltanBorbas

    zoltanBorbas

    Joined:
    Nov 12, 2016
    Posts:
    77

    Never mind,

    I realised that if i make separate prefabs out of the legs and put the character together piece by piece at run time then i can animate the "joint" parent transforms. :p
     
    LouskRad likes this.
  29. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    605
    Hi Rewaken,

    Looks like the error you are getting is not related to your usage of the GPUI Matrix4*4 methods. For some reason, GPUI's core methods are running in a separate thread in your project. If you can mail us a sample project showing this, we can try to help you out.
     
  30. superjayman

    superjayman

    Joined:
    May 31, 2013
    Posts:
    142
    Shadows from tree billboard trees not working?

    Also, can you please do Alpha To Coverage? version of the foliage shaders
     
  31. shamsfk

    shamsfk

    Joined:
    Nov 21, 2014
    Posts:
    277
    Hi! I have a trouble, max detail distance is kinda ignored. If I lower it below 50 it does lower the draw distance, but if I set it higher (100 200 300 1000 ...) it is ignored and details (grass) is cut at around 40-50 units. What am I doing wrong?

     
    Last edited: Jan 13, 2019
  32. LouskRad

    LouskRad

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

    Tree billboards are designed for mainly performance and shadow casting is not supported for them. You can, however, implement a custom billboard solution by choosing the Use Custom Billboard option.

    As for, an Alpha To Coverage option, we currently do not plan on adding any further foliage shaders. You can, however, edit the shader code to add the AlphaToMask parameter as you wish (or if you are using ASE, you can do it from there).
     
  33. LouskRad

    LouskRad

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

    It looks like you are increasing the global max detail distance but still limiting it per detail prototype. You can increase the Max Distance under the Culling section of the manager for each prototype (341 in your screenshot) to solve this.
     
  34. shamsfk

    shamsfk

    Joined:
    Nov 21, 2014
    Posts:
    277
    I've tried that and on a screenshot, it is 341 on other objects too, but actual drawing distance is ~40
     
  35. Da-Icon

    Da-Icon

    Joined:
    Jul 6, 2017
    Posts:
    38
    Hi there, I have just purchased your asset this morning.. I am very excited to get this up and running.

    I installed the manager, the detail manager and the tree manager. I am currently getting this error.. this is happening before I hit play.

    GLSL: Invalid type in hlslcc vectorized matrix
    UnityEngine.Resources:Load(String)
    GPUInstancer.GPUInstancerManager:Awake() (at Assets/GPUInstancer/Scripts/Core/Contract/GPUInstancerManager.cs:99)
    GPUInstancer.GPUInstancerDetailManager:Awake() (at Assets/GPUInstancer/Scripts/GPUInstancerDetailManager.cs:33)

    when i hit play i can see my grass BUT no trees and i'm getting lag that drops FPS to about 18fps.... before i added the package i was getting 45. I realize my current FPS is a result of the errors. Any information you can provide is much appreciated

    sidenote: do you have a discord channel?
     
  36. TCROC

    TCROC

    Joined:
    Aug 15, 2015
    Posts:
    119
    @LouskRad What is the status on allowing for multiple cameras with GPUI for splitscreen? Also, is there a Discord channel I can join for this asset?
     
  37. superjayman

    superjayman

    Joined:
    May 31, 2013
    Posts:
    142
    -- How exactly did you turn off shadow casting, you are already implementing "Shadow Caster" pass in the shader, any way to enable it?

    -- I already tried adding AlphaToMask parameter but the billboard ordering or something looks messed up with Alpha to coverage, it seems like like it's not as simple as enabling it? Foliage looks horrible with aliasing.
     
  38. cAyouMontreal

    cAyouMontreal

    Joined:
    Jun 30, 2011
    Posts:
    279
    From what I know about Alpha to Coverage, you need to have Forward + MSAA to get the benefit from it. See this blog post talking about it: https://medium.com/@bgolus/anti-aliased-alpha-test-the-esoteric-alpha-to-coverage-8b177335ae4f
     
    LouskRad likes this.
  39. Utopien

    Utopien

    Joined:
    Feb 15, 2016
    Posts:
    39
    helllo is it possible to instenciate speedtree objects with wind zone without terrain ?
     
    lod3 likes this.
  40. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    605
    Are there any LOD Groups on your detail prefabs? If so, a very high "Culled" percentage could be causing this.

    If not, do you see any error messages in your console window? Also, what is the GPUI version you are using?

    Hi there, and thanks for supporting GPUI.

    From the error message, it looks like you are using OpenGL in the editor. What is the operating system you are using and the platform you are targeting? If you are on a Mac, you should be using Metal (instead of OpenGL) for compute shader support.

    You can see the platform specific minimum requirements from here:
    https://wiki.gurbu.com/index.php?title=GPU_Instancer:FAQ#What_are_the_Minimum_Requirements.3F

    We have experimented with multiple camera support for a single Manager, but the results suggest it is better if you use the Use Selected Camera Only option with multiple managers.

    You can, for example, have two managers for a split screen setup that define the same prototypes but with the desired cameras selected, choose the "Use Selected Camera Only" option for both of them, and it will work out as intended.

    We are planning to make tutorials for this in the feature, but this will be the main strategy to use for a multiple camera setup.

    As for the discord channel, we don't plan to have one as our main support platforms are the unity forums and support by email (which you can also access via the contact form in our website).

    GPUI makes a separate draw call for the prototype shadows which is not made for the billboards that use the included billboard shaders. These shaders are not compatible with shadow casting.

    The Foliage shader uses alpha testing (not transparency by alpha). That is, the shader assigns a value of 1 to the alpha channel and clips the pixels that are below the cutoff. To implement AlphaToMask you should have a shader that keeps the alpha value and assigns it to the shader's Alpha output. Also, @cAyouMontreal is right that you need to use MSAA for this.

    You can however, simply use a post-processing effect and apply either FXAA or TAA if all you need is AntiAliasing.

    Hi there.

    Yes, sure thing. All you need to do is to define your SpeedTrees to the Prefab Manager. Please note, however, that GPUI supports directional WindZones only.
     
  41. zoltanBorbas

    zoltanBorbas

    Joined:
    Nov 12, 2016
    Posts:
    77
    Hi there,

    I am looking at the documentation for something similar to the renderer component's isVisible property. I used to use this property to determine is whether a prefab is in the view of the camera. Is there something that i can use to check if a instanced prefab is currently visible?

    If is there is it a cheap operation?

    Thanks!
     
    Last edited: Jan 15, 2019
  42. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    605
    Hi Zoltan,

    GPUI does all the visibility calculations on the GPU; and an "isVisible" query would need to read this data back to the CPU and that in turn would slow the rendering down considerably. So there is no option for this in the system.
     
  43. zoltanBorbas

    zoltanBorbas

    Joined:
    Nov 12, 2016
    Posts:
    77
    Yes, i assumed so!

    Thanks for the speedy reply!
     
  44. Da-Icon

    Da-Icon

    Joined:
    Jul 6, 2017
    Posts:
    38
    I am using linux, My targeted platforms will be windows, mac and linux if it doesnt kill me first.

    i have just compiled and installed GLFW. it has changed my error.
    I no longer get the references to the scripts or lines in the GPU Instancer code.

    In a clean project with just GPU Instancer.... with no scenes... I get this error now. with no details.(when i installed GLFW extra line references went away - i consider this change possibly a forward motion)

    GLSL: Invalid type in hlslcc vectorized matrix

    looking at the requirements the system im building on is this:
    Unity 2017.4.4
    Xubuntu 18.04 64bit
    32 gb RAM
    1300x Quad AMD Ryzen
    Nvidia 1060 3gb

    my OpenGl is :
    GLX version: 1.4
    OpenGL core profile version string: 4.6.0 NVIDIA 390.77

    the requirements list 4.3 as the minimum i have 4.6
    this is a screenshot of what happens when i run the GPUI

    https://prnt.sc/m7nge5

    grass appears to work but trees appear to work in reverse... as you can see the tree shadow but no tree.

    Anymore input on this issue?
     
    Last edited: Jan 16, 2019
  45. cAyouMontreal

    cAyouMontreal

    Joined:
    Jun 30, 2011
    Posts:
    279
    Hi there !
    We bought some speedtree assets from the asset store, and we tried to use them on the GPUI tree manager.
    GPUI is able to draw them, but we lost the wind effect on them, no matter what shader we set on the materials (GPUInstancer>Nature>SPDTree for example). Is there anything we need to know to fix that?
    We've tried to make our own shader (using Amplify Shader Editor) and we were able to perform different things like vertex offset or get world position, etc...Maybe when drawing the mesh using GPUI the system will cutout some important data speedtree needs for its shader (like some UV sets) ?
    Thanks !
     
  46. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    605
    The main issue (Invalid type in hlslcc vectorized matrix) looks to be caused by a problem in the shader cross compiler support in the Unity Linux versions. However, given your screenshot, you seem to have managed to run the foliage and tree billboard shaders without problems. My guess is that the incompatibility is with the SpeedTree shader.

    Can you check if Unity can render the SpeedTree object if you switch the Nature/SpeedTree shader on a SpeedTree object in your scene with the GPUInstancer/Nature/SPDTree shader (on a new scene, without using any GPUI managers at all). If it can't render the tree, then we will have identified the problem since GPUI uses this shader for SpeedTrees at runtime.
     
  47. LouskRad

    LouskRad

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

    When you first add a tree prefab to your manager, GPUI identifies its type by looking at the shader on it. If this is a SpeedTree shader, the prototype is identified as a special TreeType.SpeedTree case. When you enter play mode, GPUI creates a "proxy" game object for such prototypes (you can see this object in your Hierarchy window). This proxy object samples the wind parameters and supplies them to the rendered SpeedTree prototypes.

    You can check if the defined prototype's Scriptable Object (Prototype SO) has its Tree Type set to Speed Tree, and if not you can set it manually.

    Please note that the SpeedTree prefabs' materials must have SpeedTree shaders in order for them to be effected by WindZones (with the proxy) the same way as SpeedTrees are effected.
     
    cAyouMontreal likes this.
  48. LouskRad

    LouskRad

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

    The 0.9.9 update is live on the asset store. In this update, we have made various bug fixes and introduced a number of new features as usual:

    One major new feature introduced with this update is the Threading Option for the Detail Managers. This option will be the default setting for the Detail Managers (including your existing ones) and it will run the initialization of detail prototypes in dedicated threads. This will solve the initialization spike problems in large terrains.

    We have also added two API methods (GetDetailMapData/SetDetailMapData) that you can use to get removal changes from (or set custom layer maps to) your terrain details. We have updated the DetailInstancingDemoScene to showcase an example usage of these methods, you can take a look at the scene controller script to see these.

    This update also introduces some optimizations for the MapMagic integration. You can now use a single Prefab Manager with a scene with MapMagic setup that uses infinite terrains out of the box. This should increase performance in scenes with multiple terrains that are generated by MapMagic.

    We have also added an advanced optimization option to disable some components of the protoype prefabs in your project. This action will disable all the Mesh Renderers and LOD Groups in this prefab. This will speed up initialization operations on the Prefab Manager, since GPUI will not loop through prefab instances to disable these components at runtime. Please note, however, that these objects will be visible only during play mode and while the Prefab Manager is active and running. You will be able to enable the components back, but it is recommended to do this after you finished your scene design.

    The new core changes we introduce for this will allow you to use prefab streaming systems and optionally threading with GPU Instancer Prefab Managers. Please note that these are advanced features and we will add documentations for these in our wiki in the near future.

    Last but not the least, we have added an option to the foliage and tree billboard shaders that will ignore the camera rotation for them. This will be an ideal option to use in VR projects - in which this option will be enabled by default for newly created prototypes. You can see the difference in the below images:

    BillboardFaceCamPos off:



    BillboardFaceCamPos on:




    We hope you enjoy the new update!

    Here is the full v0.9.9 changelog:


    New: Threading option for Detail Manager initialization
    New: Option to disable Mesh Renderers on prefabs to increase initialization speed
    New: Prefab streaming system with PrefabListRuntimeHandler component
    New: Added an option to all billboards to face camera position (ignoring camera View Matrix rotations, ideal for VR)
    New: Min. Culling Distance option per prototype
    New: Option to filter prototypes when removing instances with colliders or bounds
    New: MapMagic Integration single Prefab Manager option
    New: MapMagic Integration Threading option for Prefabs when using single Prefab Manager with disabled Mesh Renderers
    New: Added GetDetailMapData/SetDetailMapData API methods for Detail Manager

    Changed: SetGlobalPositionOffset null checks and warnings added
    Changed: AddPrefabInstance method optimization when automatically increasing buffer size

    Fixed: Tree Proxy not being created when using no-GameObject workflow
    Fixed: Tree Proxy not being cleared when proxy GameObject is destroyed
    Fixed: Built-in shader source code not recognized without updating material when first added to project
    Fixed: Prototype preview icon lighting problem for Unity 2017 on Linear color space
    Fixed: Cross-fade method error on shaders when building in Unity 5.6 versions
    Fixed: Possible memory leak on repeated initialization for visibility buffer
    Fixed: SetGlobalPositionOffset not updating spatial partitions on Detail Manager
    Fixed: GPUInstancerInclude PSSL dot method casting error when building for PS4
     
    Last edited: Jan 17, 2019
  49. MadAboutPandas3

    MadAboutPandas3

    Joined:
    Jul 3, 2017
    Posts:
    27
    Hi there.
    We encountered a problem when trying to build a project with the GUPInstancer for iOS. The build fails with following error:
    Shader error in 'Hidden/GPUInstancer/HiZOcclusionDebugger':'Texture2D':syntax error syntax error at line 24 (on gles)

    We suspect that this is related to the target shader model. Adding "#pragma target 3.5" to the HiZOcclusionDebugger_GPUI shader helped getting rid of the error. Do you think this could cause any other errors down the line?
     
  50. cAyouMontreal

    cAyouMontreal

    Joined:
    Jun 30, 2011
    Posts:
    279
    Very complete answer, I like to know how things work behind the curtain, thanks for the explanation !
     
    LouskRad likes this.