A Unity ID allows you to buy and/or subscribe to Unity products and services, shop in the Asset Store and participate
in the Unity community.
Calling all New Unity users! Join the Halloween Mods Showcase Challenge until October 31.
Discussion in 'Assets and Asset Store' started by LouskRad, May 3, 2018.
You can use the SetLODBias API method.
Thanks for the info. Do you happen to have an example of how to use GPUI and DOTS together?
The asset that never disappoints. Thanks!
Thank you for checking, I went back and checked again and when I turned off the default option LOD Cross Fade I am able to see the trees during run-time
I've been using GPU grass on my terrain for a while now and it's been great. I recently updated the my terrain to use PBR shaders and now find there's a now visually a significant saturation and brightness difference between the GPU grass and my terrain. I noticed that when I scrub my Ambient Color value in the scene Lighting from white to black, the grass is heavily affected where as the PBR materials on my terrain are affected much less.
I'm wondering, is there a PBR version of the foliage shader? Or is there some way to turn off or reduce the amount of Ambient Color the GPU grass will receive?
Are you planning on switching the shader graph node over to the custom function node or should I now copy and paste to a shader file?
Thank you for the reply. I think I now understand how nested prefabs work, but am trying to grasp the coding structure to spawn parents during runtime.
From the asteroid video, if I made a parent called "asteroid cloud", would I have to add each of its asteroid kids into the instance list? I'm using 2018.3.14
Does each "asteroid cloud" also need to be added to the instance list and be a registered prefab?
Do I need to instantiate each child or can I just instantiate the parent?
Edit: Nevermind, figured it out.
I'm making a VR game, and using a custom CG shader, and am getting really bad flickering on most of the geometry. Depending on what I'm looking at, it will stop flashing on and off for some things when looking at some angles, but most of the time it'll be flickering. Switching to the Standard GPUI shader solves the issue, so it seems specific to my shader. This does not occur in the Scene View at edit time.
Excerpts from my shader:
#pragma vertex vert
#pragma fragment frag
#include "AutoLight.cginc" // shadow helper functions and macros
#pragma multi_compile_fwdbase nolightmap nodirlightmap nodynlightmap novertexlight
#pragma instancing_options procedural:setupGPUI
#define USING_FOG (defined(FOG_LINEAR) || defined(FOG_EXP) || defined(FOG_EXP2))
My vertex data struct has UNITY_VERTEX_INPUT_INSTANCE_ID at the end. My vertex to fragment struct has UNITY_VERTEX_OUTPUT_STEREO at the end. My vertex program begins with:
I must be missing something, what is it?
It looks like this is related to Occlusion Culling, since when I disable it I don't get flickering. Disable Depth and Stencil is unchecked, what else do I need to have set in order to get a proper camera depth texture?
is it possible to using GPUI with openGL ES 3.1 on Android 5.1 or 6.0 ... or should be Android 8.0 and above?
We currently don't have an example, but we will look into providing one.
The foliage shader was developed using Amplify Shader Editor. You could use that tool to modify the shader to your liking or use a custom material with a third party shader for your grass instead of the GPUI foliage shader.
the custom function node unfortunately does not allow for adding the requires #pragma directives. We will look into adding one when Unity provides this option. You could copy and paste the shader code to a shader file to have the GPUI converter work on it. Another alternative would be using a third party SRP compatible shader generator such as the Amplify Shader Editor.
The issue looks like caused by your shader making use of the depth texture. You can use the Debug option on the HiZOcclusionGenerator to see what final depth texture GPUI is using for it's occlusion culling process. You can see this component added to your camera at playmode.
Also, you might need to override the built-in depth/normals shader to use one that is setup for GPUI and your shader. You can use the Internal-DepthNormalsTexture_GPUI and add a pass to it for your custom shader.
Rather than the Android version, the issue is with the compute shader limitations of the target device. The Android 5.1 and 6.0 devices would generally have a risk of having incompatible hardware with GPUI.
Thanks for the reply, though unfortunately overriding the built-in shader did not solve the problem. I'm not knowingly making use of the depth texture for anything. Here's the debug output during a frame where a lot of stuff has disappeared:
When you say add a pass to your DepthNormals one, what do you mean? Right now my shader is intentionally single pass, other than shadows:
// shadow casting support
UsePass "Legacy Shaders/VertexLit/SHADOWCASTER"
//FallBack "Legacy Shaders/VertexLit"
Here's the result when I look in a direction with no flickering (still messed up):
Will there be a Map Magic 2 Integration?
As you can read in there Thread does it come out in 2 - 3 Months.
Ah, I misread the FAQ for shaders. I need to manually paste in the shadow caster pass and add the GPUI stuff to that.
Doing that fixed the flickering, however now I have no shadows a̶n̶d̶ ̶m̶y̶ ̶q̶u̶i̶t̶e̶ ̶s̶i̶m̶p̶l̶e̶ ̶s̶c̶e̶n̶e̶ ̶r̶e̶n̶d̶e̶r̶ ̶t̶i̶m̶e̶ ̶i̶s̶ ̶o̶v̶e̶r̶ ̶1̶0̶0̶m̶s̶.̶ ̶I̶s̶ ̶t̶h̶e̶r̶e̶ ̶a̶ ̶s̶i̶g̶n̶i̶f̶i̶c̶a̶n̶t̶ ̶o̶v̶e̶r̶h̶e̶a̶d̶ ̶f̶o̶r̶ ̶s̶e̶t̶t̶i̶n̶g̶ ̶u̶p̶ ̶p̶r̶o̶t̶o̶t̶y̶p̶e̶s̶?̶ ̶I̶ ̶h̶a̶v̶e̶ ̶3̶4̶.̶ ̶M̶y̶ ̶i̶n̶t̶e̶n̶t̶i̶o̶n̶ ̶i̶s̶ ̶t̶o̶ ̶h̶a̶v̶e̶ ̶a̶ ̶l̶a̶r̶g̶e̶r̶ ̶n̶u̶m̶b̶e̶r̶ ̶o̶f̶ ̶p̶r̶o̶t̶o̶t̶y̶p̶e̶s̶ ̶w̶i̶t̶h̶ ̶s̶e̶v̶e̶r̶a̶l̶ ̶h̶u̶n̶d̶r̶e̶d̶ ̶i̶n̶s̶t̶a̶n̶c̶e̶s̶ ̶-̶ ̶m̶a̶y̶b̶e̶ ̶i̶n̶ ̶s̶o̶m̶e̶ ̶c̶a̶s̶e̶s̶ ̶a̶ ̶t̶h̶o̶u̶s̶a̶n̶d̶ ̶o̶r̶ ̶t̶w̶o̶ ̶-̶ ̶f̶o̶r̶ ̶e̶a̶c̶h̶ ̶p̶r̶o̶t̶o̶t̶y̶p̶e̶.̶ (didn't see that a SteamVR error gave me horrible, terrible performance).
So yeah, not sure the issue with shadows, but that's the only thing left here.
[EDIT] Aaaand got it, switching to the included shadow caster fixed my issue. Maybe I wasn't blending properly with my own one, not sure:
// shadow casting support
Small doc suggestion: add that example code to the FAQ, especially since you have an included caster pass already.
So, I have bought the instancer a long time ago and tried it in a few scenes with MapMagic. All of the scene have a lot of speedtrees and dense gras. But I always struggle to make it work, although it should be easy enough, right ?
GPU Instacer 1.2.3
First, importing the grass actually drops my performance ! And although all color values seem to be imported correct, some grass billboard don´t get those colors (and appear white for example).
Second, the import of trees seem to increase performance, but the billboard colors are wrong (see palm trees in the second shot). Also, the tree billboards don´t blend but clip in.
I have tried different unity version and different (also new) projects. Same result.
In Unity 2019 I even get some compile errors:
Today I have seen that there is an update so I imported it. Result are compile errors and I cannot even build anymore. But I get a performance increase in the editor at least.
So yeah, I have no idea what to do with this package now but I absolutly need it for my projects
Since it´s so easy to use, I have no idea what I´m doing wrong.
Thanks for the reply @LouskRad I fired up Amplifyshader and fixed my grass issues.
I have another question. In my game there will be hundreds of small terrain tiles. Setting up all the grass/prop detail layers to match one another is pretty time consuming. If multiple terrains can't instance a single prototype definition, is there any way I can copy all the visual data from one prototype to all my other prototypes? (size/color/asset references etc...)
How do I set this up to handle multiple terrains? Like Dobalina, I have hundreds (500+) of terrain tiles. Also, can I have my own foliage painter that manages the tree data (where the trees are), and uses GPU instancer to generate billboards / render?
Thank you for the feedback. You can also disable the Shadow with Original Shader option in the manager for the same effect without having to manually add the GPUI Shadows Only shader as a UsePass Shadowcaster pass.
We are following the process and we will look into it when is released.
and thank you for the screens.
Regarding performance when instancing terrain details with GPUI, you can take a look at this wiki article. If the grass does not show the colors in the manager, that is not supposed to happen. Please send us a sample project showing this so we can investigate it.
For Billboard colors, you can adjust the brightness in the Billboard Settings section of the manager, or use a custom billboard that is not generated by GPUI.
As for the error you got prior to updating to GPUI v1.2.4, it looks like the generators are null. We have not encountered this before. We can analyze this if you can send us a sample project. On the other hand, we fixed the errors you get with v1.2.4 and we will soon submit an update with these fixes.
Hi there, and thank you for the feedback.
Currently GPUI does not offer a way to copy settings between different prototypes, but we will look into it.
For detail and tree managers, you can add one for each of your terrains. However, If you wish to use a custom prefab painter for your foliage and trees, you can paint them as prefabs and use a Prefab Manager with them instead (you can still use the billboard generator that way).
you can take a look at this video for an example:
Cool! Does the same apply to details? Are the detail and tree managers just editor wrappers around prefabs, or would I lose rendering features going this route?
I will try to make a small sample project. Can you give me an contact email for the link ?
The Detail Manager features some terrain specialized techniques (e.g. partitioning) for massive numbers which can result in better memory management in scenes with extreme amount of details, but in terms of core rendering all managers share the same features.
Thanks. You can use email@example.com
Hey there, I'm using GPU Instancer with 2019.03.b06 and MapMagic. It works fine, but a part of the custom editor of MM integration is not drawing completely, as you can see on the Screenshot. Also GPUInstancerMapMagicIntegration script had some EditorUtility calls that were not within #if UNITY_EDITOR, so it wouldn't compile in a build.
Hmm... I'm trying to integrate it into my foliage painter, but I don't want to instantiate prefabs, or any of that sort of thing. I'm just looking to register a prototype, and then be able to push matrices that act as the individual transforms, using that no-game object approach. In other words, just rendering, no scene prefab variant scanning, or anything like that. Currently trying to make a stripped away form of the prefab manager, and having some trouble. Any tips on how I should go about this?
Essentially my goal is to build a GPUInstancerManager that can create a prototype based off a prefab, and then during runtime take in a list of matrices, and then render, without instantiation. I'm having so much trouble figuring out what to add and what to remove oof
While preparing a sample project for you, I came across a new problem. Trees are not shown ingame and the editor windows shows only billboards.
Also, I have to add ;MAPMAGIC everytime after import in the player settings in all versions I have ever used. It never registered automatically. Could that be a hint ? Anyways, should I send you this project ?
There is a bug in the GPUICrowdUtility, the animationData is being set to twice the buffer size, but the if check is set up without the *2, which results in the animationData not being resized when needed and throwing out of array bound errors.
GPUICrowdUtility.cs line 18 should look like this:
``` if (runtimeData.animationData == null || runtimeData.animationData.Length != runtimeData.bufferSize * 2)```.
hi, so i've been using "directX 11 grass shader" for my project and its really great.but i dont know how to set up dx11 grass like you did in you example scene.i tried to use custom material in generate prototype section and dx11 grass material but every single grass on my terrain will be disappear. i also tried to right click on the dx11 grass material and set it up for GPU ,but dont know how to add the new material that is generated in gpui prototype manager
Hi there, and thank you for the feedback.
We have fixed the map magic related compile errors in version 1.2.5, which you can currently download from the Asset Store.
As for the editor glitch, it is probably caused by some bug from the beta version you are using. The bug will most likely be fixed in the release version of Unity, and if not, we will provide an Update.
you can take a look at this wiki page for a starting point.
the reason why your instances don't show in the editor during play mode is because you have enabled the "Use selected Camera only" option. This prevents GPUI from rendering to the scene Camera:
As for why MapMagic is not adding its scripting define symbol, you can ask that to Denis.
Thank you for the feedback, we will look into it for the next update.
Since this asset uses GPU to generate the grass, it would not be compatible with GPU Instancer.
ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) (at <a8ed250850854b439cedc18931a314fe>:0)
System.ThrowHelper.ThrowArgumentOutOfRangeException () (at <a8ed250850854b439cedc18931a314fe>:0)
System.Collections.Generic.List`1[T].get_Item (System.Int32 index) (at <a8ed250850854b439cedc18931a314fe>:0)
GPUInstancer.GPUInstancerDetailManager+<MergeVisibilityBufferFromActiveCellsCoroutine>d__26.MoveNext () (at Assets/GPUInstancer/Scripts/GPUInstancerDetailManager.cs:725)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Scripting/Coroutines.cs:17)
GPUInstancer.GPUInstancerDetailManager:StartCoroutineAlt(IEnumerator) (at Assets/GPUInstancer/Scripts/GPUInstancerDetailManager.cs:566)
GPUInstancer.GPUInstancerDetailManager:UpdateSpatialPartitioningCells(GPUInstancerCameraData) (at Assets/GPUInstancer/Scripts/GPUInstancerDetailManager.cs:157)
GPUInstancer.GPUInstancerManager:UpdateBuffers(GPUInstancerCameraData) (at Assets/GPUInstancer/Scripts/Core/Contract/GPUInstancerManager.cs:535)
GPUInstancer.GPUInstancerManager:LateUpdate() (at Assets/GPUInstancer/Scripts/Core/Contract/GPUInstancerManager.cs:256)
if (cell.totalDetailCounts[r] > 0)
I believe it's caused by disabling then reenabling the scene in some order. Could also be due to more than one terrain in the scene.
This is most likely because the scene is disabled/enabled while the detail initialization thread is still running. You can try disabling the Initialize in Threads option in the Global Detail Values section of your manager(s) and see if the error persists.
I'm having issues with using Amplify Imposters and GPU Instancer. I'm using imposters as an alternative to billboards on the HDRP pipeline. The OctahedronImposterHDRP shader works great, but when being instanced by GPU Instancer I run into a couple of issues.
The left tree is being instanced by GPUI, the right is gameobject that the instance is based on.
These are the settings:
As you can see, the imposter from the instanced tree does not cast a shadow, but even worse the top half that should be drawn over the skybox is being cut off.
I don't really know where to look, any help would be greatly appreciated.
I've been able to reproduce the issue on the original model by enabling Alpha To Coverage. However I don't know how to ensure that GPU Instancer doesn't enable this option.