Announcement

Collapse
No announcement yet.

Understanding performance bottlenecks?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #31
    CobaltUDK Thanks for the example. This is very similar to what I've just added. I'm not bothering to iterate through each of the PerInstanceData array though, instead just checking a single one in the mid point of the array. It's a rough approximation, but generally if your cluster size isn't too huge, it will be fine.

    In your example you check all of the PerInstanceData up until to find one that is outside of the range, then hide the cluster. Seems unnecessary to check any more than one.

    Also Chosker regarding my previous post on how to get the scale from the transform matrix. Here's what I'm now using:
    Code:
    //-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    //Gets the scale from a matrix transform.
    //-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    final function vector MatrixGetScale(Matrix TM)
    {
        local Vector s;
        s.x = sqrt(TM.XPlane.X**2 + TM.XPlane.Y**2 + TM.XPlane.Z**2);
        s.y = sqrt(TM.YPlane.X**2 + TM.YPlane.Y**2 + TM.YPlane.Z**2);
        s.z = sqrt(TM.ZPlane.X**2 + TM.ZPlane.Y**2 + TM.ZPlane.Z**2);
        return s;
    }
    
    //-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    //Sets the scale on a matrix transform.
    //-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    final function Matrix MatrixSetScale(Matrix transform, Float _scale)
    {
        transform.XPlane.X *= _scale;
        transform.XPlane.Y *= _scale;
        transform.XPlane.Z *= _scale;
    
        transform.YPlane.X *= _scale;
        transform.YPlane.Y *= _scale;
        transform.YPlane.Z *= _scale;
    
        transform.ZPlane.X *= _scale;
        transform.ZPlane.Y *= _scale;
        transform.ZPlane.Z *= _scale;
        return transform;
    }
    I've now added a system to swap out all of my speed trees billboards (beyond a given radius from the player) with instanced meshes using the same system I used for the modular building pieces.

    Now an example save game (i was using for testing), which was running at ~25fps last week, is now running at around 140fps! The performance increase has been insane using the foliage tool for mesh instancing.

    I'm now going to take it even further with the foliage culling as CobaltUDK has suggested, and see what kinds of results that brings

    Comment


      #32
      It's a big improvement. I think hiding the distant clusters will improve it even more.
      Provisional blog: http://cobaltudk.blogspot.com.es/
      Videos: https://www.youtube.com/user/cobaltudk
      Facebook: https://www.facebook.com/babylonprojectgame/

      Comment


        #33
        Originally posted by O_and_N View Post
        This is out of my league, but doesn't the procedural building feature have similar capabilities, rendering many instances of the same mesh and reducing the draw calls?

        I was testing procedural buildings the last week. The problem for me is that it's a volume, which works well for buildings in the background, but not for buildings where the pawns move around.

        Anyway using them for large buildings can be counterproductive, because it reduces drawcalls, but the ones that are there always draw the whole building, that is, they make the occlusion worse.

        I made 3 basic pieces, which don't slow down too much. And I'm thinking of making some more pieces that group 2 or 3 of these, to reduce the drawcalls a little but without making the occlusion much worse.

        Click image for larger version

Name:	modular_04.jpg
Views:	89
Size:	275.7 KB
ID:	1725887
        Provisional blog: http://cobaltudk.blogspot.com.es/
        Videos: https://www.youtube.com/user/cobaltudk
        Facebook: https://www.facebook.com/babylonprojectgame/

        Comment


          #34
          Thought I'd show a before and after when using my new system using the foliage tool to render the individual modular building pieces as instanced meshes:
          Before:

          After:


          As you can see, this experiment has been a major success with around a 10x performance increase. In this scene there are nearly 6000 individual building pieces. It doesn't seem to matter how many I add, the performance seems to hold steady. My players that have very large bases will be happy with this update
          Last edited by Coldscooter; 02-26-2020, 09:52 PM.

          Comment


            #35
            hah, very nice. you even have better shadows
            Follow me on Twitter!
            Developer of Elium - Prison Escape
            Local Image-Based Lighting for UE4

            Comment

            Working...
            X