How to increase frames per second in low poly simple game? - unity3d

I'm struggling with performance in unity. I created a very simple game scene. Very low poly. 2 light sources, 1 Directional 1 Point, I have the Standard Shader with Alberdo and Occlusion texture set (this for all few 3D objects in the scene)
The issue is, I was expecting fps to be around 60 but it is 29ish..
What things I have to consider regarding performance in this scenario? it is very frutstating since it is a very, very simple scene
see images:

In your Quality settings, as mentioned by Hamza, set shadow resolution to medium setting and set V sync count to "Dont sync".

Related

Collision / Rigidbody not working properly in small objects

I have this simple domino scene where you can click a domino and apply a force to knock it.
At first I had this dominoes in a scale of (x=0.1), (y=0.6), (z=0.3) 1 is supposed to be 1 meter, they fell without a problem but too slow. According to unity documentation on Rigidbody this made total sense.
Use the right size.
The size of the your GameObject’s mesh is much more important than the mass of the Rigidbody. If you find that your Rigidbody is not behaving exactly how you expect - it moves slowly, floats, or doesn’t collide correctly - consider adjusting the scale of your mesh asset. Unity’s default unit scale is 1 unit = 1 meter, so the scale of your imported mesh is maintained, and applied to physics calculations. For example, a crumbling skyscraper is going to fall apart very differently than a tower made of toy blocks, so objects of different sizes should be modeled to accurate scale.
So I just re sized the dominoes to (x=0.01), (y=0.06), (z=0.03), this time they fell to the desired speed but for some reason they stop falling and don't knock the next domino.
example GIF
I don't know why this is happening but i can guess that this is because at the time of calculating physics the engine doesn't waste so much resources in calculating small objects that are probably not even going to be seen by the user.
Modifying mass doesn't seem to do anything, also draw and angular draw are both 0 and already tried every collision detection mode.
Is there any solution or workaround for this?
In my experience, Unity physics doesn't like too small objects since it introduces rounding errors. A game simulation usually does not need the same accuracy as when you try to land on Mars. Therefore, I usually avoid scales less than 0.1f.
In your case, I would keep the scales at 1.0f and instead experiment with either increasing the world gravitation, changing it from the default -9.81f to -98.1f (Edit - Project Settings - Physics). Or changing the default Time Scale from 1f to 5f (Edit - Project Settings - Time).
Try not to make too big changes in the beginning since it might introduce strange effects on other parts of the gameplay.

Why are mipmaps not boosting sprite performance in this 2.5D scenario?

I have a situation where I have loads of high-resolution bushes.
The issue is, these bushes are far too high detail and thus cause performance issues (partly because of shadows). A smooth solution to this would possibly be mipmaps, allowing the bushes to become lower resolution when further away from the camera. However, this did not work as anticipated.
Scene with mipmaps (as you can see the sprites further away are blurry):
Scene without mipmaps:
This is the performance difference.
With mipmaps
Without mipmaps
Why is there no performance increase?
Your mipmaps are not the solution for your performance issue. They only reduce the texture resolution of the objects further away. The performance difference is there, but it is not what you expected.
737 Batches is alot of draw calls batched together.
To reduce the draw calls and to gain the desired performance boost
you have several options:
Reduce the Triangle Count. You did not show the wireframe as suggested, but what you want to do for your grass is have a simple square with 2 triangles and use the alpha mask based texture like you already did.
Make your material more efficient: for example do not use 2 sided rendering, if you use a shader graph, reduce the amount of processing.
Make them grass objects static and bake your lighting. as the renderer will need 1 draw call for the mesh and 1 draw call for the light, this will drastically reduce your draw calls.
Additionally, you could also group several grass objects into clusters. Texture them with one material, as each individual material also efeccts your performance.
To understand the difference between draw calls and batches, read this:
https://support.unity.com/hc/en-us/articles/207061413-Why-are-my-batches-draw-calls-so-high-What-does-that-mean-
Very informative forum post on polycount where Joe Wilson shares some knowledge. Worth a read:
https://polycount.com/discussion/206507/the-cost-of-a-texture-draw-call-quantity-vs-resolution

