Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Hybrid renderer

Discussion in 'Data Oriented Technology Stack' started by xVergilx, Jan 23, 2019.

  1. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    1,936
    Hybrid renderer package got available recently in package manager.

    Has anyone tried it out yet?
    Looking at code it seems really interesting, as I was thinking about re-writing some of my decal system into ECS.

    Got me some ideas on how to properly hook the systems to cameras and the Unity's API.
    Although, it got me thinking why the Graphics API instead of CommandBuffer?

    Also, it would be nice to see some benchmarks against default render system (but it might be too early in development for this).
     
    Last edited: Jan 23, 2019
  2. vitautart

    vitautart

    Joined:
    May 3, 2018
    Posts:
    29
    Well, new Hybrid renderer API for 2018.3 is mostly the same as it was in previous ecs packages, now it is just separated to its own package with some little refactoring. And yes it is fast for a lot of same meshes, because of default instancing.
    The most interesting part of it is Hybrid renderer API for 2019.1 that uses not Graphics API but totaly new BatchRendererGroup. In source code it is called RenderMeshSystemV2.

    https://docs.unity3d.com/2019.1/Documentation/ScriptReference/Rendering.BatchRendererGroup.html

    If you want do some low-level stuff with Hybrid renderer, I recommend you start thinking about Hybrid renderer with BatchRendererGroup API and not about Hybrid renderer with Graphics API, because I'm assuming that this API would be deprecated in a future.
     
    xVergilx likes this.
  3. Sashok9203

    Sashok9203

    Joined:
    Jun 3, 2018
    Posts:
    24
    How to use it?
    Examples?
     
  4. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    1,936
    Attaching RenderMesh component + Position does the trick afaik.
     
  5. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    4,711
    There is no plan for deprecating it.

    The recommended approach is to simply use Entity + RenderMesh component + Position or LocalToWorld.

    We will be adding more features to it over time. Use Of BatchRendererGroup low-level API is an implementation detail and won't break anything in the normal usage. It will simply become faster.
     
    evanhu2003, FROS7, dzamani and 2 others like this.
  6. sngdan

    sngdan

    Joined:
    Feb 7, 2014
    Posts:
    927
    How far are we from being able to set colors via an IComponentData per Entity. I know it is possible today and there a few custom solutions out there...just curious if this is something you are working on at the moment or if it is a bit further out....
     
  7. learc83

    learc83

    Joined:
    Feb 28, 2018
    Posts:
    32
    One thing I noticed after upgrading to the new preview and switching to the new hybrid renderer, is that I was able to programmatically build meshes from within ECS code. Previously when I tried to construct a mesh I was getting warnings about the Vector arrays I was using to assign to mesh.vertices.

    I'm not sure if it was something to do with the hyrbrid renderer or no.
     
  8. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    25,562
    We're at the point in our game where we need to focus on how the levels are rendered. We're using a heck of a lot of prefabs for level geo instead of unique geo. Our game is not ECS based (yet) but does that mean we can still take advantage of superior static rendering performance wit this or is it for dynamic stuff?
     
  9. deus0

    deus0

    Joined:
    May 12, 2015
    Posts:
    17
    So, the 2019.1 alpha, they've changed the Mesh class, and can update the vertices a faster way? 'new preview and switching to the new hybrid renderer, is that I was able to programmatically build meshes from within ECS code' Did anything change with this particular mesh updating flow? I'm using Hybrid.MeshInstanceRenderer component simply to update meshes, while building my meshes inside another class using jobs. Is there a better way to build custom terrain mesh?
     
  10. js_bourdon

    js_bourdon

    Joined:
    Jul 10, 2018
    Posts:
    2
    I'm currently trying to combine the Hybrid Renderer with the Lightweight SRP. I managed to make it work, but quickly realized that baked lightmaps do not seem to be supported. Did I do anything wrong or is it indeed not supported. And if it's not, is it planned to be or that renderer is only intended to be used with the HD SRP with everything realtime?
     
    Last edited: Mar 28, 2019
  11. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    25,562
    It is WIP, big time. It will support everything as far as I know but Unity has to make it to begin with.
     
  12. Kender

    Kender

    Joined:
    Nov 16, 2012
    Posts:
    162
    Is there a way to check if the entity is visible/invisible? Also, I wonder how to hide/show an entity. Is there any tag component for this?
     
    Alverik likes this.
  13. Kender

    Kender

    Joined:
    Nov 16, 2012
    Posts:
    162
  14. Kender

    Kender

    Joined:
    Nov 16, 2012
    Posts:
    162
    I know that I can make renderer invisible if I set it's materials to zero length array, but I still wonder how to track the visibility of the entities. Gonna test if it is possible to set the entitie's material to null with no artifacts
     
    Opeth001 likes this.
  15. Deadcow_

    Deadcow_

    Joined:
    Mar 13, 2014
    Posts:
    102
    Is there a way to set material color per entity?
    I need something like in Boid example but with random boid colors. It feels really wrong to set unique shared component RenderMesh per entity... I'm just starting to dabble with ECS so sorry if it's too noobish question :)
     
  16. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    1,936
    There's no MaterialPropertyBlock support in the hybrid renderer yet (yet means a year has passed since the release with such a vital feature missing).

    So using single shared material per shared data is a valid approach, although, sub-optimal.
     
    Deadcow_ likes this.
  17. Deadcow_

    Deadcow_

    Joined:
    Mar 13, 2014
    Posts:
    102
    Thanks. I read about manual rendering via Render class somewhere (maybe first ecs samples used this approach?).
    Do you know maybe, is there some way to use MaterialPropertyBlock with manual rendering?
    Or any other way to achieve this with ecs? Basically I need to spawn a few thousands spheres of different colors and sizes, how hard can it be
     
  18. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    1,936
    There's no way around it w/o hacking hybrid render. Here's a link, someone posted a hacked version that should support material property block changes (I haven't tried it though).
    https://forum.unity.com/threads/materialpropertyblock-support-in-meshinstancerenderersystem.562369

    Alternatively, you can write your own render system, and hook it to the camera rendering via command buffer, or draw immediately via Graphics API.
     
    Deadcow_ likes this.
  19. francois85

    francois85

    Joined:
    Aug 11, 2015
    Posts:
    670
    Silly question but how do I verify that my mesh is actually going through the hybrid render. It seemed too easy to setup. Something must be wrong
     
    Last edited: Sep 12, 2019
  20. julian-moschuering

    julian-moschuering

    Joined:
    Apr 15, 2014
    Posts:
    347
    It is :)

    You can disable the RenderMeshSystemV2 in
    the Entity Debugger which should make your meshes disappear.
     
  21. francois85

    francois85

    Joined:
    Aug 11, 2015
    Posts:
    670
    fantastic thanks