| Optimizing |
Intro: Optimizing levels has come a long way since Unreal Tournament 2004 so I decided to write up a short tutorial on a number of the changes as most of them aren't obvious and some aren't even used by Epic. This tutorial isn't to cover every technique that could be used in UT2004 but more about the things that are new for UT3. Memory Backfaces: Backfaces are surfaces that will never be seen by a player. When building levels for UT3 many surfaces will end up being covered by a static mesh or will have a side that faces away from the player at all times. Obviously you will not want that surface to be eating up memory it doesn't need to or reference textures that will never be seen. This is probably one of the easiest ways to optimize the memory of your maps and will also help a lot in the rendering side of things. In your generic browser open the engine package and look for a material named remove surface material. Now go into your level and select all of your backfaces and apply this material. This will pretty much tell the game to ignore this surface, no lightmap will be applied, any surface that has this applied will not be rendered. If you were to look at it in game all you would see is a solid black surface. You don't need to change the lightmap size or disable any other settings for it as the remove surface material does it all for you. Another thing you should every so often while working on your map is to go to tools and click "Clean BSP Materials" What this does basically is when you put two solid brushes together so that the faces on both brushes disappear those faces that you removed by putting the brushes together are still referencing a material and are taking up memory or in the long run may be referencing a material your not even using in your map anymore. Should definetly use this tool before releasing your map. LightMaps: Although an obvious thing for many mappers lightmaps can really eat up quite a bit of memory. You will almost never need to use a lightmap setting below 8. Another good thing to do is to go through your level and select surfaces that really don't have a shadow cast on them, or in other words a surface that is just dark or very bland in lighting. Most surfaces like this can be changed to a much higher lightmap such as 32, or 64. You can edit lightmaps on staticmeshes as well and it is actually advised as doing so can save you a huge ammount of memory when it comes to lightmap memory used. To change the lightmap on a static mesh open up the static mesh properties and make sure overridelightmapresolution is checked. Then under OverriddenLightMapResolution set the number you want your lightmap resolution for that mesh to be. To see how much memory your lightmap is using for this mesh throughout the map you can go to the primitive stats browser and find the name of your mesh and look under lightmap. Asset Usage: When you are done with your level go into the primitive stats browser and look for static meshes that you are only using 1-3 times. If you find ones that are only used a few times see if it's really important that the mesh is even there or see if it can be replaced by a very similar mesh, or be removed all together. This is not extremely important but if you really want your map to have less memory loaded at any given time this could become useful. You should also go through your level and check to make sure that textures are not only being loaded once for any area that it's not all that important to utilize it. Rendering DynamicShadows: DynamicShadows should be disabled on every surface that a dynamic light will never touch. Even if a surface is not receiving a dynamic light but has acceptdynamiclights enabled it degrades performance. Terrain: When you create a terrain in UT3 it will LOD at ceatain distances, and while this is a good thing in some instances it has been found that disabling LOD settings in the Terrain will actually make them run faster then to have it enabled. UE3 requires more to calculate the LOD process than it does to render the terrain full quality the entire time. To disable it set both LOD settings to the same number. SpeedTrees: Turn on occluding on all speedtrees not doing so will make a lot of bad overdraw and will hurt performance. Also be sure to turn off collision for speed trees if you can't reach or shoot through the tree at any time. StaticMeshes: A good thing to use when optimizing your map is the culldistance volume. You can start by placing one large culldistance volume that covers the entire map, or if you need some areas with more specific settings you can set culldistance volumes within other culldistance volumes. If you choose to put one volume within the other just remember that the engine will choose the culldistance volume that uses the most agressive settings. You can edit the settings in the preferences of the culldistance volume to tell the engine what sized meshes will be culled out at what distance. So if you put the size at 128 and a CullDistance of 4000 that means any mesh that is 128 Unreal Units in size will be culled out when the player is 4000 unreal units away. Another important feature in the static meshes is the occlude option. You may think that it is best to leave all static meshes to occlude but not rightly so. Make sure that all static meshes do not occlude except for the very large static meshes. If a static mesh is too small to occlude anything than turn it off. This is more to just take some calculating off of the engine as it no longer has to decide if a static mesh will occlude. Something that is valuable to remember when changing the occluding options under static meshes is that when you have a mesh that uses masking on it (Something such as grass, or plants) you should keep occluding on. All static meshes should have CastDynamicShadows set to false. Unless your using a mover or specifically want a static mesh to cast a dynamic shadow than this should be disabled. This doesn't disable casting shadows, just dynamic ones. Just like with Surfaces StaticMeshes should have AcceptDynamicLights to false if the static mesh will never get touched by a dynamic light. Just like with UT2004 collision should be disabled for static meshes that can not be touched or shot through by a rocket or other projectiles. Lights: You really shouldn't need to put dynamic lights into your level. Dynamic lights come at a huge rendering cost and can make the difference of getting below 5 FPS with dynamic lights to 40-50 without them depending on the complexity of your level. If you really must use dynamic lights than remember that the more static meshes with in the range of the dynamic light the slower it will render. Misc: Any material or static mesh that uses an unlit material should have acceptlights, acceptdynamiclights, and castdynamicshadows disabled entirely. Blocking volumes are really an uneccesary drainer when it comes to performance. Instead of a blocking volume you can often times use a static mesh. A simple flat mesh plane will work fine. However if you do use a static mesh for blocking make sure to disable acceptlights, acceptdynamiclights, and castdynamicshadows. Also in the collision for the mesh make sure to set it to blockallbutweapons. You don't need to replace all blocking volumes with these but replace them where you can. If you have any questions or if anything within this tutorial is unclear feel free to email me at evilmrfrank@yahoo.com |