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

Culling has a weird behavior

Discussion in 'Entity Component System' started by avvie, Dec 5, 2018.

  1. avvie

    avvie

    Joined:
    Jan 26, 2014
    Posts:
    74
    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:
    2,683
  3. avvie

    avvie

    Joined:
    Jan 26, 2014
    Posts:
    74
    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:
    74
    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.