Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by HammerBG · Nov 22, 2013 at 04:27 PM · linecirclevectrosityellipse

Lines or curves for a smooth circle in Vectrosity

Hello,

I am wondering what approach for drawing circles would produce the best looking, smooth circles/orbits in Vectrosity? Pretty much similar to the smoothness of the orbits in Kerbal Space Program.

I am currently using multiple line segments (2500) to display a circle, but it seems a bit ... edgy and not looking good when zooming in and out with the camera (3d camera with changing the Z coordinates for zoom in/out, drawing with Draw3dAuto()).

Would it be better if i used multiple curves to draw a circle, would it be smoother and finally would it be more efficient?

I guess my questions is more directed towards Eric, but if anyone else is interested in providing an answer, that would be great :)

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
4

Answer by HarvesteR · Jan 29, 2014 at 10:30 PM

The orbits in KSP are drawn as Vectrosity Splines. We take a fixed number of samples from the orbit code, and let the spline interpolate the segments in between.

This works nicely for us, since querying the orbit maths for sample points is much more expensive than interpolating the spline, so we try to keep the number of samples down as much as we can (as low as we can get them without the spline becoming distorted), and the number of subdivisions just high enough to make it look smooth.

Mind though, it's not just about the number of samples, it's about distribution. The more evenly spaced your sample points are, the better the spline will be able to draw smoothly across them.

Also keep in mind that even then, the spline drawing for orbits is one of the most performance intensive operations in KSP, it is a lot of maths, so we do what we can to keep the number of splines on screen as low as possible.

Cheers

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image HammerBG · Jan 30, 2014 at 03:22 AM 0
Share

Thank you for your reply, Harvester.

I will have quite a lot of orbits (for now its 1 for each spacial body on a solar system, and 1 for the solar system itself). Which makes around ~6 orbits per system, for an average of 100 systems in a game = ~600orbits. I am trying to reduce the visible ones according to the zoom level. At zoomed out level X i remove the spacial bodies orbits and leave only the system orbit.

$$anonymous$$y question after this rambling is do you think this approach would be performance viable and do you have any suggestions on what i can do to optimize around the orbits?

avatar image
0

Answer by Eric5h5 · Nov 23, 2013 at 07:22 PM

The more segments, the smoother it will be. You could switch between different circles at different zoom levels, with higher zooms having more segments.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Eric5h5 · Nov 23, 2013 at 07:24 PM 0
Share

According to this, $$anonymous$$erbal Space Program uses Vectrosity.

avatar image HammerBG · Nov 23, 2013 at 10:25 PM 0
Share

Yes, exactly why i knew i was doing something wrong, when my circles were scaling badly :) Obviously im still pretty new to the vectrosity library (just started using it a day or two ago), but its definitely a very powerful tool.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

18 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Vectrosity : Adding more anchor and control points 0 Answers

How do I go about animating a drawing line by using vectrosity? 1 Answer

3D ellipse with Vectrosity 1 Answer

Vectrosity Line, how to draw centered, left or right of the path ? 1 Answer

Drawing a Range Icon in 3D Space 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges