Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Erkki

storing bezier curves

This topic is 5522 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m making a simple 2D game that has roads made of beziers and lines. Also polys, lines and beziers are used for some other terrain. I have two options for how to store the beziers: 1) Only use Bezier curves (defined by 4 control points) in the editor. For the game, store them as calculated points. + needs less processing power - needs more memory and takes up more disk space 2) Store Bezier curves by the 4 control points. Calculate the points in real time. - needs more processing power + needs less memory and takes up less disk space + easy to implement a level of detail system (it''s needed in some places -- the beziers are not only used in the main game view but also map view and pathfinding) What do you think is best? Or maybe a combination of the two?

Share this post


Link to post
Share on other sites
Advertisement
Bezier curves are nice, but you might want to look into Hermite curves instead - they tend to be more intuitive (so good for use in the editor) and you can force the curve to be continuous.

How about:
-> Store curves as control points
-> Tessalate curve into points when in/near view.
-> Cache tessalation results, discard when non-visible or far from camera.

Share this post


Link to post
Share on other sites
How are the Hermites more intuitive? I tried and they don''t seem to be as flexible. And somewhy the first control point doesn''t seem to change the starting curve a lot.

I also tried catmull-roms but my code only allowed 4 points currently so I didn''t get to see if they would bend nicer with more points.

One of the most intuitive curves I''ve found on the net seems to be a collection of 4-point beziers with the control points hidden (so that the curve went through all the points that were visible) and with collinear tangents at the joints. I didn''t look into the formula of how they found the control points yet. Moving one point has mostly a local effect.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!