Scene Node vibrating if followed by camera

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Andi.Dascalu
Posts: 14
Joined: Wed Sep 21, 2011 6:44 am

Scene Node vibrating if followed by camera

Post by Andi.Dascalu »

Hello,

I have a MeshSceneNode which I move around in my game, followed by a CameraSceneNode from a fixed distance. When so, the mesh vibrates(or jitters, I dont't know how to put it), it does not move smoothly. If I set the camera to be still, the vibration stops.

Anyone encountered this before, is it a bug?

Please help!
Andi.Dascalu
Posts: 14
Joined: Wed Sep 21, 2011 6:44 am

Re: Scene Node vibrating if followed by camera

Post by Andi.Dascalu »

Sorry, my bad, it was actually in my code. I moved the camera before moving the tracked object.
digijohnny
Posts: 63
Joined: Sat Sep 12, 2009 6:08 pm
Contact:

Re: Scene Node vibrating if followed by camera

Post by digijohnny »

I'm having a similar problem with my flight sim, the further I get from the origin the more the scene vibrates. I was writing it off to round off errors , but I'm using a very unique camera lay out, sounds like we have the same problem
Could you elabote Ia bit on you fix, or the cause
If you have a iPod/ iPhone/ iPad I can send you a copy and you can see what I mean
Thanks
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Re: Scene Node vibrating if followed by camera

Post by Radikalizm »

digijohnny wrote:I'm having a similar problem with my flight sim, the further I get from the origin the more the scene vibrates. I was writing it off to round off errors , but I'm using a very unique camera lay out, sounds like we have the same problem
Could you elabote Ia bit on you fix, or the cause
If you have a iPod/ iPhone/ iPad I can send you a copy and you can see what I mean
Thanks
What values have you set your far- and near-value to?
CuteAlien
Admin
Posts: 10051
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Scene Node vibrating if followed by camera

Post by CuteAlien »

One thing that often happens is that people set the position and the target of the camera without doing an updateAbsolutePosition in between. And when TargetAndRotationAreBound is true it will mess up the rotation because it still uses the old position for the calculation then.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
digijohnny
Posts: 63
Joined: Sat Sep 12, 2009 6:08 pm
Contact:

Re: Scene Node vibrating if followed by camera

Post by digijohnny »

Radikalizm wrote: What values have you set your far- and near-value to?
very near and very very far
it's like 0.05 to 4400 * 75

its a flight sim, in cockpit view, this gives me a real world scale of 75 square miles I'm using a single 128x128 mesh for the terrain and sea every thing is fine over sea level to about 8000 ft, but when you get over land, varying terrain , ant altitude it gets very jittery
digijohnny
Posts: 63
Joined: Sat Sep 12, 2009 6:08 pm
Contact:

Re: Scene Node vibrating if followed by camera

Post by digijohnny »

CuteAlien wrote:One thing that often happens is that people set the position and the target of the camera without doing an updateAbsolutePosition in between. And when TargetAndRotationAreBound is true it will mess up the rotation because it still uses the old position for the calculation then.


Thanks for the info , this address another issue I had and could not figure out, but used to my advantage
The result is like having an inertially mounted camera in the cockpit, always lagging a bit, this really gives you the feel of actual flight, and I used the difference in position to calculate g force
Now I can fine tune this bug
digijohnny
Posts: 63
Joined: Sat Sep 12, 2009 6:08 pm
Contact:

Re: Scene Node vibrating if followed by camera

Post by digijohnny »

here..... Free copies you can see what I mean
give those to anyone with an iPod/iPhone/iPad
Redeem at bottom of AppStore home screen

FHM93W9THENJ
Y969HRENKAH6
M6PAF3993WFK
4RMTTHR47A93
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Re: Scene Node vibrating if followed by camera

Post by Radikalizm »

digijohnny wrote:
Radikalizm wrote: What values have you set your far- and near-value to?
very near and very very far
it's like 0.05 to 4400 * 75

its a flight sim, in cockpit view, this gives me a real world scale of 75 square miles I'm using a single 128x128 mesh for the terrain and sea every thing is fine over sea level to about 8000 ft, but when you get over land, varying terrain , ant altitude it gets very jittery
Well there's your problem
A very small near value combined with a very large far value will create noticeable floating-point errors really fast, causing the whole scene to vibrate when you get further from the world origin
Try to scale your world to meters, it works optimally with 3D dev. That means you have a visible range from 5cm, which is extremely tiny IMO for a flight sim, to 330km which is pretty far away if you ask me

Try to increase your near-value somewhat, you'll probably notice a large decrease in vibration
digijohnny
Posts: 63
Joined: Sat Sep 12, 2009 6:08 pm
Contact:

Re: Scene Node vibrating if followed by camera

Post by digijohnny »

problem solved, mostly
what I ended up doing was a two pass render
setting the near to 50 and the far to very far, rendered sky and terrain
then set near very near 0.01 or something and the far much nearer like 75 and render the cockpit
this works much better, at a cost to the frame rate.

but just recently I discovered if I set my sky dome size much smaller, from 20 miles out to say 5 or so the jitter is almost gone.

http://m.youtube.com/#/watch?v=Y2bV103QRiM
Mel
Competition winner
Posts: 2293
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: Scene Node vibrating if followed by camera

Post by Mel »

When i move a camera to follow an object, i do a small trick to allow the motion to be always smooth, and it is not to place the camera target exactly where i want it to go, but half the way, a fixed proportion like 8/2 or 9/1 being the bigger the last position of the camera target, between the new object position and the old camera target position. That way, the transitions are smoother, and the jitters are mostly avoided, while it is able to follow the object, if it doesn't move extremely fast.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Abraxas)
Posts: 227
Joined: Sun Oct 18, 2009 7:24 am

Re: Scene Node vibrating if followed by camera

Post by Abraxas) »

http://irrlicht.sourceforge.net/forum/v ... =9&t=47614

Do you know what a search function is?
Post Reply