Search Unity

  1. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  2. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  3. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  4. Participate with students all over the world and build projects to teach people. Join now!
    Dismiss Notice
  5. Build games and experiences that can load instantly and without install. Explore the Project Tiny Preview today!
    Dismiss Notice
  6. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  7. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Culling has a weird behavior

Discussion in 'Entity Component System and C# Job system' started by avvie, Dec 5, 2018.

  1. avvie

    avvie

    Joined:
    Jan 26, 2014
    Posts:
    69
    So I did create this project some time ago, which made it into the ecs samples
    Now that there is culling available I want to include culling into it. Problem is that I get some very weird behavior out of it. I spent the better half of yesterday reading the meshrenderer system and the renderBoundUpdateSystem and didnt manage to find out why.

    So if people can help out. the latest is here on the master branch. Any pointers on why it happens will be greatly appreciated

    https://github.com/avvie/ECS-Phyllotaxis
     
  2. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    655
  3. avvie

    avvie

    Joined:
    Jan 26, 2014
    Posts:
    69
    well i did provide the github with the full project, video doesnt provide nearly as much information as the full code, and culling does work
    but its not updating correctly. so it culls things that shouldnt be culled

    You can download and look exactly at the behavior. but as the parent object in the scene rotates the culling rotates as if the camera frustrum is rotating, which doesnt.

    I cant pinpoint where this happens, i looked at the source of the systems that are related and couldnt find the culprit
     
  4. avvie

    avvie

    Joined:
    Jan 26, 2014
    Posts:
    69
    After a lot of tinkering and digging. I manged to get the result I was expecting.

    It required for the entities in question to have both typeof(WorldMeshRenderBounds), typeof(MeshRenderBounds)
    and my problem was that i was defining the MeshRenderBounds on entity creation. It started behaving correctly when I defined WorldMeshRenderBounds.
    It still seems weird and a bit counter-intuitive to me that i need to define the World Mesh bounds and not the mesh bounds (in terms of naming).
    After i got that working as expected the weird behavior can be replicated by disabling MeshRenderBoundsUpdateSystem.
     
    Tony_Max likes this.