In this presentation we make a summary of important optimization techniques that were adopted when porting Catan Universe to mobile. Most of them can also be universally applied in other Unity projects; let us know if they helped you.
Unity - Internals: memory and performanceCodemotion
by Marco Trivellato - In this presentation we will provide in-depth knowledge about the Unity runtime. The first part will focus on memory and how to deal with fragmentation and garbage collection. The second part will cover implementation details and their memory vs cycles tradeoffs in both Unity4 and the upcoming Unity5.
Unity - Internals: memory and performanceCodemotion
by Marco Trivellato - In this presentation we will provide in-depth knowledge about the Unity runtime. The first part will focus on memory and how to deal with fragmentation and garbage collection. The second part will cover implementation details and their memory vs cycles tradeoffs in both Unity4 and the upcoming Unity5.
GPU Renderfarm with Integrated Asset Management & Production System (AMPS)Budianto Tandianus
Was presented in GPU Technology Conference 2014 by Dr. Chen Quan.
The presentation recording and the definitive version of the slide can be downloaded from : http://on-demand-gtc.gputechconf.com/gtcnew/on-demand-gtc.php?searchByKeyword=S4356&searchItems=session_id&submit=
Lars-Erik from Movi presented the current state of video players, how they're constrained by legacy and how we wrote a video player mobile first, video experience first.
https://www.meetup.com/Singapore-Video-Technology/
This article contains information about performance optimization of Unity3D games for android. Different solutions provided both for CPU and GPU. Also here you can find methodology which will help you to detect performance problems, analyze them and perform appropriate optimization.
This is a short presentation Jon gave for the first Ottawa Unity User Group meetup. We share some of the tips and tricks we've discovered at Karman while working with Unity over the past few years.
Snaps are a new packaging format that allows unmodified binaries to run across a wide variety of distributions. Snapd is the software that manages snaps on a running system. Learn about the basics of snaps, snapd and what is needed to port snapd to OpenSUSE.
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Dr.Costas Sachpazis
Terzaghi's soil bearing capacity theory, developed by Karl Terzaghi, is a fundamental principle in geotechnical engineering used to determine the bearing capacity of shallow foundations. This theory provides a method to calculate the ultimate bearing capacity of soil, which is the maximum load per unit area that the soil can support without undergoing shear failure. The Calculation HTML Code included.
GPU Renderfarm with Integrated Asset Management & Production System (AMPS)Budianto Tandianus
Was presented in GPU Technology Conference 2014 by Dr. Chen Quan.
The presentation recording and the definitive version of the slide can be downloaded from : http://on-demand-gtc.gputechconf.com/gtcnew/on-demand-gtc.php?searchByKeyword=S4356&searchItems=session_id&submit=
Lars-Erik from Movi presented the current state of video players, how they're constrained by legacy and how we wrote a video player mobile first, video experience first.
https://www.meetup.com/Singapore-Video-Technology/
This article contains information about performance optimization of Unity3D games for android. Different solutions provided both for CPU and GPU. Also here you can find methodology which will help you to detect performance problems, analyze them and perform appropriate optimization.
This is a short presentation Jon gave for the first Ottawa Unity User Group meetup. We share some of the tips and tricks we've discovered at Karman while working with Unity over the past few years.
Snaps are a new packaging format that allows unmodified binaries to run across a wide variety of distributions. Snapd is the software that manages snaps on a running system. Learn about the basics of snaps, snapd and what is needed to port snapd to OpenSUSE.
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Dr.Costas Sachpazis
Terzaghi's soil bearing capacity theory, developed by Karl Terzaghi, is a fundamental principle in geotechnical engineering used to determine the bearing capacity of shallow foundations. This theory provides a method to calculate the ultimate bearing capacity of soil, which is the maximum load per unit area that the soil can support without undergoing shear failure. The Calculation HTML Code included.
Using recycled concrete aggregates (RCA) for pavements is crucial to achieving sustainability. Implementing RCA for new pavement can minimize carbon footprint, conserve natural resources, reduce harmful emissions, and lower life cycle costs. Compared to natural aggregate (NA), RCA pavement has fewer comprehensive studies and sustainability assessments.
HEAP SORT ILLUSTRATED WITH HEAPIFY, BUILD HEAP FOR DYNAMIC ARRAYS.
Heap sort is a comparison-based sorting technique based on Binary Heap data structure. It is similar to the selection sort where we first find the minimum element and place the minimum element at the beginning. Repeat the same process for the remaining elements.
Welcome to WIPAC Monthly the magazine brought to you by the LinkedIn Group Water Industry Process Automation & Control.
In this month's edition, along with this month's industry news to celebrate the 13 years since the group was created we have articles including
A case study of the used of Advanced Process Control at the Wastewater Treatment works at Lleida in Spain
A look back on an article on smart wastewater networks in order to see how the industry has measured up in the interim around the adoption of Digital Transformation in the Water Industry.
Final project report on grocery store management system..pdfKamal Acharya
In today’s fast-changing business environment, it’s extremely important to be able to respond to client needs in the most effective and timely manner. If your customers wish to see your business online and have instant access to your products or services.
Online Grocery Store is an e-commerce website, which retails various grocery products. This project allows viewing various products available enables registered users to purchase desired products instantly using Paytm, UPI payment processor (Instant Pay) and also can place order by using Cash on Delivery (Pay Later) option. This project provides an easy access to Administrators and Managers to view orders placed using Pay Later and Instant Pay options.
In order to develop an e-commerce website, a number of Technologies must be studied and understood. These include multi-tiered architecture, server and client-side scripting techniques, implementation technologies, programming language (such as PHP, HTML, CSS, JavaScript) and MySQL relational databases. This is a project with the objective to develop a basic website where a consumer is provided with a shopping cart website and also to know about the technologies used to develop such a website.
This document will discuss each of the underlying technologies to create and implement an e- commerce website.
Hierarchical Digital Twin of a Naval Power SystemKerry Sado
A hierarchical digital twin of a Naval DC power system has been developed and experimentally verified. Similar to other state-of-the-art digital twins, this technology creates a digital replica of the physical system executed in real-time or faster, which can modify hardware controls. However, its advantage stems from distributing computational efforts by utilizing a hierarchical structure composed of lower-level digital twin blocks and a higher-level system digital twin. Each digital twin block is associated with a physical subsystem of the hardware and communicates with a singular system digital twin, which creates a system-level response. By extracting information from each level of the hierarchy, power system controls of the hardware were reconfigured autonomously. This hierarchical digital twin development offers several advantages over other digital twins, particularly in the field of naval power systems. The hierarchical structure allows for greater computational efficiency and scalability while the ability to autonomously reconfigure hardware controls offers increased flexibility and responsiveness. The hierarchical decomposition and models utilized were well aligned with the physical twin, as indicated by the maximum deviations between the developed digital twin hierarchy and the hardware.
Literature Review Basics and Understanding Reference Management.pptxDr Ramhari Poudyal
Three-day training on academic research focuses on analytical tools at United Technical College, supported by the University Grant Commission, Nepal. 24-26 May 2024
Understanding Inductive Bias in Machine LearningSUTEJAS
This presentation explores the concept of inductive bias in machine learning. It explains how algorithms come with built-in assumptions and preferences that guide the learning process. You'll learn about the different types of inductive bias and how they can impact the performance and generalizability of machine learning models.
The presentation also covers the positive and negative aspects of inductive bias, along with strategies for mitigating potential drawbacks. We'll explore examples of how bias manifests in algorithms like neural networks and decision trees.
By understanding inductive bias, you can gain valuable insights into how machine learning models work and make informed decisions when building and deploying them.
6th International Conference on Machine Learning & Applications (CMLA 2024)ClaraZara1
6th International Conference on Machine Learning & Applications (CMLA 2024) will provide an excellent international forum for sharing knowledge and results in theory, methodology and applications of on Machine Learning & Applications.
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...ssuser7dcef0
Power plants release a large amount of water vapor into the
atmosphere through the stack. The flue gas can be a potential
source for obtaining much needed cooling water for a power
plant. If a power plant could recover and reuse a portion of this
moisture, it could reduce its total cooling water intake
requirement. One of the most practical way to recover water
from flue gas is to use a condensing heat exchanger. The power
plant could also recover latent heat due to condensation as well
as sensible heat due to lowering the flue gas exit temperature.
Additionally, harmful acids released from the stack can be
reduced in a condensing heat exchanger by acid condensation. reduced in a condensing heat exchanger by acid condensation.
Condensation of vapors in flue gas is a complicated
phenomenon since heat and mass transfer of water vapor and
various acids simultaneously occur in the presence of noncondensable
gases such as nitrogen and oxygen. Design of a
condenser depends on the knowledge and understanding of the
heat and mass transfer processes. A computer program for
numerical simulations of water (H2O) and sulfuric acid (H2SO4)
condensation in a flue gas condensing heat exchanger was
developed using MATLAB. Governing equations based on
mass and energy balances for the system were derived to
predict variables such as flue gas exit temperature, cooling
water outlet temperature, mole fraction and condensation rates
of water and sulfuric acid vapors. The equations were solved
using an iterative solution technique with calculations of heat
and mass transfer coefficients and physical properties.
10. 10
3. Hdg remote debug
- Unity plugin
- Real-time examining and modifying of the Unity hierarchy
- Target: an app running in a device (iOS, Android…)
- Simple A/B testing for analysing performance issues:
- Import plugin
- Insert prefab
- Open the remote hierarchy window
- Introduce IP of the target device running your app
- Examine hierarchy manually using binary search
- Turn on/off individual GameObjects and components to check performance impact
- Quick way of isolating bottlenecks
- Use other tools to find the issue within the chosen GameObject/MonoBehaviour
https://www.assetstore.unity3d.com/en/#!/content/61863
11. 11
4. Memory management
- Workflow:
- You allocate some memory blocks too often
- Unity triggers the (in)famous garbage collector, which it is itself garbage
- All threads are blocked for a long period of time (between 50ms and 1s in mobile?)
- Users are angry, dev gets fired
- Main problem: most allocations are implicit and evil. There’s no new
keyword involved, the dev doesn’t know about it till it’s too late
- Typical issues:
- Boxing: myNonGenericArrayList.Add(5);
- LINQ, foreach
- Dynamic instantiation of objects: use object pooling
- Coroutines: starting & creation of yield operations (please cache them and use return null
instead of 0 or boxing occurs)
- When not caching lists but rather recreating them
- Use the stack when possible instead of the heap
12. 12
5. Materials
- Unity offers no per-platform material system
- Materials can be pretty expensive because of the shaders and textures
- Solution? No solution, just workarounds
- I created a build step that replaces material references in compile-time to their
_desktop.mat and _mobile.mat counterparts
- Don’t use standard shaders in mobile
- Workflow:
- After the builds are completed, please check what was included in it using BuildReport
- An item (material, shaders, textures, audio...) you don’t like was included? Check its references with FindReferences2
- Use A+ Asset Explorer to quickly tweak texture settings (size, compression..:) and many other issues
- Create platform-specific shaders when expensive
13. 13
6. Textures
- Texture compression: of uttermost importance on mobile:
- Each texture fetch in fragment shaders will ask texture samplers for texels
- The texture block cache access is likely to miss if you have lots of big textures, therefore producing a stall
- It reduces startup and loading times, since textures are stored compressed both in permanent storage and RAM
- It will also reduce the distributed package size (APK/IPA..)
- If the format is not supported in the current architecture, it’ll be CPU-recompressed by Unity (longer loading times)
- It can, however, produce artifacts and you have to consider the platform capabilities
- Tweak texture size to your needs (screen size of the projected textures)
- Advanced texture filtering (>= trilinear) is still expensive in mobile
- Disable mipmapping when not needed (e.g. screen space UI)
- Check that expensive textures maps are not included in the mobile build: heightmaps,
detail maps, etc.
14. 14
7. Shaders
- Prefer lower precision variables in this order: fixed, half, float
- Avoid standard shaders; go instead for Lambert or Phong lighting models
- Do not have more than one light source. Mobile platforms support only forward
rendering so that every light creates a new rendering pass
- Do not use GrabPass (and therefore avoid post-effects), as they quickly stall the
rendering pipeline and will quickly reach your fill-rate and bandwidth capabilities
- Disable fog if not needed
- Avoid mega-shaders and big shaders; compile times will be annoying (e.g. 10 s)
- Fake lighting effects with unlit shaders with custom parameters
- Disable shadow support if possible
- Avoid alpha blending, as it breaks mobile GPU tiling optimizations and produces more
overdraw
- Consider introducing a z-prepass step in case of high overdraw and expensive
fragment operations
15. 15
8. Audio
Check Unity profiler for memory usage first
General recommendations:
- If they are taking too much memory (> 30mb), find AudioClips that are rarely played
and set them to streaming
- If they are increasing loading times:
- Set them to load in background (can get out of sync though)
- Disable preload, but you might get a framerate spike the first time they use it
- Set them to streaming, but that will cause CPU overhead
Play with compression methods
16. 16
9. Camera imposter system
- We want the desktop quality in mobile
- We know we can’t achieve it. But, can we fake it?
- Let’s take the background objects and make a static screenshot of them. We can put
that screenshot as a background picture in our scene
- Wait, that doesn’t work quite well:
- Depth information is lost
- Editing workflow is slow (taking screenshots, positioning them, deploying)
- Screenshots are resolution-dependent; we target heterogeneous devices and filtering would ruin its quality
- My approach:
- We render them in run-time with maximum quality at the beginning of the scene:
- A first time to grab the color buffer
- A second and last time to grab the depth buffer
- We disable the original objects
- We keep both textures in a RenderTexture
- We draw both textures at the beginning of each frame with special shaders that output color and writes to the zbuffer
17. 17
- It looks easy, doesn’t it? It is not
- There are many limitations imposed by Unity and OpenGL ES
- Still, I managed to render the whole background of the main menu scene of Catan with
all post-effects: sheep, terrain, environment, trees
- Advantages:
- Huge quality in mobile comparable to desktop
- High frame-rate
- Flexible and fast workflow
- Disadvantages:
- The objects can only be static (although you can re-render manually at any time)
- It is low-level and feels hacky. Unlikely, but it might break with future Unity releases and I’ll probably not be here to fix it
- It doesn’t work on older phones, since shader depth-writing requires OpenGL ES > 3.0
- It requires compiling the post-effect shaders and the original meshes and textures still (obviously)
9. Camera imposter system
18. 18
- Sources of power consumption:
- CPU:
- Intense calculations dissipate a lot of heat (power)
- Requiring data that was used a long time ago breaks temporal locality -> cache miss -> bandwidth requirement
- Asking for data that is distant from each other breaks spatial locality -> cache miss -> bandwidth requirement
- Induce device wakelock by performing background operations when the screen is off
- High frame-rate. Consider reducing it in some scenes (in highly static scenes 10FPS might be enough)
- GPU:
- Shader calculations eats most of it, especially if redundant (overdraw)
- Large amount of objects taking a big screen area excessively loads the rasterizer, produces overdraw if not well
sorted (e.g. transparency) and overloads shader processing units.
- GrabPass and post-effects eat bandwidth like a boss
- Screen:
- Darker colors usually consume less energy
- Other:
- GPS is power-hungry slow communication channel that prevents wakelock, avoid tracking users
- Making your game too addictive will also lead users to wasting lots of battery on it ;)
- Micro-optimization: set clear flag to pure black
10. Power consumption
19. 19
Conclusions
To “unoptimize” your mobile game:
- Don’t consider performance relevant from the beginning
- Put post-effects everywhere. If possible, in multiple full-screen cameras.
- Keep myriad of useless big textures in memory
- Use complex mega-shaders with multiple light sources
- Avoid static batching by forgetting to marking static flags
- Break dynamic batching by applying non-uniform negative scaling
- Reference unneeded materials because you can
- Do intense alpha blending to break GPU tiling optimizations and create more overdraw
- Do not cache coroutine yield instructions
- Ignore the Pareto Principle
20. 20
Conclusions
To “unoptimize” your mobile game:
- Use real-time reflection probes
- Use LINQ and start coroutines in a per-frame basis
- Using unsupported texture compression formats and disable mipmapping
- Don’t bother to make atlases, even though it only takes a few clicks to enable it
- Include uncompressed unoptimized audio even if you target deaf audience
- Use GameObject.FindObjectsOfType and GameObject.Find
- Use the hardware specs sheet as a beer/coffee coasters
- Leave imported mesh colliders there
- Use the new keyword on classes as often as your keyboards lets you type it
- Be lazy enough to skip checking the contents of the final build
21. 21
Conclusions
And lastly, to “unoptimize” your mobile game...
- Don’t communicate with colleagues when you are unsure about the performance
impact of your changes
We all are here to learn and improve (and some to gain money I’ve heard)