Unity's Particle System - shader glitch (mesh vertices reduction) - unity3d

I have a problem on some Android devices with the particle system's rendering (weirdly enough the problem seems occur on devices with higher capabilities). The problem occurs when mesh based particles (Renderer/Renderer Mode/Mesh) are being rendered. It seems like the meshes that are being spewed out and slowly shrunk with time are being reduced ("reverse-tessellated") which results in a nasty visual effect. Does anyone know what might be the cause of this?
UPDATE: One thing that I've noticed is that with time - the longer the gameplay - this problem is getting worse.
UPDATE: What I've tried is to make one particle system bigger (around x5 times) in order to check if it will have any effect on it's rasterization. Normally particles are sized down from 1 to 0 based on their life-time. What I've noticed, after sizing them up, is that the problem does not occur anymore.
UPDATE: Visualisation of the problem:
Properly rendered:
Improperly rendered:

I was able to track the issue down. It turned out to be a problem within a toon shader I wrote while a go. All the things I've noticed are valid but unfortunately it took some time to put me on the right track.
Taken from Unity's documentation
The half and fixed types only become relevant when targeting mobile
GPUs, where these types primarily exist for power (and sometimes
performance) constraints. Keep in mind that you need to test your
shaders on mobile to see whether or not you are running into
precision/numerical issues.
Unfortunately for me, as it cost me quite some time, I've used half3/4 values with POSITION semantics which caused some numerical precision issues on some Android devices (in this case the particles were getting smaller and smaller - size 0 to be exact). As a general rule, from what I've read in Unity's documentation, float3/4 should always be preferred in conjunction with POSITION semantics.

Related

Framerate smoothing in swift SpriteKit?

Currently, I’m trying to create a game in swift’s SpriteKit, and I’m trying to give it a smoother framerate than it has currently. Right now, whenever I, say, press a button, the framerate suddenly jumps to a much lower value, causing the player sprite (whose movement is based on a value multiplied by a deltaTime value) to suddenly jump forward. Is there any way to smooth the framerate such that the changes in framerate aren’t so sudden and drastic?
Code running in the simulator isn't a good test of the graphics performance of a Sprite-Kit (or Scene Kit) application.
This is because SK will, in order to perform certain graphics effects, utilise calls to the specific graphics hardware available in an iOS device whereas in the simulator, these calls will need to be emulated in software by the host machine, causing a reduction in graphics performance (some operations will be affected a lot, other less so), even if the underlying graphics card in the host machine is nominally more powerful that the one in the iOS device.
Simulator testing is good for testing functionality, and it can give an indication of performance. For example, an application that was running OK in the simulator suddenly starts performing poorly after a change. Checking the displayed 'draw count' shows that the number of 'draws' required to render the scene has increased, possibly causing the slowdown. Or conversely, a change may lead to an increase in performance and a reduction in draw count.
However, the only way to be sure is to test the application of a real device.

Unity on Xbox One - Camera/Rigidbody Visual Movement Hiccup

This is posted here since this is Xbox specific, but I am also posting this onto the Unity forums.
When testing my Unity game on Xbox One I am getting a very large amount of visual "jitter" from the ball. This is a skeeball game where you control the movement of the ball. Essentially the core of the movement is similar to the Rollerball tutorials. On PC this works fine and there are no perceptible jitters. However, on Xbox, I am seeing this a lot more. The object is travelling large distances with the camera following smoothly behind. None of the other objects or scenery are affected, I actually think the camera itself is moving perfectly. But, the ball itself seems to glitch.
Changing my camera movement to LateUpdate seemed to minimize it the most on the PC, but that doesn't make sense to me since I am still not convinced the camera is the problem.
Any help would be greatly appreciated. Perhaps a quality setting isn't placing nice with the Xbox?
Thanks!
Nick
Keep in mind the clock speed of the CPU on the Xbox is likely much slower than your PC (although there are more cores).
Unity is primarily single threaded, so that could explain the performance difference. Here are some things you can try:
* Make sure you are running the "Master" build on Xbox. The default is "Debug" which is significantly slower.
* It's possible it's something with the physics.
Once you've checked to make sure you aren't running Debug, the next step would be to use the Unity profiler to see where your frame time is being spent, then depending on what the cause is optimize that part.
Here is more information on the system resources:
https://learn.microsoft.com/en-us/windows/uwp/xbox-apps/system-resource-allocation
There is also a great post about the graphics debugger here:
https://tarhik.wordpress.com/2017/09/04/antimatter-instance-dev-log-entry-2-using-microsofts-graphic-debugger/
It looks like switching the RigidBody to use "Extrapolate" instead of "Interpolate" fixed the issue I was seeing. I am not sure if this works for every situation, but for the scale of the levels and the player physics of my game this seemed to do the trick.

daydream app crashes on quick head rotation

