• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by terdos · Jun 13, 2011 at 02:42 PM · frameratejitter

Fluxuations in framerate and non-uniform translation and UVscrolling

We are attempting to build simple multiplatform 2d games but have noticed that the animation within unity is not as smooth as we would like. When compiled to either a stand alone executable or webplayer we have noticed pauses and skips in object translation and UV scrolling. We have tested this on a number of windows and mac machines and so far only one of the machines has consistantly performed well.

As a test I have built a simple project in an attempt to reduce the number of variables in the problem. The project only consists of a plane with a texture that is animated by UV scrolling. This example is at it's core just one line of code in update:

  material.mainTextureOffset += velocity * Time.deltaTime;

where material is cached version of this.renderer.material and velocity is a public variable. I have included a link to the project if you would like to take a look.

http://dl.dropbox.com/u/22825039/SimpleUV.zip

I have poked around and have noticed that the deltaTime between frames varies wildly. I wrote a script to investigate this (not included) and found that I was getting the occasional blip that was nearly 3 or 4 times the average. The windows machine usually maintained a deltaTime between 0.045s and 0.005. On the mac the results were more interesting and puzzling as the deltaTime fluctuated constantly between 0.016s and 0.017s with only an occasional spike.

just a few more notes:

  • fullscreen appears to run slightly better

  • webplayer is by far the worse

  • Vsync has little or no affect

  • TargetFramerate has little or no affect

  • remove the plane and UV scrolling and the deltaTime still fluxuates

  • profiler has the occsional spike in other

so, ultimately my question is this: what is going on? Is unity3d this unstable?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by aldonaletto · Jun 13, 2011 at 03:09 PM

At least the UV scrolling problem can be explained: setting the offset to huge values gives unexpected results. You can solve this by "moduloing" the offset between 0 and 1 (see similar question on http://answers.unity3d.com/questions/128886/maintextureoffset-settextureoffset-with-big-value.html). The fps rate usually fluctuates somewhat, because frames are just rendered one after other, without any attempt to keep some pre-defined fps. In a game I'm currently developing, the frame rate depends mainly on how many objects are in the camera's view angle (or frustum, to be more precise), even when they are obscured by mountains, buildings etc. You can have an idea of what is being drawn clicking the Stats button in the Game view. My game runs at 16 fps most of time, but when my Windows notebook decides to do some God-knows-what internal task, the fps rate falls to 5 until this damned task ends. Another big CPU cycle thief is the physics engine: if you have a lot of active rigidbodies in your game, they may consume a high slice of your CPU time. Since it's done in a different pace, you may have a "beating" effect which will make FPS fluctuate at a slower rate.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image terdos · Jun 13, 2011 at 04:00 PM 0
Share

Thanks for the reply. We have experimented with the offset of the uv scroller, we have found no change in what we are experiencing. However in principle you are correct, the larger the number, the larger the error that will accumulate.

I do realize the framerate should fluctuate, we are not in control and unity just loops forever rendering frame after frame. but we are getting wild fluctuations on virtually every machine we test on. I am talking fluctuations between 900fps and 20fps. As I mentioned above we have just a uv scroller, no physics, no 3d rendering other than the plane. If we remove the plane from the scene so that we only have a camera we still see these fluctuations.

However that all being said. This is something we may have to live with. :)

avatar image Graham-Dunnett ♦♦ · Jun 13, 2011 at 04:48 PM 0
Share

$$anonymous$$ight sound counter intuitive, but in a web player Unity is expecting to render between 50-60fps. When you starting hitting the webplayer with 900 frames per second it's going to spend all it's time copying the framebuffer into the web browser. Your example shows this as chronic $$anonymous$$ring - your texture is geared up to reveal this, right? (Vertical stripes). I suspect if you add more stuff for Unity to render, and get the frame rate down to something browser friendly you'll find a sweet spot. (And yes, the browser or the OS going off and doing housekeeping is just a part of life.)

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Jitter Every 5 to 7 seconds on Android Builds 1 Answer

How can I prevent Input.GetAxis from sporadically reporting deltas of 0.0? 0 Answers

General Ways to Optimize Frame Rate? 7 Answers

Mouse to control animations 0 Answers

iOS VSync always active? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges