Optimized 15 FPS to 52 FPS on Mobile |Boat Attack| URP | Unity 2020

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so hello guys and welcome and in this video i will be showing you how i optimize unity's official boat attack project demo from 1314 fps to 50 52 fps on my snapdragon 730 android mobile phone i will also be showing you tips and tricks that you can apply to your project and i will be covering almost all of the gpu optimization techniques so just see this video till the end and you will know everything here's the boat attack running at 50 52 fps on my mobile you can see fps in the profiler window [Music] first we need to understand how the computer draws the frame now the central processing unit cpu and graphics processing unit gpu work together to essentially make the game run now cpu is generally has high speed goals so its major task is to do the calculation part like checking player input checking calculating collisions and physics etc with the output of these calculations as instructions gpu draws the frames now here comes the part we need to identify the bottleneck that is the root of the problem is it the cpu or is it the gpu that is unable to do its task on time resulting in frame drops that we are experiencing now in most cases it is the gpu which is unable to do its task on time because in today's world we have fairly fast cpus i mean my laptop cpu is fairly fast and less powerful gpus i mean my laptop's shitty powerful gpu so to find the bottleneck here comes our first tool unity's profiler now earlier this was a pro only feature and believe me unity was very clever in making this feature a pro only but not now this feature is completely free and you can just go to windows analysis profiler and and you will get to know what's exactly happening while your game is running in the background it will just give you the craft and everything will be clear as crystal that what is causing the problem or maybe not okay let's come to reality the profiler is a really complex tool as it almost it is one of the most powerful tools of unity but it is complex so as soon as you click on the play mode yeah the profiler will start running and it will give you the graph now when you click on any of the second the time the profiler will show you which process is taking what amount of time in that particular frame now if the problem is in a specific device for example android which was in my case the profiler can also be easily attached to the device and it will show you what's happening in the background of your app while it is running on that particular device in my case it was finished frame rendering followed by a wait for signal meaning it is the rendering that is taking too much of time and the cpu is just waiting for its signal to finish so here it is clear that it is the gpu which is the bottleneck so what all techniques i will be covering will be gpu optimization techniques as i already said this video will be more of what you need to do rather than how to do it but don't worry if you want to dig deeper into unity's performance optimization i will be linking all the resources in the description down below so do check them out if you want to dig deeper draw call batching we can group game objects in a scene together that share the same material which allows unity to render multiple objects at once now draw call batching is of two types dynamic batching and static batching now unity automatically handles the dynamic matching but not the static one so but the process is fairly simple you just need to go to inspector window and that static drop down menu just check the batching study now this is generally been done for the objects that are static meaning that aren't moving in our scene so the another tip is just group your objects in your scene as static and dynamic it will help you a lot shadows shadows makes the game object to be rendered multiple times so minimize the use of shadows max shadow distance can be set up low quality shadows can be selected and shadows should be eliminated for small objects that are necessary combining meshes so that if many game objects have similar meshes unity generally loads each one of them which is resource consuming to tackle this we can combine meshing it is also possible to increase performance from 18 to 100 fps in some cases as was shown in this video as you can see the scene is currently running at around 20 22 fps but after applying the combined meshes technique the scene runs at 100 fps it is going up to 102 fps and that is a performance increase textures now we can compress textures to have smaller memory footprint we can also and you should also enable the mipmaps option so that unity can use the lower resolution version of the textures for smaller triangles we can also combine different textures into one single big texture atlas so that unity doesn't need to load every texture again and again which is again resource consuming and this thing is done outside of unity generally in a 3d modeling software or a texturing software lot groups now we can set up lot groups so that if a camera is at a certain distance from an object a lower poly version of that model would be used resulting in less resource consumption thereby increasing performance setting it up is fairly simple gpu instancing what if you want to load hundred thousand objects and all of them have the same material and mesh well unity will have to pass that information to the gpu that many times fairly making it impossible for such scene to be rendered here comes gpu instancing we just pass the material and mesh once and every time we only pass the information as where the frame needs to be drawn and the best part is unity does it all we just need to have a tick an option of gpu instancing on all of your materials so in the search bar just select the materials and in every of your material just take that gpu instancing and you will have a huge performance increase it is it just takes few seconds to implement this you can see in this video there are a hundred thousand objects and it is running at full 60 fps without any performance drops [Music] there are 100 000 objects in this scene and it is running at full 60 fps without any drops occlusion culling it basically calls whatever the camera cannot see and this is one of the most popular technique that is used in almost every other game that you are playing right now use big lightings use bake lightings and bake reflection probes as much as possible although they will increase the memory footprint but they will drastically reduce the load on the cpu and gpu which is a main concern [Music] here are some of the project specific settings for the one that has been made on urp and is targeted for android just go towards the quality settings and uncheck medium and high settings let it be on low texture quality be it quarter resolution disabled and isotropic textures disable real-time reflection probes we don't want anything to be real time and just cross check with my other settings for example vsync count let it be known sync well after we have done these settings just go to the universal rendering pipeline quality settings [Music] and here just check that the opaque down sampling is 4x by linear and it is and the profile we are currently modifying is the low quality settings profile and just cross check that hdr is enabled because if hdr is disabled the color quality will be highly reduced we don't want that but next shadow distance is approximately 100 disabled soft shadows and just cross check my other quality settings [Music] now there are some of the lighting settings that needs to be modified we will be using the bake lightings as i already said just check the light mapper resolution it is in my case it is 2.5 pixels per unit be it low don't let it be more than this and just check my other lighting settings and last and lastly one more thing just ensure that all of your light probes and reflection probes are baked are set to bake and after you have set them to bake just go to the lighting settings and pick everything it will take some time but you are now good to go so that's it for this video i hope it helped you and if it did then do hit that like button and help me make more such content by subscribing to the channel and i'll see you in the next one till then
Info
Channel: sanchitgng
Views: 46,969
Rating: undefined out of 5
Keywords: Unity, game developer, Optimization, sanchitgng
Id: oQDhb9VIBqc
Channel Id: undefined
Length: 10min 25sec (625 seconds)
Published: Wed Jul 29 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.