Search Unity

SOLVED - Need advice on creating better planet orbit lines

Discussion in 'General Graphics' started by Stankiem, Mar 21, 2017.

  1. Stankiem

    Stankiem

    Joined:
    Dec 4, 2013
    Posts:
    115
    Here's my predicament. In our game "Interstellar Transport Company" planet orbit lines will be important. However, I cannot figure out a way of making them look decent from any distance / angle. Below is a video of our game in it's current state. At about 12 seconds you can see our orbit lines, at long distances the lines become hard to see and generally look crap. They look ok close up, but if you tilt the camera down they down billboard towards the camera or anything so they don't always look nice.


    The best orbit lines i've seen in any space game is Universe Sandbox:


    All the route lines stay pretty much the same size no matter how far away you are, they look clean, non pixelated etc... How would I get our orbit lines to look like this without causing huge amounts resource overhead?

    Thanks so much guys!
     
  2. brownboot67

    brownboot67

    Joined:
    Jan 5, 2013
    Posts:
    375
    It's pretty easy to draw a circle via shader so it always stays smooth and scale the line width based on camera distance. Again, all inside your shader.
     
  3. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
    PrimalCoder and theANMATOR2b like this.
  4. Stankiem

    Stankiem

    Joined:
    Dec 4, 2013
    Posts:
    115
    I assumed it would need to be a shader that does this, but i've never written one before nor would I have any idea how to write this specifically.. I Suppose now is as good a time as any to learn. Thanks so much for your responses and if there is anything you can point me to that you would recommend for learning shader coding or this particular technique I would appreciate it.
     
  5. tomer20072

    tomer20072

    Joined:
    Dec 8, 2015
    Posts:
    57
    you can try using any of the outline shaders that are on the asset store, that would fix the flat look of it, but you probably wont be able to get that fade out at the end like in the second video..
     
  6. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,348
    Circle shaders are pretty awesome, but they don't work at extreme angles as it's still just a flat quad you're rendering.

    @richardkettlewell 's suggestion of using the "wire AA" technique is a good one, but requires being fairly comfortable with shaders and some careful initial mesh setup. It also requires using MSAA or an image effect AA to get smoothed edges.

    I would suggest you either use Unity's built in line renderer, or the Vectrosity asset. You can use a simple texture with the edges transparent on two sides to get AA. If you use the built in line renderer you'll have to adjust the width of the line manually based on the distance from the camera.
     
  7. Stankiem

    Stankiem

    Joined:
    Dec 4, 2013
    Posts:
    115
    Thanks! I didn't think it would do this, but it absolutely does. Vectrosity allows me to create lines of any weight and keep that weight consistent no matter the distance from the camera. Works great.