camera following bezier curves

Started by
7 comments, last by thedustbustr 20 years, 8 months ago
I want to have my camera follow curves in scripted sequences. Currently, I''m using peicewize Bezier4 curves. I evenly increment mu (the distance between 0 and 1) like so:
mu += clock.DeltaTime / curveTime 
where curveTime is the amount of time to spend on this curve. I calculate mu each frame then calculate a point on the curve from mu. This causes the camera to start at rest (0 velocity) accelerate then decelerate to rest again for each set of four control points. I''ve looked into another curve generating formula (b-splines) but they seem to have the same problem. I read in Game Programming Gems that you can calculate the curve data for each set of curve points and save it to an array and then calculate the distance between each saved point, but this limits the resolution of the curve if you have a fast enough computer. Is there an alternative workaround to this solution? Maybe there is a problem with my code, I can post it if necessary. While I''m at it, how do you guys update the view vector relative to the position vector change? Thanks! Dustin
Advertisement
Nurbs are popular to get smooth camera movements.
If you connect a series of Bezier curves you will get problems cause the tangent vectors at the end of one curve and at the start of the next curve will only have the same direction and not the same length.

/__fold
If you want to have the camera face along the splines path, you could get the position of the camera at the NEXT clock tick(or the previous clock tick.. it should be a trivial decision, depending on the value of delta mu), and the correct camera vector would be the vector created from the current position of the camera, and the next position.

A cheap little hack, and I don''t know how well it would look on low resolution curves....

/__fold is right about the normals though.. Creating a Nurbs evaluator is probably just a matter of spending a few minutes with google anyways.

-=|Mr.Oreo|=-
Code Monkey, Serpent Engine
-=|Mr.Oreo|=-Code Monkey, Serpent Engine
for nurbs search for a library "nurbs++".
3D Side-Scroller game demo Project-X2 "playable"Lashkar: A 3D Game & Simulation Project demo @ lashkar.berlios.de
A nice idea might be to use two paths. One for the camera position, one for the camara to look at. Might give you a little more creative freedom.
How do I set my laser printer on stun?
I recently implemented a curve-following camera system, and hit the same problem with bezier curves. B-Splines gave me the nice smooth movement I was looking for.
I''ve also built a pathed camera system and I had a lot of luck with Catmull Rom splines. They are mathematically equivalent to bezier curves, but they pass through all their control points. The good news is that you string a long sequence of them together and it behaves like you''d expect without you having to (for bezier curves) make sure your derivative control points line up at the endpoints of each segment.

So, very simple to use with good results (C1 continuity, curvature is interpolated between endpoints, so it''s not C2).
Gems book 1 says that catmull-rom splines are much uglier than bsplines - what is your take on this? Does the camera feel smooth?
"Much uglier" is very subjective. Math says that B-Splines are smoother (having C2 continuity) true, but the problem is that they don''t interpolate any of their control points. This is no problem if you have a nice graphical tool that well let you plop down control points and tweak them until you get the curve you want. However, my system also needed to generate curves in real-time so B-Splines were not an option.

In truth, I found that curve smoothness is not as significant an aesthetic factor as the acceleration/deceleration equations that affect camera motion.

This topic is closed to new replies.

Advertisement