Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Official Hybrid Renderer V2 (0.4.0)

Discussion in 'Graphics for ECS' started by SebastianAaltonen, Mar 16, 2020.

Thread Status:
Not open for further replies.
  1. florianhanke

    florianhanke

    Joined:
    Jun 8, 2018
    Posts:
    426
    The Burst team shows a popup to restart the editor after installing the Burst package – it's rather heavy handed for this use case, but perhaps the way to go in an experimental package to manage expectations?
     
  2. Thygrrr

    Thygrrr

    Joined:
    Sep 23, 2013
    Posts:
    699
    How would I use RendererFeatures (e.g. RenderObjects) with Hybrid Renderer?

    Interestingly, it still renders something (even for an object that's converted to an entity), but the transform is off.

    More interestingly, the entity it renders before that pass is rendered correctly, including stencil values (or so it seems - I may be mistaken)

    EDIT: Turns out, the docs are right, shader graphs seem to be supported; sadly shader graph doesn't do front-face culling easily anymore. :/

    Interestingly, if I copy some of the shader code in ShaderGraph 9.0.0, the shader is incomplete or rather, it copies a lot but mostly the node I clicked on. There seems to be no way to get the full shader anymore - I think I could just reverse the faceSign otherwise.

    EDIT/2:
    Nevermind, it's in a better place now:
    upload_2020-7-21_1-51-56.png
     
    Last edited: Jul 21, 2020
  3. Thygrrr

    Thygrrr

    Joined:
    Sep 23, 2013
    Posts:
    699
    Well I got it to work with some excess geometry being rendered, but it's also possible to change the culling semantics in the generated shader. It's easier to just render it two-sided (I'm writing an outline shader), and because I use a stencil cutout method, it doesn't really matter at this stage.
     
  4. hidingspot

    hidingspot

    Joined:
    Apr 27, 2011
    Posts:
    87
    I can't seem to get ambient lighting to work with the hybrid renderer. I've tried just about every variation of package version, unity version, hybrid v1 and v2, URP and HDRP, uber lit shader, shader graph lit shader.

    Is it just not supported yet? Or am I missing something? Some help would be great, because lighting in my scene looks pretty horrible without ambient light:
     
  5. elJoel

    elJoel

    Joined:
    Sep 7, 2016
    Posts:
    125
    It's not supported yet:

     
  6. hidingspot

    hidingspot

    Joined:
    Apr 27, 2011
    Posts:
    87
    Thanks elJoel! I guess I should have spent more time going backward through this thread than I did fiddling with settings and versions of packages/Unity :p

    Looking forward to the 2020.2 release in that case!
     
  7. ryanslikesocool

    ryanslikesocool

    Joined:
    Jul 31, 2016
    Posts:
    49
    Ambient lighting appears* to work with the v2 define and Hybrid Renderer 0.7.0-preview 24, which was released a few hours ago. URP 9.0.0-preview 35, and Unity 2020.1.0b15+ are also required. There are other issues I've encountered (mainly half precision shaders being a pain), but at least ambient lighting is fixed :)

    *appears to work as in non-lit faces are no longer 100% black
     
  8. elJoel

    elJoel

    Joined:
    Sep 7, 2016
    Posts:
    125
    Awesome, got it to work with 2020.20a18.

    This:
    is now:
    const int kMaxBatchCount = 64 * 1024;
    to
    const int kMaxBatchCount = 64 * 1024 * 2;


    See below
     
    Last edited: Jul 24, 2020
  9. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    I did a small test project starting with same package manifest as our game our main materials/shaders and then upgraded to latest HDRP preview-33, and Unity just crashed repeatedly on the forced material upgrade couldn't get past that. Could very well be specific to our shaders we have a few customized ones. So more of an FYI and maybe possibly a known issue with a workaround?
     
  10. thelebaron

    thelebaron

    Joined:
    Jun 2, 2013
    Posts:
    851
    @SebastianAaltonen
    How should custom(non shadergraph) shaders work with V2 enabled?
    Currently I have a custom shader in URP mainly for modified lighting(which currently its not possible to recreate with SG) and a couple of custom properties. I don't necessarily care about being able to instance its properties for now, if it saves me any headaches of making it compatible with V2, though Ive done my best to attempt to do so in an effort to make it work.

    Ive added all my custom properties inside of "UNITY_DOTS_INSTANCING_START(MaterialPropertyMetadata)"
    upload_2020-7-22_22-45-40.png
    and then enabled the dots instancing keyword in all the relevant passes and for the main shader
    upload_2020-7-22_22-47-51.png

    Is there something else I'm missing? Without dots or just using hybridv1, the shader works fine(its also srp batcher compatible if that means anything here).

    The error I get:
    upload_2020-7-22_22-50-27.png
     
  11. mingwai

    mingwai

    Small Graphics Potato Unity Technologies

    Joined:
    Jan 16, 2017
    Posts:
    52
    Hi, I'm not sure the reason why it doesn't work but I have this shader which is working for me. Do you mind trying it out?
    It seems the texture tiling offset (_MainTex_ST / _BaseMap_ST) need to be wrapped as well and has a separate property for it.

    Code (CSharp):
    1. Shader "Custom/CustomDotsInstancingShader"
    2. {
    3.     Properties
    4.     {
    5.         _Color("Color", Color) = (0, 0, 0, 0)
    6.         [NoScaleOffset]_MainTex("MainTex", 2D) = "white" {}
    7.         _MainTex_ST("MainTex_ST", Vector) = (0, 0, 0, 0)
    8.     }
    9.     SubShader
    10.     {
    11.         Tags
    12.         {
    13.             //"RenderPipeline"="UniversalPipeline"
    14.             "RenderType"="Opaque"
    15.             "Queue"="Geometry"
    16.         }
    17.         Pass
    18.         {
    19.             Name "Pass"
    20.  
    21.             HLSLPROGRAM
    22.  
    23.             #pragma target 4.5
    24.             #pragma multi_compile_instancing
    25.             #pragma multi_compile _ DOTS_INSTANCING_ON
    26.             #pragma vertex vert
    27.             #pragma fragment frag
    28.  
    29.             #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SurfaceInput.hlsl"
    30.  
    31.             struct appdata
    32.             {
    33.                 float3 positionOS : POSITION;
    34.                 float4 uv0 : TEXCOORD0;
    35.                 #if UNITY_ANY_INSTANCING_ENABLED
    36.                 uint instanceID : INSTANCEID_SEMANTIC;
    37.                 #endif
    38.             };
    39.  
    40.             struct v2f
    41.             {
    42.                 float4 positionCS : SV_POSITION;
    43.                 float2 uv0 : TEXCOORD0;
    44.                 #if UNITY_ANY_INSTANCING_ENABLED
    45.                 uint instanceID : CUSTOM_INSTANCE_ID;
    46.                 #endif
    47.             };
    48.  
    49.             CBUFFER_START(UnityPerMaterial)
    50.             float4 _Color;
    51.             float4 _MainTex_ST;
    52.             CBUFFER_END
    53.  
    54.             #if defined(UNITY_DOTS_INSTANCING_ENABLED)
    55.                 UNITY_DOTS_INSTANCING_START(MaterialPropertyMetadata)
    56.                     UNITY_DOTS_INSTANCED_PROP(float4, _Color)
    57.                     UNITY_DOTS_INSTANCED_PROP(float4, _MainTex_ST)
    58.                 UNITY_DOTS_INSTANCING_END(MaterialPropertyMetadata)
    59.  
    60.                 #define _Color UNITY_ACCESS_DOTS_INSTANCED_PROP_FROM_MACRO(float4, Metadata__Color)
    61.                 #define _MainTex_ST UNITY_ACCESS_DOTS_INSTANCED_PROP_FROM_MACRO(float4, Metadata__MainTex_ST)
    62.             #endif
    63.  
    64.             sampler2D _MainTex;
    65.  
    66.             v2f vert(appdata v)
    67.             {
    68.                 v2f output = (v2f)0;
    69.  
    70.                 UNITY_SETUP_INSTANCE_ID(v);
    71.                 UNITY_TRANSFER_INSTANCE_ID(v, output);
    72.  
    73.                 float3 positionWS = TransformObjectToWorld(v.positionOS);
    74.                 output.positionCS = TransformWorldToHClip(positionWS);
    75.                 output.uv0 = v.uv0.xy * _MainTex_ST.xy + _MainTex_ST.zw;
    76.  
    77.                 #if UNITY_ANY_INSTANCING_ENABLED
    78.                 output.instanceID = v.instanceID;
    79.                 #endif
    80.  
    81.                 return output;
    82.             }
    83.  
    84.             half4 frag(v2f i) : SV_TARGET
    85.             {  
    86.                 UNITY_SETUP_INSTANCE_ID(i);
    87.                 float4 color = tex2D(_MainTex,i.uv0.xy) * _Color;
    88.                 return color;
    89.             }
    90.  
    91.             ENDHLSL
    92.         }
    93.     }
    94. }
     
    thelebaron likes this.
  12. vengefullfoot

    vengefullfoot

    Joined:
    Sep 24, 2018
    Posts:
    31
    Actually it is solved with the new version of DOTS.

    Thank you.
     
  13. elJoel

    elJoel

    Joined:
    Sep 7, 2016
    Posts:
    125
    Nevermind I think the way to go is to use this Setting:

    upload_2020-7-23_22-34-13.png

    Awesome!
     
  14. elJoel

    elJoel

    Joined:
    Sep 7, 2016
    Posts:
    125
    I've got a new error popping up now sometimes:

    Code (Boo):
    1. Thread group count is above the maximum allowed limit. Maximum allowed thread group count is 65535.
    2. UnityEngine.StackTraceUtility:ExtractStackTrace ()
    3. Unity.Rendering.SparseUploader:EndAndCommit (Unity.Rendering.ThreadedSparseUploader) (at Library/PackageCache/com.unity.rendering.hybrid@0.7.0-preview.24/Unity.Rendering.Hybrid/SparseUploader.cs:284)
    4. Unity.Rendering.HybridRendererSystem:EndUpdate () (at Library/PackageCache/com.unity.rendering.hybrid@0.7.0-preview.24/Unity.Rendering.Hybrid/HybridV2RenderSystem.cs:2818)
    5. Unity.Rendering.HybridRendererSystem:OnUpdate (Unity.Jobs.JobHandle) (at Library/PackageCache/com.unity.rendering.hybrid@0.7.0-preview.24/Unity.Rendering.Hybrid/HybridV2RenderSystem.cs:1456)
    6. Unity.Entities.JobComponentSystem:Update () (at Library/PackageCache/com.unity.entities@0.13.0-preview.24/Unity.Entities/JobComponentSystem.cs:132)
    7. Unity.Entities.ComponentSystemGroup:UpdateAllSystems () (at Library/PackageCache/com.unity.entities@0.13.0-preview.24/Unity.Entities/ComponentSystemGroup.cs:502)
    8. Unity.Entities.ComponentSystemGroup:OnUpdate () (at Library/PackageCache/com.unity.entities@0.13.0-preview.24/Unity.Entities/ComponentSystemGroup.cs:455)
    9. Unity.Entities.ComponentSystem:Update () (at Library/PackageCache/com.unity.entities@0.13.0-preview.24/Unity.Entities/ComponentSystem.cs:109)
    10. Unity.Entities.ScriptBehaviourUpdateOrder/DummyDelegateWrapper:TriggerUpdate () (at Library/PackageCache/com.unity.entities@0.13.0-preview.24/Unity.Entities/ScriptBehaviourUpdateOrder.cs:322)
    11.  

    Looks like other people already had the same issue here https://forum.unity.com/threads/thr...m-allowed-thread-group-count-is-65535.828420/ but not really any solutions.
     
  15. thelebaron

    thelebaron

    Joined:
    Jun 2, 2013
    Posts:
    851
    @mingwai thanks for the example! sort of got it working(need to experiment more), I believe most of my issues stemmed from targeting too low a shader model, and also possibly my use of keywords, which I see from reading in the docs, are not yet supported.
     
  16. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,983
    @elJoel I replied on the thread you linked.
     
    elJoel likes this.
  17. elJoel

    elJoel

    Joined:
    Sep 7, 2016
    Posts:
    125
    So this is the code in Hybrid Renderer 0.7.0-preview.24, SparseUploader.cs:284

    Code (CSharp):
    1.        
    2. m_SparseUploaderShader.Dispatch(m_KernelIndex, m_ThreadData->m_CurrOperation, 1, 1);
    3.  
    Where
    Code (CSharp):
    1.     public extern void Dispatch(
    2.       int kernelIndex,
    3.       int threadGroupsX,
    4.       int threadGroupsY,
    5.       int threadGroupsZ);
    6.  
    So something like this might work?

    Code (CSharp):
    1.                
    2.                 if (m_ThreadData->m_CurrOperation > 65535)
    3.                 {
    4.                     m_SparseUploaderShader.Dispatch(m_KernelIndex, m_ThreadData->m_CurrOperation, 2, 1);
    5.                 }
    6.                 else
    7.                 {
    8.                     m_SparseUploaderShader.Dispatch(m_KernelIndex, m_ThreadData->m_CurrOperation, 1, 1);
    9.                 }
    10.  
     
  18. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,983
    @elJoel seems this is fixed already (a pull request went in on Moday).
     
  19. elJoel

    elJoel

    Joined:
    Sep 7, 2016
    Posts:
    125
    Great, looking forward to the release or even better public github access ;).

    In the meantime my hack seems to be doing it's job so far.
     
  20. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,983
    It shouldn't, looking at the code :)
    It's uploading some stuff to incorrect locations.
    It also changes the number of invocations - when it's 64K or more invocations, it will just double them...
    I suggest to wait till the fix is there :)
     
  21. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    I've mentioned this before quite a while back. Conversion systems should not be internal please fix this it's such a simple change (skinned mesh conversion system).

    Also making IComponentData internal. Maybe sometimes possibly ok but DeformedEntity is not a valid case. For one it was public in it's previous form. And it's something you need to be able to access for some very common patterns with skinned meshes like runtime swapping of renderers that use the same rig.
     
    IgreygooI and NotaNaN like this.
  22. WildMaN

    WildMaN

    Joined:
    Jan 24, 2013
    Posts:
    128
    Anybody also having issues on Android after 2020.1 release compared to beta? Like all of a sudden RenderBounds aren't being initialized correctly when re-added (as a way to temporarily disable rendering in V1).
     
  23. Stroustrup

    Stroustrup

    Joined:
    May 18, 2020
    Posts:
    142
    i've noticed a lot of issues
    netcode, uitoolkit and hdrp 9 doesn't work. lightmapper crashes
    that be the way things are with beta stuff
     
  24. hidingspot

    hidingspot

    Joined:
    Apr 27, 2011
    Posts:
    87
    I agree with the general sentiment. It's frustrating when classes aren't extensible in straight-forward ways. Perhaps in this case they still expect significant changes to these elements? I don't know.
     
  25. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    Conversion systems should never be internal.

    The whole the api is still changing which they often throw out has nothing to do with whether something should be public or not. The latter stands on it's own as part of the design. The former is a different concern. And in practice if someone is using your api and it's hiding stuff it shouldn't then they are correctly going to fix your mistake. So by hiding stuff for the wrong reasons you accomplish nothing. This is just wrong thinking that has become engrained at Unity.

    In practice this has cost my studio many needless hours of work over the last year having to put stuff in dev mode and fix it, track the changes, and eventually revert a lot as they invariably open stuff up.
     
    Tudor_n likes this.
  26. Cell-i-Zenit

    Cell-i-Zenit

    Joined:
    Mar 11, 2016
    Posts:
    290
    What is the corect way of having multiple HybridRenderers at the same time?

    I need to switch between worlds, so what iam doing is to have a HybridRenderer on each system, but only enabled on the "current" world. But when switching between worlds, the objects act really funky eg everything is all over the place and completly wrongly scaled.

    Any idea? Do i need to "refresh" a buffer or something like that somehow?

    EDIT: also my procedural generated terrain doesnt spawn sometimes. They "later" pop in.

    So since my game is tiled, half of the tiles are not displayed most of the time. Any idea on this?

    EDIT2: i noticed that the lightning is off on the later spawned tiles:

    https://imgur.com/a/QVNvliB

    right popped in like 30 seconds later, left is spawned instantly

    EDIT3: also important to note is that i do the spawning 1 per frame. So its normal that my tiles "pop" in later, but this normally is done after 1-2 seconds. I can confirm that these tiles should already appear, but they dont. So i guess the HybridRenderer is a bit to "smart" and doesnt add newly created entities. Iam using V2 with Flag
     
    Last edited: Jul 30, 2020
  27. AlleywayNick

    AlleywayNick

    Joined:
    Jan 26, 2014
    Posts:
    26
    Hi @SebastianAaltonen and team!

    Not sure if this has been reported yet, but I'm getting these errors when using the profiler:


    Missing Profiler.EndSample (BeginSample and EndSample count must match): Render Camera
    Previous 5 samples:
    Render Camera
    Render Camera
    Shadows.PrepareDrawShadows
    GC.Alloc
    DisposeSentinel.Create
    In the scope:
    Render Camera
    Render Camera
    UnityEngine.CoreModule.dll!UnityEngine.Rendering::RenderPipelineManager.DoRenderLoop_Internal()
    PlayerLoop
    Main Thread

    Missing Profiler.EndSample (BeginSample and EndSample count must match): Render Main Shadowmap
    Previous 5 samples:
    Render Main Shadowmap
    Render Main Shadowmap
    RenderLoop.CleanupNodeQueue
    RenderTexture.SetActive
    Set RenderTarget
    In the scope:
    Render Main Shadowmap
    Render Main Shadowmap
    UnityEngine.CoreModule.dll!UnityEngine.Rendering::RenderPipelineManager.DoRenderLoop_Internal()
    PlayerLoop
    Main Thread

    Non matching Profiler.EndSample (BeginSample and EndSample count must match): Render Main Shadowmap
    Previous 5 samples:
    Render Main Shadowmap
    RenderLoop.CleanupNodeQueue
    Render Main Shadowmap
    Shadows.ExtractShaderPassContext
    Shadows.ScheduleRenderJobs
    In the scope:
    Render Main Shadowmap
    UnityEngine.CoreModule.dll!UnityEngine.Rendering::RenderPipelineManager.DoRenderLoop_Internal()
    PlayerLoop
    Main Thread


    Camera Settings:



    Renderer: Default Renderer (UniversalRenderPipelineAsset_Renderer)
    Anti-Aliasing: FXAA
    Dithering: Yes
    All other settings are defaults.

    Unity Version: 2020.1.0b16.4139
    Hybrid Renderer Version: 0.7.0-preview.24
    URP Version: 9.0.0-preview.35

    I apologize if this isn't the right place to post this :)

    Please Let me know if this is something I can fix on my end and keep up the good work. Using DOTS and the Hybrid Renderer has been really eye-opening and I'm very excited to see these systems continue to advance!

    -Nick
     
    Last edited: Aug 4, 2020
    alfiare likes this.
  28. mingwai

    mingwai

    Small Graphics Potato Unity Technologies

    Joined:
    Jan 16, 2017
    Posts:
    52
    Yes this issue is known and is already fixed in newer URP package version (in around 9.0.0-preview.42). The newer URP version will need a newer Hybrid Renderer / Entities package version (Hybrid Renderer 0.8.0-preview.13 is working for me). Seems these versions are not public yet, so you might have to wait for a bit..
     
    charleshendry and AlleywayNick like this.
  29. AlleywayNick

    AlleywayNick

    Joined:
    Jan 26, 2014
    Posts:
    26
    Ok excellent, thank you for the reply :)
     
  30. InnerScript

    InnerScript

    Joined:
    Jan 29, 2017
    Posts:
    38
    Out of curiosity, as part of planning and research...

    Does the Hybrid Renderer V2 work with a custom SRP? Is it automatic or does it require some sort of integration?

    If so, is there a way to make material property overrides in the same way for custom shaders?
     
    andywatts likes this.
  31. Stroustrup

    Stroustrup

    Joined:
    May 18, 2020
    Posts:
    142
    does the hybrid renderer now expose unity's delaunay tetrahedron system? i'm trying to replicate it with limited success. need a working example to go off

     

    Attached Files:

  32. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,753
    Does anyone know what in Hybrid Renderer causes it to leak JobTempAllocs on conversion, entering play mode or toggling live mode? And if there's anyway to fix/avoid it?

    I thought I was going insane trying to track down something in my own code until I built a quick standalone project with nothing but the hybrid renderer and the same models/meshes.

    Gut feeling it only happens with larger scenes (this subscene has 12,000 renderers)
     
  33. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    Any update on when we might see indirect lighting fixed? I'm guessing you have been waiting on the rendering team but it's been a really long time now with no word on this, an update would be nice.
     
    hkvik and charleshendry like this.
  34. runner78

    runner78

    Joined:
    Mar 14, 2015
    Posts:
    789
    Has there recently been a limit on how many renderers can be in a scene? In an experiment I found that up to 26,215 renderes (default cubes) I get the error:

    Failed to allocate space for chunk property metadata
    UnityEngine.Debug:Assert(Boolean, String)
    Unity.Rendering.HybridRendererSystem:AddNewBatch(BatchCreateInfo&, ComponentTypeHandle`1&, NativeArray`1, Int32) (at Library/PackageCache/com.unity.rendering.hybrid@0.8.0-preview.18/Unity.Rendering.Hybrid/HybridV2RenderSystem.cs:2541)

    Unity: 2020.1.2f
    Entities: 0.14.0-preview.18
    Hybrid Renderer: 0.8.0-preview.18
    URP: 9.0.0-preview.55
     
  35. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    351
    Hybrid V2 has no strict limit on renderers, but it has limits for other things like GPU memory, amount of batches (one batch = set of identical renderers), and the batch "metadata" (things that are allocated for each batch, but the amount depends on the amount of DOTS instanced properties) that you have hit. Currently, many of these internal limits are hardcoded, but we have plans to improve this in the future.

    If you need a workaround for this right now, you can edit the Hybrid Renderer source code and increase this number (e.g. double or quadruple it):
    Code (CSharp):
    1.         const int kMaxChunkMetadata = 256 * 1024;
    2.  
     
  36. runner78

    runner78

    Joined:
    Mar 14, 2015
    Posts:
    789
    I'm not sure if that was the problem. Later I also had problems with fewer meshes, but what was strange, when I instantiated the qubes, there was still no error, only when I replaced the meshes with proceduall generated (32-64 per frame), these mesches were then also not display. And after a series of errors, it worked again without any errors.
     
  37. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    351
    In the current version, adding 10 entities for 100 frames consumes more of these limited resources than adding all 1000 at once, due to more batches being created (in the extreme case, 1000 entities in 1 batch vs 10 entities in 100 batches), which could help to explain this. We have plans to improve this behavior in a future version also, so you would get similar results in both cases.

    EDIT: This post is imprecise, please see my later post for a more accurate description.
     
    Last edited: Aug 25, 2020
    cultureulterior likes this.
  38. Cell-i-Zenit

    Cell-i-Zenit

    Joined:
    Mar 11, 2016
    Posts:
    290
    Using the newest package for everything (aka hybrid renderer 0.7.0 v2 with flag and hdrp 9.0.0 preview.54, unity 2020.2.a21) results in alot of errors:

    1.) happens sometimes after the game is already stopped. I still get these errors in editor while NOT in game. So i need to restart as i get these errors like 10 times per second.

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. UnityEngine.Rendering.BatchRendererGroup.InvokeOnPerformCulling (UnityEngine.Rendering.BatchRendererGroup group, UnityEngine.Rendering.BatchRendererCullingOutput& context, UnityEngine.Rendering.LODParameters& lodParameters) (at <5a49b53f983842f9a177501f1de175b0>:0)
    2.) On start i get this error:

    Code (CSharp):
    1. Asset Packages/com.unity.shadergraph/ValidationConfig.json has no meta file, but it's in an immutable folder. The asset will be ignored.

    3.) If you look at the provided image, sometimes i get only for specific entities a shadow, but this all depends on the camera angle as it seems...

    4.) After i stop playing the game, most of the entities are still showing up in the editor. When i play again unity crashes instantly

    5.) Most of the time on startup procedurally generated objects are NOT! shown. The moment i move them the first time, they show instantly up. Strangely this doesnt happen for all objects (which would mean i have a bug), but it happens only for like half of them.. so if i spawn 9 objects, like 3-4 are not showing up. Also on each startup its a different object. I cannot think of any racecondition as i work on them after each other... Checking in the inspector i see no wrongly assigned texture etc to make them invisible.. the moment i move them they kick in so i guess its a fail with batching somehow
     

    Attached Files:

    Last edited: Aug 24, 2020
    florianhanke likes this.
  39. cultureulterior

    cultureulterior

    Joined:
    Mar 15, 2015
    Posts:
    68
    @JussiKnuuttila I thought as long as I instantiated an already constructed prefab (with shader variables changed) the hybrid renderer would just reuse it, but you're saying that if I instantiate 60 prefabs per second (which might happen in combat) I would get 60 batches per second being created?

    Is it worth batching this and creating 100 instances of each prefab at the start of the game and then just hiding/showing them as necessary?

    Is it worth doing this optimization or is this something you're gonna fix reasonably soon?
     
  40. runner78

    runner78

    Joined:
    Mar 14, 2015
    Posts:
    789
    I'm currently experimenting with a minecraft-like system and have the goal of visibility of an radius of 96 chunks, that would be over 460,000 unique chunks / meshes. As far as I can tell, that's about the maximum you can set in Minecraft bedrock edition.

    Basically, it took two systems to run well
    1. fast mesh generation (I use the new Mesh API) The current error message is blocking here
    2. dynamic occlusion culling. I haven't looked at that yet.

    Another problem with pure ECS at the moment is that it is difficult to manage frame-independent processes. That's why I process a maximum number of voxel chunks per frame. That has the disadvantage, if the value is too high then there are frame drops, if it is too low I waste computing power.
     
    NotaNaN likes this.
  41. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,753
    Hybrid renderer 0.8 has been out for 11 days (and hdrp 10 has been out for over 3 weeks it's hard to say if that's better to use than the latest 9 released a week ago.)
     
  42. elJoel

    elJoel

    Joined:
    Sep 7, 2016
    Posts:
    125
    I am not entirely sure but in the package manager you used to see when a package update was available. Now you have to manually look if there's a new Package version. This is why @Cell-i-Zenit might think he's using latest versions when in fact he is not.
     
  43. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    351
    I was a bit imprecise in my earlier post, let me try to give a detailed answer.

    Hybrid Renderer V2 renders using batches, where each batch is a collection of compatible (compatible roughly means that they have the same RenderMesh, plus some technicalities) ECS chunks. The current version supports adding more entities into the chunks that belong to a batch until the chunks are full, but it does not support adding more chunks into an existing batch. If new ECS chunks appear, new batches will be created for them.

    This means that as long as the entity archetype of a new entity exactly matches an existing chunk, it should get inserted into an existing batch efficiently. Instantiating prefabs should normally fall into this category, so you should get good batching by default.

    However, in cases where new chunks are constantly being created, the current version of Hybrid V2 is unable to add them into existing batches, and will create new batches instead, even if the new chunks would have been compatible with existing batches. This can happen when streaming, as entire chunks are usually streamed at once. It can also happen if new entities have a different archetype for some reason, like an unrelated shared component value, or different tag components. If enough new chunks are created at once, the resulting batches should still be large so this might not be a big problem, but it is possible to have a case where a single chunk is created each frame, resulting in many single-chunk batches that consume more memory and perform worse compared to the optimal case.

    What we plan to do in a future version is to allow Hybrid Renderer to combine small compatible batches into larger higher performance batches automatically, so you would get always get good batching as long as the entities themselves allow for it. Currently, we are concentrating on fixing bugs and improving memory usage, so it might take some time for this improvement to be implemented.
     
  44. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    351
    This sounds like a serious bug. Would it be possible for you to submit a bug report with a repro project?

    I think this is probably unrelated to Hybrid Renderer.

    This is a known bug that happens to some users, but unfortunately we don't yet know the exact cause. A bug report with a repro project would make it easier for us to try to fix this.

    I think this is possibly another known bug where CPU and GPU data sometimes get out of sync with each other when entering or exiting play mode. When this happens, you can try the debug menu options under the DOTS > Hybrid Renderer menu to see if clicking either of those works around your issue until we can fix the bug.

    The crash you mention sounds like a separate issue. It's possible that the InvokeOnPerformCulling bug is related to the crash.
     
  45. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    351
    By "unique chunks" do you mean that you have 460k entities each in a different ECS chunk? If this is the case, then the current version of Hybrid V2 will not be able to batch them efficiently. On the other hand, if the archetypes are mostly the same and it's just unique transforms and other IComponentData values, then this should be fine.

    We have another planned improvement that should improve performance in cases where there is more mesh and material variety, but it will take some time to implement.
     
    cultureulterior likes this.
  46. runner78

    runner78

    Joined:
    Mar 14, 2015
    Posts:
    789
    Each voxel-chunk entity has the voxel data as buffer and is pass in one ECS-chunk, so i have 1 Voxel-chunk = 1 ECS chunk. The voxel chunk are all the same. I instantiate a converted prefab, set the voxel data and change only the position and the mesh. The error occurs when I assign the new mesh.

    But I also have a lot of room to optimize, for example with empty chunks.
     
  47. Cell-i-Zenit

    Cell-i-Zenit

    Joined:
    Mar 11, 2016
    Posts:
    290
    okay so upgrading to the newest packages (the real ones this time) fixed half of the problems. Again on exiting playmode entities are not cleaned up but thats not a problem as it seems the problem is already on the way of getting fixed.

    Also the "missing" entities are gone now (aka they show up as expected).

    Now the only error i really have is that some external dependencies are not working (no problem for me).

    EDIT: ok i take it back, the missing entities are still there :< again if i move them, they reappear instantly
     
    Last edited: Aug 25, 2020
  48. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    You need to ditch chunks as a partitioning tool all around. It causes problems not just here but as I've said in earlier posts serious performance issues with culling and LOD. Just not the right tool for the job.
     
    pubg-leon likes this.
  49. linfuqing

    linfuqing

    Joined:
    May 11, 2015
    Posts:
    166
    Hi,I get the error in version 0.8.0-preview.18,how can i fix it?
    Code (CSharp):
    1. IndexOutOfRangeException: Index 35 is out of range of '35' Length.
    2. Unity.Collections.NativeArray`1[T].FailOutOfRangeError (System.Int32 index) (at <585b39397435425fbf094b4d94e07ed7>:0)
    3. Unity.Collections.NativeArray`1[T].CheckElementReadAccess (System.Int32 index) (at <585b39397435425fbf094b4d94e07ed7>:0)
    4. Unity.Collections.NativeArray`1[T].get_Item (System.Int32 index) (at <585b39397435425fbf094b4d94e07ed7>:0)
    5. Unity.Rendering.SimpleCullingJob.Execute (Unity.Entities.ArchetypeChunk archetypeChunk, System.Int32 chunkIndex, System.Int32 firstEntityIndex) (at Library/PackageCache/com.unity.rendering.hybrid@0.8.0-preview.18/Unity.Rendering.Hybrid/HybridV2Culling.cs:344)
    6. Unity.Entities.JobChunkExtensions+JobChunkProducer`1[T].ExecuteInternal (Unity.Entities.JobChunkExtensions+JobChunkWrapper`1[T]& jobWrapper, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) (at Library/PackageCache/com.unity.entities@0.14.0-preview.18/Unity.Entities/IJobChunk.cs:363)
    7. Unity.Entities.JobChunkExtensions+JobChunkProducer`1[T].Execute (Unity.Entities.JobChunkExtensions+JobChunkWrapper`1[T]& jobWrapper, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) (at Library/PackageCache/com.unity.entities@0.14.0-preview.18/Unity.Entities/IJobChunk.cs:337)
    8.  
     
    Last edited: Aug 31, 2020
    Green127 likes this.
  50. thelebaron

    thelebaron

    Joined:
    Jun 2, 2013
    Posts:
    851
    Getting a bunch of these notifications in the console, not sure of what impact its having?
     
Thread Status:
Not open for further replies.