2DLights - Universal Render Pipeline - Lightweight RP

I'm working with Unity 2019.4.11f1, "Universal Render Pipeline" with "Lightweight RP" (package version 7.5.1).
I defined a "2D Renderer Data" to work with 2D Lights.
In my game I have four 2D lights:
Two "Point" 2DLights (each point light has 3 target sorting layers)
Two "Global" 2DLights. One of them with 3 target sorting layers (lights up my whole game except characters) and the other with 1 sorting layer (Illuminates only my characters).
I'm developing a 2D mobile game for kids and using 2D lights to decorate.
Only ONE "Point" 2DLight is turned on at the same time.
The "Global" light, which illuminates my characters, is always turned on.
The "Global" light, which illuminates my whole game (except characters), is ON only when the point light is OFF.
At certain times in my game, I turn on/off "Point" lights and "Global" light with the above restriction already described.
Everything works great until I use shadows on my characters.
When I use shadows, the frame rate is dropped right down to about 10 fps otherwise it's about 27.
My 2D game is pretty simple. My characters are round sprites (like a coin), so shadows are ridiculously simple.
To gain in performance, I set "Renderer Texture Scale" to 0.4 (insted of default value 1) in the object 2D Renderer Data.
While the performance has greatly improved after that, it is still low.
Each character (above 10 on screen, moving around) has a "Shadow Caster 2D (Experimental)" component and checkbox "Cast shadows" selected.
What else can I do to improve performance? I've done a lot of research and can't figure out what else I can do.
You can
Decrease the size of your sprites (or compression)
Make static gameobjects whichs are non have movement
Check your renderer graphics detail
You can make manual occlusion to your game (you can enable and disable gameobject in the scene)
You can use OnBecameVisible() function.
I am using these to optimize my urp game.

High quality zoom in unity terrains

I have an application that uses the Unity terrain engine to view the terrain (and models on the terrain) with a few different fields of view. This is essentially a camera with telescopic zoom that transitions from 1x to 3x then to 9x.
The problem I'm having is that the various detail roll off settings (Detail Distance, Tree Distance, Billboard start etc.) are all based on the distance from the camera to the 'detail'. At 3x and 9x zoom the view starts at 200 units, and goes out to 2000 units. The landscapes look pretty rubbish, none of the grass shows up, and the trees are all billboarded (like a mid 90s game :-))
I'm trying to set a min & max range for detail based on what I can see in my viewport, not how far the camera is from that detail.
Has anybody got a suggestions as to how I can ramp up distant details when I have my tighter FOVs?
Thanks in advance.
Try add mipmaps for all textures on scene and disable lods on objects and check new details!
Make sure you are using standard size for your objects (1 unit ~ 1 meter)
Make sure all textures sizes are power of two and have mipmaps enabled.
Go to quality settings and Make sure Max LOD level is 0
Change LOD bias and see if it helps (1 is more details, 0 is less details)
Check detail distance in terrain itself and make sure it is far enough.

Unity3d, baked shadows quality

UPDATE: the problem was in floor size. I just made it smaller and problem is solved.
Hello there, I spent almost 1 week already googling... hope that you can help me with that. I baked my shadows, result and all needed settings are shown on the picture. The problem is that quality of shadow on the tree is much much better than of shadow on the ground. Do you have any guesses why?
I just made this one tree bigger than others so that it's easy to see the problem...
(shadow quality is set as the highest, rendering path is Deffered lightning)
Reducing the size of the ground object solved the issue.
The likely reason this works is that texel budget per object is limited by the lightmap size regardless of user-defined texels per unit. For example, if lightmaps are 2048x2048 and the ground is 2x2 km, there is ~1 pixel per square meter, assuming 1 unit is 1 meter.
Although it was not the case here, inconsistencies between shadows may be observed when dynamic and static shadows use inconsistent resolutions.