Large Colmesh Faces Performance?

Discussion in 'Content Creation' started by NaxNir, Feb 18, 2016.

  1. NaxNir

    NaxNir
    Expand Collapse

    Joined:
    Jan 28, 2014
    Messages:
    618
    I heard somewhere that large collision mesh faces perform worse than smaller ones? Was/is that still true?

    For an example, imagine a plane that is around half the size of the GridMap heightmap. Which (collision) mesh would be better to use for performance?
    lo-poly.png hi-poly.png

    Thanks,
    NaxNir
     
  2. mumboking

    mumboking
    Expand Collapse

    Joined:
    Jun 11, 2015
    Messages:
    1,401
    I would assume that one larger one is better than many smaller ones.
     
  3. NaxNir

    NaxNir
    Expand Collapse

    Joined:
    Jan 28, 2014
    Messages:
    618
    Yeah, me too. It's just that I heard that it's actually worse performance that way. I don't know if what I heard was true, though.
     
  4. Nadeox1

    Nadeox1
    Expand Collapse
    Spinning Cube
    BeamNG Team

    Joined:
    Aug 5, 2012
    Messages:
    14,683
    Physics wise, the second image (in the OP - first image in this post) would be better performance (IIRC we had to subdivide the bridges in ECA a bit more to avoid performance issues)

    This is my own theory, so I might be wrong:
    edit - Actually confirmed from estama. It's somewhat like this. As far you keep the sizes (of the tris) uniform, performance won't suffer from it.




    Static collisions are calculate in a certain radius around the car.
    Now if you have a big plane which is subdivided like in the first case, the 'radius' is limited somehow as shown in the Static Collision debugger (not sure about the actual radius, I think the debugger has a different layout than the real one, but it should be something similar)
    If you have a big, simple, plane, the radius is no more limited, but bound the that actual face size. So it ends up to be bigger than case 1, and somehow affecting performance.
     
    #4 Nadeox1, Feb 18, 2016
    Last edited: Feb 18, 2016
    • Like Like x 6
  5. NaxNir

    NaxNir
    Expand Collapse

    Joined:
    Jan 28, 2014
    Messages:
    618
    Wow, thanks for your constructive post. /s :|
    "Does your post contribute to the thread? Please be aware that this is not instant messaging: Every post should contribute to the thread and be written out in a semi-formal manner. This is not a text message to someone. We have Private Messaging for that."

    Thanks! The only thing I don't understand is why if they're different sizes, performance will be affected.
     
    #5 NaxNir, Feb 19, 2016
    Last edited: Feb 19, 2016
    • Like Like x 1
  6. Nadeox1

    Nadeox1
    Expand Collapse
    Spinning Cube
    BeamNG Team

    Joined:
    Aug 5, 2012
    Messages:
    14,683
    The Static Collision Manager tries to divide a surface and split in into groups.
    If faces are uniform, the manager can group them more efficiently:
    43CnW5s.jpg

    But if you start having very large faces along with small faces, things go wrong as the manager won't be able to uniformly split the groups:
    JKsLSZI.jpg

    For example, the ECA bridges. We used to have performance issues on them as the faces were narrow and very long.
    R7o1gUm.jpg
    It means that as soon you pass on the bridge, the static collision would had to put that big faces in a group, ruining it.
    Now the bridge colmesh looks like this:
    SlrIvKO.jpg
    It's splitted in uniform parts, letting the static collision manager do it's job more efficiently.


    If you have 2 simple planes (4 vertices, 2 triangles), one sizes 500x500m and the other 1000x1000m meters, the performance would be the same on both. The thing that counts is that the size of the colmesh tris is uniform along the level.
     
    • Like Like x 7
  7. clayton8or

    clayton8or
    Expand Collapse

    Joined:
    Aug 26, 2013
    Messages:
    1,052
    Wow.. beam is more advanced than i thought. I never knew static collision was activated when you got close to it, that makes way more sense than just having everything on at once. Its like a little bubble of physics around the vehicle.
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice