No announcement yet.

Help with optimizing models for real time

  • Filter
  • Time
  • Show
Clear All
new posts

  • Help with optimizing models for real time

    I am looking for suggestions to optimize models designed for real time.

    1. Is the SDK Statistics tool accurate in the ST Modeler? It lists a high number of draw calls, even for models in ST's default library, usually >4. In the help docs, ST recommends no more than 3 for real time unless it is a hero object.

    2. If this statistic is correct, do you have tips to easily reduce the number of draw calls? Some of our models report 6-7 draw calls which is way too many. We typically only use 3 color sets and combine ST geo for branches and custom meshes for leaves and fronds.

    3. We have found a high correlation between the file size of the compiled tree and performance in game. In general, trees that result in a file size of >1MB perform poorly. Any suggestions on how to reduce final compiled file size?

    4. Our tree models are not excessively high in triangles, generall between 1,000 and 10,000 triangles. (ST documentation suggests between 1,000 and 12,000). We reduce this significantly at lower LOD's. We use 4 LODs on our trees.

    Thanks in advance.

  • #2

    I am guessing you're using a 5.x version

    When optimizing draw calls, always remember that color sets basically *are* draw calls. Aside from branches, which have to batch based on the material since they can wrap the textures, all the triangles of a certain geometry type can be batched together if they have different materials but use the same color set. So all your leaf materials should have the same color set. Same with fronds. Also remember that caps are stuck in with fronds, so make sure cap materials use the same color set as fronds. Usually a well optimized tree will have 3 draw calls: 1 for branches, 1 for caps/fronds, and 1 for all the leaves.

    I believe you are seeing diminishing returns by having 4 LODs. We never go above 3, and many times only use two. Each LOD is basically a whole additional mesh saved in the SRT file. Consider rendering more & bigger billboards so you can LOD to them closer to the camera.

    I can't speak to file size being a contributing factor, because that is really a symptom, not the cause. The speed of a tree comes down to the amount of geometry and, more often than not, fill rate limitations. Use the overdraw visualization render mode in the Modeler to see if you are particularly heavy in fill rate. Optimizing your leaf generation can help this dramatically. Also make sure the opaque parts of your textures use as much space as possible so you aren't wasting fill.


    • #3
      Will detail maps, applied to trunk/ branch material, always result in an additional draw call? Since it is a separate texture but still connected to bark color set?


      • #4
        Detail maps are just another texture lookup in the pixel shader.


        • #5
          Yes we are using 5.2 (in the process of updating to 6, but that's another story.)

          Thanks for the tips on # of draw calls. Can you give me an exampe of a tree in your library that only uses 3 calls? Looking at many of the trees supplied, they all seem to have >3. We are finding it very difficult to get a tree down to 3 calls that has leaves, fronds, branch, cap and detail textures.

          Regarding LODs, I will try reducing the number to 2-3. A few questions about LOD:
          - does the billboard count as 1 of these states?
          - when viewing the SDK stats in the modeler with 4 LODs, it only reports the stats for LOD 0, 1, 2. It does not provide stats for the lowest (most optimized) state. Is this a bug in the program? (Same for 3 LODs, it only reports stats for LOD 0 and 1... ignores the lowest state.)
          - what do you mean by "consider rendering more and bigger billboards..."

          Reducing LODs definitely reduces file size. We'll make some changes and see what sort of gains we can find in performance.


          • #6
            We don't fully optimize the trees in the library. The realtime trees are close, but we don't want to make assumptions for what the customers want to optimize (draw calls, fill rate, triangles, etc). What is giving you difficulty in getting 3 draw calls?

            I was not counting billboards.

            We only list 3 LODs because you really shouldn't use more than that.

            In the Compiler, you have many options for billboards, including the size and count for a particular tree.

            If you need to, use "save as with assets" from the file menu, zip all that up, and send it to [email protected]. We can take a look.


            • #7
              OK, understood on your library. I am not sure exactly what is giving us difficulty. I managed to reduce one particular tree from 7 calls to 5. (It shows 5 calls in the modeler, but when loaded in the compiler it shows 4 calls.) I'll email it to your support line, see if you can find a way to get it down to 3.

              For the SDK stats..... if I reduce the LODs to 3, it only lists 2 in the stats. If I reduce it to 2, it only lists 1.....

              In terms of billboards, we use 6 with an overhead.


              • #8
                We are now running ST6. Based on your experience, could you provide some suggestions for optimal settings in the compiler? There is a ton of control provided in the "Effect LOD" and "Wind LOD" panels. I'm curious if you have any advice on adjustments that will optimize performance without completely degrading the appearance of the trees.


                • #9
                  The defaults are pretty good, where most of the effects drop off after the first LOD. Once a tree gets far enough away from the camera, subtle effects won't be that noticeable anyway. The effects will smoothly fade off, so there will be no pop when the switch occurs.

                  If we're really pushing it in a demo, we drop down to per-vertex lighting pretty quickly. Grass, ferns, and flowers can always be per-vertex. Detail maps only need to be on the highest LOD, unless it drastically changes the color of the tree (like the douglas fir). Branch seam blending only needs to be when you're up close. Transmission is up to you, but it won't be on in the billboard anyway, so we usually drop it off, too. Basically, drop everything off unless it looks bad for the most optimal forest ;-)


                  • #10
                    Thanks Greg, I was able to boost FPS a bit. Is there a way to create custom presets in the Effect LOD panel? I didn't see an option but just thought I'd ask.


                    • #11
                      Not currently, but you can edit multiple materials at the same time. You can also edit multiple trees at the same time if you select them all and use the buttons in the toolbar to launch the effect/wind dialogs.