Scene Node vibrating if followed by camera
-
Andi.Dascalu
- Posts: 14
- Joined: Wed Sep 21, 2011 6:44 am
Scene Node vibrating if followed by camera
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!
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
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
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
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
What values have you set your far- and near-value to?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
Re: Scene Node vibrating if followed by camera
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
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
very near and very very farRadikalizm wrote: What values have you set your far- and near-value to?
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
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
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
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
Well there's your problemdigijohnny wrote:very near and very very farRadikalizm wrote: What values have you set your far- and near-value to?
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
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
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
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
Re: Scene Node vibrating if followed by camera
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
