Announcement

Collapse
No announcement yet.

Instanced Static Mesh Decreasing performance!

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

    #16
    But... in the example above all (or most) of the meshes are visible. So why is it then more effective to use static meshes?

    Comment


      #17
      I made two test cases. One using the editorcube mesh, and another using Sphere (StaticMesh'/Engine/BasicShapes/Sphere.Sphere'). That sphere is 960 tris and 559 verts, very close to your model. Keep in mind my video card is a beast (Titan).

      1) Cube:

      Was able to spawn 100,000 instanced cubes and the GPU time was 8ms

      2) Sphere:

      With 5000, GPU is still at 8ms.

      With 15000, GPU time is ~28ms. That is 28 million triangles coincidentally. My renderquery time was only 20ms.


      What video card are you running?

      You mentioned that renderquery was still just as long with only 2x2 (aka 4) total instances, right? Is it actually the same number or just also high?

      If you can give us the renderquery time with only a few instances that will be helpful. If there aren't many instances there should be no reason for that number to be high. If it still is really high Id suggest making a new test BP in a new level. Never hurts to rule things out. Maybe old instance data somehow was hanging around somehow.
      Last edited by RyanB; 05-06-2015, 05:27 PM.
      Ryan Brucks
      Principal Technical Artist, Epic Games

      Comment


        #18
        The card is a Geforce 650Ti (1GB).
        The times were much shorter for only a few meshes, but still worse for instances than ordinary meshes and i don't need more than a few hundred meshes before the fps drops to critical levels.

        I will repeat the experiments in a new project and with different meshes on this weekend (on a business trip right now).

        @RyanB: Do you get better or worse performance if you replace the add instance with just an ordinary add static mesh? I suppose you cant try that on 15000 meshes though so it might get difficult for you to test ...

        Comment


          #19
          Originally posted by Kartom View Post
          But... in the example above all (or most) of the meshes are visible. So why is it then more effective to use static meshes?
          Instanced Static Meshes cost more on the GPU than regular static meshes, but cost less CPU time to process and submit them. However, my understanding is that they only cost a little bit more, and only in vertex time, not pixel time.

          If all or most instances are visible at once, then they're useful but if most are not visible then they're not a good fit (but can still be used in spatially local regions, e.g., instead of 64x64, do 16x16 regions for example to balance culling with batching).

          RE: Your actual situation, 4k x 840 is a decent number but not totally insane for a modern GPU (3.36 M tris). However, I'm wondering if they're some how accumulating and you are drawing way more than you think you are; maybe throw in a ClearInstances call on the component before the for loop, and also make sure you only have one of these actors in the level.


          Cheers,
          Michael Noland

          Comment


            #20
            Once again, thanks all for the help and information.
            There is a lot of test suggested in this thread that i will carry out as soon as i am back.

            Comment


              #21
              I added the "ClearInstances" call before adding the instances, and suddenly the framerates are up around 70 fps.
              Now i can remove the "ClearInstnaces" call and still have 70 fps. Obviously there must have been tons of instances lurking in the background.
              Problem solved, but I am not completely comfortable that I can't reproduce it.

              [EDIT:] I am able to reproduce it!
              While fidelling around i found that have removed the PointLights i had in the first example, and when i placed a couple of point lights over the tiles the framerates dropped very low again.
              I turns out that if i have a few point ligths in the scene the rendering with Static Meshes is more effective, but if one only use directional light the instanced meshes are more effective. How can that be? (The point lights are set to stationary)
              Last edited by Kartom; 05-10-2015, 05:03 PM.

              Comment


                #22
                Sorry for reviving an old thread, but I am interested in the answer to Kartoms last question.

                Was this overseen or is it solved somewhere else? Can anyone provide any helpful statements?

                Comment


                  #23
                  Have you (or anybody) been able to reproduce the results in the latest version of the engine?

                  Comment


                    #24
                    Dynamic lighting is expensive? I can reproduce this
                    Need another dev on your UE4 project? Send me a shoutout and I'll lend a hand

                    Comment


                      #25
                      That dynamic lightning is expensive is understandable, but why does it work so bad together with instanced meshes? In my previous experiments I didn't get no way near the same penalty when working with ordinary static meshes as i got with instanced static meshes.

                      Comment


                        #26
                        That i cant answer mate. Try heirarchical instanced meshes instead.
                        Need another dev on your UE4 project? Send me a shoutout and I'll lend a hand

                        Comment


                          #27
                          its simple math and expected behavior.

                          with directional light, all of the trees get rendered twice no matter where the light is. once for the view once for the shadow.

                          with point lights, its going to do the lighting calculation using the bounds. individual meshes have tight bounds that fit around the mesh. instanced static meshes get grouped together, so a few lights inside of a forest will of course cause more shadow rendering compared to regular static meshes. They have been grouped together so in effect the pointlights will each be affecting more polygons and objects with larger bounds which then tough more neighbor groups.

                          Hierarchical instances should not have the same limitation or the crossover point might be different.
                          Ryan Brucks
                          Principal Technical Artist, Epic Games

                          Comment


                            #28
                            I know this is an old post but does the foliage tool and foliage spawner use Hierarchical instances.

                            Comment

                            Working...
                            X