Camera jerking : More prominent for devices with greater display

Hi Everyone,

I was facing weird problem in unity. I was trying to achieve parallax using UV scrolling by setting texture offset.
But the camera is jerking in most devices in bigger displays, the jerk is there in smaller devices also but not noticeable.

Initially I thought it is performance(memory) issue, so created a new project with one texture having UV scrolling even in that jerk appears.
I’m pasting the code that I used to do UV scrolling here FYI,
I tried following code in Late Update , Normal Update and Fixed Update the jerk still there.

float xOffSet = ParallaxSpeed.x * Time.deltaTime ;

ParallaxOffset += ParallaxSpeed * Time.deltaTime ;
ParallaxOffset.x = ParallaxOffset.x % 1 ;
ParallaxOffset.y = ParallaxOffset.y % 1 ;

renderer.sharedMaterial.mainTextureOffset = ParralaxOffset ;

The texture is 512x512 png image, so there is no question of non-power of two image.

Any help to resolve this issue?

Regards
Lova Rajesh

Nobody is there to discuss this issue?

I probably can’t offer much help, but I am thinking your game must be a “pixel perfect” 2d only game (not 3d models, just 2d stuff right?)

Well if so, then your problem might be related to how pixels will jerk when moving the camera quickly any direction when trying to do pixel perfect stuff… maybe… (I think it is especially visible on low-res games)

and if so, then I think a solution might be to try to only allow your camera to move to and from places where its perfectly “pixel aligned”, like if your pixels are 1 unit tall and wide, and your screen is lets say, 1024 x 768, then your camera should only move 1 unit at a time in any direction, as to keep pixels aligned properly… I think there was a thread recently where someone was having a similar issue on a 2D game, but I am not sure they ever found their solution though.

Or maybe, after looking over your code, it could be that you need to move that texture offset only in 1 pixel increments, which you could round as an integer whatever ParralaxOffset is set to, and see if it helps.

Or I may have completely misunderstood your question, if so I hope you find what your looking for!

If you have a script that is on the camera that controls it. Have it run in OnPreRender. This should get rid of any jerkyness.

Thanks for the reply.

If you see the code above I’m using ParralaxOffset variable to set Texture offset(value varies from 0 to 1).

Thanks for your reply.

I have tried OnPreRender also and the effect is same.

Tried with new version of Unity 4.5, still it jerks not sure what was the issue