Does realtime light or baked light consume more ram? - c#

I want to improve the performance of my game. I've done many things and there have been drastic changes in performance. I also want to change the light. but I don't know which light is more performance friendly.

It really depends on what type of lighting you are trying to do.
Baked lighting is stored in textures, so require a bit of ram, but it is fairly cheap to render, and allow for very complex light, as long as it is all static.
A single omni directional non-shadow casting light would not require any extra memory, just a fairly simple light calculation in the shader, so would be very cheap. But once you add more lights, shadows, global illumination etc, the cost goes up drastically, and you would typically need to apply various optimizations to get decent performance.This is just general recommendations that is non unity specific.
In unity you should have various settings for the lights that affect the quality of the lighting and performance. If you do not know where to start I would suggest starting with baked light, and adding realtime lights where needed, and be careful with things like realtime global illumination since that is a really difficult problem to solve.

Related

Unity's Universal Render Pipeline performance problem? (2D)

I never got real answer for this. I open this new empty project (total blank but with one GameObject)
I ended up getting 2500FPS, alright? Makes sense. The moment I install URP and then you know place in the graphics asset. BAM 1100FPS. What's going on? I put lights, well FPS keeps on decreasing. Wasn't this supposed to be better than the normal standard pipeline? If I can't do this, what are the other ways to make these optimized lights? What can I do for it?
P.S. I have been using since LWRP and then recently changed to URP. It's been at least a year, I feel like I cannot make my own game using these lights and I don't know what to do with it. This is the performance loss after just installing it, think when you have to add logic? Well, that is bad. Do I look for certain settings for this?
If your game is running above 60FPS you are OK. you do not have to worry about performance at this stage. Add assets according to your game design, tweak your scene with lights, Unity offers my tools than can improve the performance of the game. But I suggest you do profiling after you build something concrete.
You shouldn't really look at frame-rate for profiling, you need to look at the time per frame not the FPS count. Remember that the FPS is logarithmic, not linear. 2,500 FPS is a frame render of 0.4ms where 1,100 FPS is 0.9ms. The difference in this time is so small that it's almost not worth comparing. Also, target should be 60 - 144 FPS (depending on screen refresh-rate) which is a frame-time of 16.67ms - 6.9ms.
Also you need to remember that URP is forward-rendered which means the cost of each light in the scene goes up dramatically vs in Deferred in Standard.

Unity: most efficient way to have vegetation/field of grass (mobile performance)?

Ok, I know the easiest way to make (pretty high poly) grass in Unity 3d is just randomly spawn some grass prefabs across an area - I need my grass/vegetation to grow like this: https://dribbble.com/shots/4726918-Time-lapse-Air-Plant
But, with lots of polys and, as this was created using an armature (bones drag on performance as well), I need to find the MOST EFFICIENT way to make a forest of growing vegetation without lowering the FPS. I'm targeting iOS/Android, and already seeing low FPS on high poly count models.
Keeping in mind that each blade/vegetation needs to animate to grow (ideally these would all be randomly varied somehow) - what is best for mobile performance? Would spawning randomly even with each model having an armature not cause a problem?
What's the common route here?

Unity3D large maps advice - How big is too big?

Using the Unity3D engine. I'm making a multiplayer game for fun, using Unity's standard networking. If servers hold 25-50 players, what map size is recommended? How big can I make a very detailed map before it is too big for effective gameplay? How do I optimize a large map? Any ideas and advice would be great, I just want to learn and could not find anything about this on google :D
*My map is sliced into different parts.
The size of the map itself, in units, doesn't matter for performance at all. Just keep in mind that Unity (as any other game engine) uses floats for geometry, and when the float values get too high or too low, things can get funny.
What matters is the amount of data that your logic, networking and rendering engine have to churn through. These are different things, even logic/networking data, and limits on those greatly depend on architecture of your game.
Lets' talk about networking. There, two parameters are critical as your limits: bandwidth and latency. Bandwidth is how much data can you transfer, and latency is how fast. Ok, this explanation is confusing. Imagine a truck full of HDDs travelling from one city to another: it has gigantic bandwidth, and you can transfer entire data centers this way. But the latency, time for the signal to travel, is a few hours. On the other hand, two different people from these cities can hop on air balloons, look at each other in the night sky and turn their flashlights on and off. This way, they'll be able to exchange just one bit of information, but with the lowest possible latency: you can't get faster than light.
It also depends on how your networking works. RTS games, for example, often use lock-step multiplayer architecture can operate on thousands of units, but will only exchange a limited amount of data between users: their input commands. A first-person shooter, on the other hand, heavily relies on latency (which lock-stepping can damage): 10 ms when you jump and fire a rocket launcher are much more important than when you say your troops to attack. So, the networking logic is organised differently: every player's computer predicts what will happen, but the central server has authority on what actually happened. Of course, what I'm writing right now are just general examples of architectures that can be used; choosing the right way to do the networking is very difficult, but very interesting and creative task.
Now, logic itself. Actually, most of the gameplay logic used in modern games is relatively simple in terms of cpu requirements, unless it's physics or AI. Using physics in a multiplayer game is tricky enough on it's own, because of synchronisation problems (remember floats?); usually, the actual logic that can influence who wins and who loses is pretty simplified: level geometry is completely static, characters move using easy logic without real physical force, and the physics is usually limited just to collision detection. Of course, you see a lot of physical-based visual stuff: ragdolls of killed enemies falling down, rubble from explosion flying up; but these are typically de-synchronised between different computers and can't actually affect the gameplay itself.
And finally, rendering. Here, a lot of different constraints make place. To tell about them all, I would have to describe the whole rendering pipeline of Unity on different devices, and this is clearly out of scope of this question. Thankfully, there's another way! Instead of reasoning about this limit theoretically, just to a practical prototype. Put in different game assets in the scene, run it on target device and look how it performs. Adjust, repeat! These game assets can be completely ugly or irrelevant; however, they have to have the same technical properties as what you're going to use in the real game: number of polygons, sizes of textures, shaders, etc, etc. Let's say, for example, that you want to create a COD-like multiplayer shooter. To come up with your rendering requirements, just put in N environment models with N polygons each, using NxN textures, put in N characters with some skeleton animations with N bones, and also don't forget some fake logic that would emulate CPU-intenstive stuff so your perfomance measuring will be more realistic. Of course, it won't give you a final picture, but it'll be a good way to start, and it's great to do that before you start producing a lot of art assets.
Overall, game perfomance optimisation is a very broad and interesting theme, and it's impossible to give a precise answer to such a question.
You can improved this reducing the clipping plane of your camera to reduce the visible render distance, and too can use LOD improvement making your sliced part with minor details.
Check this link for more detail about LOD:
http://docs.unity3d.com/Manual/class-LODGroup.html
If you need more improvement you can make a script to load terrain in runtime based on a distance arround your player.
First and foremost: Make the gameplay work, optimize it later. Premature optimization is a waste of programmer's time.
Secondly: think of Skyrim and Minecraft. The world is separated into pieces that are loaded in background when you move around. Using that approach (chunking your world into pieces) you can have virtually infinite world size.

WPF Poor Performace for static scenes with very small dynamic content

I have a simple scene with 64 ModelUIElement3D elements, every element3d Model is a model group with 8 simple geometries, every geometry contains 3 materials, diffuse, specular and emissive.
All materials use Solid Brushes since are the fastest.
The geometries, specular material and diffuse material are Freeze to improve performance.
The only thing not freeze are the emissive materials which I’ll be updating the brush with solid brushes periodically.
When I run the application and change the brush for only one emissive material from the 1536 materials in the screen (64*8*3) the performance goes down really really bad, and the FPS go down from 60 to 15FPS.
Even I have the solid brushes in a dictionary so they are cached and created once.
This change in the brush is to make the material “blink” (really it is a fast fade-in/fade-out) in the screen. The brush change in the emissive material is every 20ms.
I see changing the brush for one material or 500 materials doesn’t make any the difference in the performance.
I comment the line where I update the brush and I get a consistent 60FPS, when I uncomment the line the FPS goes down to +/-15FPS, tried 3 different machines, 4 cores/2 Cores, very good graphic cards or medium, almost doesn't make a difference, always between 15-25 FPS.
I’m using “Performance Profiling Tool for Windows Presentation Foundation” to measure the performance, and HW IRTs per frame doesn’t go above 1 at any moment. I see when I check the checkbox “dirty-region update” that the whole scene is render every 20ms just changing the brush for one small material.
I read that WPF viewport3d doesn’t support dirty region, so I’m assuming that the whole scene is render for a minimum change.
If that is the case, is there something I can do to improve that? Since I need to create an static scene with several thousand UIElements and 10 thousands materials, but the changes are going to be so minimal so I was expecting a good performance.
If the WHOLE scene is rendered every time without chance to do anything then it is useless think on WPF to create dynamic content and I have to go for another much more complex approach as DirectX.
Please any hint how to make this work is appreciated, since I can't believe it is not possible with WPF and is some mistake on my part.
Basically I need a big scene with minimal changes, those changes happen frequently in the order of 5 to 20ms and still get the 60FPS since there are few triangles material that really change.
Thanks,
Gustavo.
I cannot give a direct solution to your question. But here's some clue:
1536 materials seems too much for the simple business charting oriented WPF 3D. It is even necessary to carefully optimize if you used low-level API like Direct3D, because down into the graphics driver architecture it will hit the batching bottle-neck, especially for DirectX 9 level driver interface.
To get best performance, the only solution is to optimize case by case with low-level graphics API, with the knowledge of graphics hardware quirks. But for a high-level general purpose 3D API, it is simply not realistic to optimize for every case. It has make some assumption, e.g. the common usage should be navigating a static scene. So that it can optimize and cache the optimized command queue to get best performance. But if the scene is changed, the cache will be invalidate and thus need to re-build and re-optimize. So it is not the size of the viewport that caused FPS drop, but the optimization.
Usually, there's hinting mechanism, by which you tell it which sub-scene-graph changes while which is static, so that to help the underlying optimization. But it is only a hint. There are many cases which make it not viable to honor the hint. And it is hard to tell the cause because the internals are encapsulated.