My daydream app is working fine when used slowly. But when I rotate my head too quick it starts giving glitches first and then the app gets crashed. I am guessing it has to do something with frames/sec loaded during high quality objects rendering or something similar. If someone has a solution, please help me out.
Assuming you have no errors in logcat, visual glitches are generally indicative of extremely high per frame GPU load.
It would be good to profile your app and share the crash report - but the only way I've ever been able to actually crash an app this way is with very large textures.
Check the size and number of textures in your scene - it's possible rapid head rotation could be causing a large number of textures to need to be loaded as objects become visible. You can also see a good list of how large the assets are at build time in Unity by inspecting the editor log after a build. This can help make sure you aren't running out of RAM on device.
Make sure you have texture compression and mipmaps enabled on all textures. Disabling mip-maps on minified textures can easily overload the GPU.
Make sure you don't have too much transparency. Adding a lot of overdraw to the scene can overload the GPU.
Follow performance optimization guidelines https://docs.unity3d.com/Manual/OptimizingGraphicsPerformance.html
https://unity3d.com/learn/tutorials/topics/virtual-reality/optimisation-vr-unity
Make sure renderViewportScale is around 0.7, MSAA is at 2x or less, and you aren't using post-process effects, shadows, or any kind of deferred rendering
Stay below 100 draw calls, 200k vertices on screen.

Best Practice to Increase Frame Per Second for my daydream VR application [duplicate]

I have been building a game for VR using Unity3d. It has only low poly models and the file size is less then 40 mb still the game lags when played on mobile.. Please suggest how to improve the performance..
Thank you in advance..
In order to improve performance in VR for mobile you have to optimize everything as best as you can, you should keep some of these variables in mind:
Graphics Side
- Number of polygons in the scene
- How many source of lighting do you have
Programming Side
- How much work is taking your code, is doing it efficiently?
The programming part can include problems within the physics system, also some logic problems that can probably decrease the overall performance because of higher computation.
My advice is to learn about the Profiler that unity offers, actually you can observe how much work is taking your code and where exactly it is your bottle-neck. This video also can be useful.
Of course a solution could be implement your code following design standards, like design patterns and software architecture (depending on the size of the project).
I hope it can be useful for you!
What I found from developing and launching a vr game is some of the issues below
Number of polygons is usually your first to check even though your models are low poly. For example, I looked at Synty models in the unity store and some of them were over 1k for a bag and 7k for a character model. This seriously reduce the amount of objects you can if you want to target a max of 50000 per eyes.
With some models, you can use blender and the decimate tool to reduce the polygon count pretty easily. From there I would use LOD's to reduce their count further based on distance.
Use occlusion culling (pro version only)
Set your camera distance to maybe a 100 instead of the default
Use mobile shaders and careful using some of the standard shaders as they are expensive. Also transparent shaders will becomes expensive cause overdraw.
Batch your textures and make them static if possible
Don't use dynamic shadows on lighting but instead bake your lights
Try to avoid using physics as this becomes expensive and instead raycast to trigger events or shooting weapons.
Run profiler often and check for any bottlenecks (pro version only)
Reduce the count of Particles effects and their values
Character bones can also cause issue so remove as many as possible
There is also your code to look at as mentioned by Manujamming
Set quality setting to low in the inspector to gain best performance.
Could you provide a screenshot of your game scene?
I hope this makes sense.
Best of luck!

Unity3D vibrating and choppy scroll (with live demo + WebGL compared)

Something must wrong here either with me or my monitor or GPU. Others also suffer from this phenomena see the links.
Now I would like to emphasize this problem is exist, being optimist I think there is some solution. Maybe it is only noticeable in special circumstances, and definitely not a performance (or GC) problem. If it would noticeable in all circumstances Unity3D would be useless...
My goal to use this wider forum to specify this problem is my hope the wider community may have wider scope to search the root of the problem. I think it is not algorithm or Time class usage related. Maybe the Time.deltaTime itself has bugs or mislead in some circumstances.
Just a feedback if anyone can reproduce the vibrating effect or not may have diagnostic value. (it seems to be oscillating in horizontal, the left and right edges are very blurry.)
Marrt created a web demo for Unity to demonstrate the effect:
http://marrt.elementfx.com/SmoothMovementTest.html
Whatever I do this demo is so vibrating + choppy. NOTE: All my self created simple scroll projects running in editor or standalone desktop are also exhibits the same, so it is not about 'how to use Time.deltaTime'
I thought the problem is in my hardware until today I saw this WebGL demo (use Chrome):
http://webglsamples.googlecode.com/hg/aquarium/aquarium.html
It is so smooth (any fish movement, also the rotating also the light fades) I mean smoooth. Why I can not produce (no one produce) this with Unity (at least in my machine)?
If anyone interested there is an exact proble description here, but no all answers solve the problem.
The problem in details:
http://answers.unity3d.com/questions/275016/updatefixedupdate-motion-stutter-not-another-novic.html
I tried all the things including the programming variations + quality setting (VSync etc)
My very simple self created projects are running 1000 - 2000 fps and still vibrating + choppy.
I spent 2 days to get the rid of this poor visual experience. Did all the programming thing what mentioned in the linked threads + tried to configure my video card (btw Radeon 6770 with 1Gigs)
Any thoughts?