Search Unity

How a longtime programmer develops in Unity... Me and my unorthodox way

Discussion in 'General Discussion' started by GarBenjamin, Jun 26, 2016.

  1. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    I honestly don't think it's a good idea at all to use built in occlusion culling in this manner, even jobified to hell. It is not designed for culling massive amounts of objects.

    Instead, you might want to look at culling groups. These could represent groups of instanced objects together, and this would work with the built in occlusion Culling fine. This would be high performance and work well IMHO, even now.

    Alternatively I'd look into compute shaders for culling if the above wasn't doing it.
     
    Martin_H likes this.
  2. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
    Could occlusion be part of the rendering pipeline, we already have Camera occlusion (which I assume is FOV based) with the scriptable rendering pipeline a front to back 'Z pass' could be used to find out what is visible and what is occluded?
     
  3. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    No, you want to cluster and occlude larger lumps, or you want to use a compute shader to decide what will get drawn. Why do you want to force the CPU to examine every object and multi thread that, when you can just do less work?
     
  4. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    How i miss this thread? Thank you.
    I felt a mutant to code as i do, ie not in the 'Way of Unity'. Happy to discover that i am not the only one.

    To sumarize : 'give me the API and let me do what i do'. :)
     
  5. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194

    ECS Update of Space Invaders 48 x 48 invaders running in editor at about 128fps vs the classical version with lots of performance tweaks that could only manage about 30 fps (in editor).

    Although the ECS version does not have Sound or Particle FX as they are not part of the ECS system at the moment.
     
  6. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Sound and things like this, you need to think about having a listener pattern, where ECS will say "I need this done" and anyone listening will say "OK I'll do that job for you" rather than a direct connection.
     
  7. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    Interesting thread. I come from the otherside of the pool I have never liked to "design" things from code. Before ASP was a thing I wrote my own view engine transforming xml as views and bind them to VB5 code using XSD.

    I have always strongly emphasized that code is not good at describing views in a human readable form.

    For example take a simple html like

    Code (CSharp):
    1. <div class="float-right">
    2.    <h3>My floating window</h3>
    3.    <div class="content">
    4.        ....
    5.    </div>
    6. </div>
    You can pretty easy visualize this in your head right?

    The pseudo code equivalent would be something like

    Code (CSharp):
    1. var window = HtmlElement("div");
    2. window.Class = "float-right";
    3. var title = new HtmlElement("h3");
    4. title.Text = "My floating window";
    5. window.AddChild(title);
    6. var content = new HtmlElement("div");
    7. content.Class = "content";
    8. window.AddChild("content");
    Its much easier for the human brain to translate the former to a view in their head.

    Just my two cents!