Design effects in WPF (tricks to enhance app's appearance)

I have developed an application that must be presented on exhibition as advertising. I want it to look more sexy! What tricks do you know that enhance the appearance of your applications?
What are the best design effects the developer can use for its application? I am speaking about: glowing, shadows, maybe forms of buttons, beautiful animation of splash screens and so on.
What is YOUR favourite effect?
If you have no feeling for what looks good, then don't try magic tricks like glowing shadows or sparky gradients, it will only look like some awkward app from the late 90s. Like Chris said, effects can ruin an application as quickly as it can make one.
There is no silver bullet for good design, the best tip for someone totally lost is: Less is more. Especially when it comes to colors, avoid using many different colors.
Look on other good looking apps (Photoshop CS4, Adobe Reader 9, OSX Preview, etc etc) they are actually really clean.
If you really want to use some wpf-powers an easy trick is opacity transitions, just keep all animations short (max 0.2 seconds). And for moving animations make sure to use acceleration and deceleration, otherwise the animation will look really weird.
In terms of enhancing your app, here are some things I personally like:
Dropshadow ... Creates the effect of depth on your application, ensure a global lighting direction otherwise, it is difficult to maintain a good general effect.
Scaling ... When transitioning from one state to another, the use of scaling draws attention to the control/screen
Easing ... Whenever there is movement in the screen, the movement should be eased from start to finish.
Shine ... For rollovers, I like a subtle shine to a control, this can be achieved by moving a subtle gradient across the control.
These are just a few effects ... I think it's import to note that effects can ruin an app as quickly as it can make one, so you want to make sure that the effects you use compliment your application.
From a UX perspective, my advice is that any interaction from the user should be exaggerated. For example, rollover effects, highlighting click interactions, etc.
So in conclusion:
Use effects to highlight user interaction
Ensure that effects are used in appropriate places
Keep the effects subtle
Avoid excessive use of effects
Hope that helps!
I found the following examples:
Vista Buttons:
Innerglows:
Glass Buttons:
The only one I really use for the moment is the Bitmap DropShadow and I do not use it that much just a little shadow. The example below is too much for me. I would reduce the ShadowDepth and the opacity.
(source: microsoft.com)
But the trick is too not use them too much and to use them with consistence. Do not change your effect style over and over all around your application. Otherwise, it will be hard to take it seriously.
I prefer my effects to be subtle. Some nice, quick, smooth fade in/fade out/glow effects can add a lot of style. If you're going to do bigger animation style effects, splined animations (rather than linear) usually look a little nicer.
Don't over-do it though. If you add too much, your application is going to become frustrating to the users that just want to get the task done.
Specific effects should be taylored to match the concept of the site. Care should be taken that effects do not get in the way of use, and do not have an overkill such that they have a significant impact on performance.
Try to give your visitors something, rather than hitting them with something.
Tasteful subtle effects can often be more dramatic than glaring bursts of over activity.
A site for an attorney for instance should be clear and more bland than one for say a games site which can get quite expressive and still be acceptable.
On color:
The correct mix of color will go a long way to improve appearance with minimal negative impact on use, just use care in different shades of a color group. Try not to have a tan wording on top of a different shade of light brown background for instance, it might degrade the ability to read the text.
I would try to stay away from a mix of colors from opposite sides of the color wheel or a mix of cool and warm colors on the same page.
Personally, I would reserve the neon colors for entertainment related things or where the time you expect visitors to stay is limited.
Often when you are trying to advertise a product or service, less is more.

Categories

Resources