Camera sporadically jerky on vehicles
under review
Huns Valen
I spent days trying to find the bug in my flight physics code that was causing this, only to discover that it was the viewer camera all along. The problem is that sometimes the aircraft flies "visually" smoothly at any speed up to 100 meters/sec; and other times it's visibly jerky, appearing to "vibrate" (change in apparent size many times/sec) as though the camera was acting like a spring instead of being fixed in place behind the vehicle.
I'm using the eye/offset calls:
llSetCameraEyeOffset(eye);
llSetCameraAtOffset(offset);
This is because the "newer" (21 years old instead of 23) follow cam is missing features that would be necessary to produce the same behavior, and I find it unsatisfying and confusing to use for aircraft.
I instrumented my vehicle with code that captures llGetVel() and llGetOmega() 20 times/sec (rotated into the local reference frame), then uses llSetText() to display mean, standard deviation, and range once per second. What I discovered:
- Sigma (standard deviation) for local X can be very low (0.0 to 0.02) in level, unaccelerated flight regardless of whether the visual apperance is jerky or not. There is no difference.
- When it's visually smooth, sigma can actually be quite a lot higher, closer to 1, and it still looks totally smooth. This happens during accelerating and turning.
- Local Y's sigma is typically very close to 0 in either case.
- Local Z's sigma is typically very close to 0 in either case.
- All three axes of llGetOmega() are always zero unless the aircraft is turning, climbing, descending, or yawing.
If the statistical analysis is not enough of a smoking gun, here's another:
- When the aircraft is flying smooth, and I refocus the camera on my avatar, it starts getting jerky, like the camera is damping at some wild speed. Single-frame jumps of tens to hundreds of pixels along the axis of motion.
The attached screenshot is the llSetText() stats output when the camera was jerky. Zero standard deviation in this regime + jerky visuals, vs. standard deviation WAY higher during maneuvers when the camera is smooth, provides strong evidence that this is a viewer bug.
My code is invariant either way. My stats are invariant either way. When flying smoothly, refocusing the camera makes it do the jerky rendering thing. And sometimes it does the jerky rendering thing whether I do that or not.
Photo Viewer
View photos in a modal
Log In
Dan Linden
marked this post as
under review
Dan Linden
marked this post as
needs info
Dan Linden
marked this post as
under review
Dan Linden
Hi Huns,
I'm curious, does enabling Advanced menu > Disable Camera Constraints have any effect on this bug?
Please tell me how to get a copy of the test content, and what steps I should take to see the bug for myself.
Huns Valen
Dan Linden Thanks for looking into this.
I tried it with disable camera constraints on and off several times with a relog in between. It doesn't seem to make a difference. When I initially re-enabled camera constraints it seemed even more rubber-bandy, but I couldn't replicate that so I don't think there is a strong correlation. It seems pretty random.
I've sent a copy of the aircraft w/ the stats display enabled, and a HUD to use with it.
Huns Valen
Dan Linden Oh, you asked for the repro too, sorry...
Just fly it around, doesn't have to be fast. The effect is visible at low speed. If you're flying and you see it rubber-banding, there you go. If you don't see it rubber-banding, focus your camera on the avatar. If you zoom in you'll see sharp single-frame oscillations in the direction of flight. Hit escape to go back to the default sit camera and you'll see the avatar/vehicle continuing the oscillations.
In other words, even if it initially seems smooth, refocusing on the avatar will cause it to go haywire.
Huns Valen
Dan Linden One more funny thing I noticed. If it's rubber-banding and I focus the avatar, and then hit Escape (so it goes back to the sit cam), it may STOP rubber-banding.
Dan Linden
Huns Valen: Digging through scripts will take some time. If you had to speculate, what would be the most simple object + script required to reproduce this bug?
Huns Valen
Dan Linden I'll send you a much simpler airplane with 3 scripts, from pre-Mono days.