MOARdV / AvionicsSystems

MOARdV's Avionics Systems for Kerbal Space Program - a new generation of IVA enhancement.
Other
53 stars 26 forks source link

ORBIT_DISPLAY #102

Open MOARdV opened 6 years ago

MOARdV commented 6 years ago

Schematic rendering like the JSIOrbitDisplay, just using line renderers instead of inefficient GL calls.

Options:

Filled planet instead of a circle (make it easier to understand which line is orbit, which is planet. Same for atmosphere.

Components, Phase 1:

Components, Phase 2:

theonegalen commented 6 years ago

Different colors for the filled planet depending on which planet we're orbiting?

MOARdV commented 6 years ago

Different colors for the filled planet depending on which planet we're orbiting?

Yes. And maybe a master override color if the IVA designer wants to control the color directly. And, while I'm at it, maybe a cool fade effect for the atmosphere (although that's such a small slice, it may not be worth the extra work).

Alexustas commented 6 years ago

Different colors for the filled planet depending on which planet we're orbiting?

It sounds interesting, but only if it does not require a lot of resources and we will be able to change or completely turn off the color fill.

Personally, I use overlapping information text over an orbital map and color filling can make the text less readable, especially small text. so I do not think I'm going to use this feature extensively

Alexustas commented 6 years ago

What I personally would be interested in getting in the new version of the orbital map is a couple of features:

bandicam 2017-12-28 02-56-25-700

bandicam 2017-12-28 03-07-26-713

nevercast commented 6 years ago

Seeing upcoming orbits would be awesome for planning chained maneuvers. One thing I miss in my IVA is my excessive abuse of conics on the map.

Regarding OP, it's a surprise to me that GL Calls are inefficient, why is the line renderer faster?

MOARdV commented 6 years ago

Regarding OP, it's a surprise to me that GL Calls are inefficient, why is the line renderer faster?

GL calls are done in immediate mode, which is an artifact of the pre-GPU OpenGL API. Modern GPUs don't support immediate mode, so the GL API or the game engine above it must batch and send that data. Those calls are done every Unity Update() call (including the transforms to put them into the right place on-screen), so that's a lot of recomputing the same data over and over at the mod's level, and sending that data through Unity. The LineRenderer (presumably) is not emulating immediate mode, and it does not require resending data every Update.

nevercast commented 6 years ago

That's horrible! Thanks for the information, I would have kept acting on the assumption that using GL is direct hardware - wasn't aware Unity was using such a dated GL API

MOARdV commented 6 years ago

A lot of stuff to do for this task.

I need to decide how to handle target orbit rendering. I think RPM ignored the argument of periapsis for the orbits it rendered, but I really should account for it - if the target is in an elliptical orbit with a periapsis on the opposite side of the planet from the ownship's periapsis, the relative orbits will be very wrong if I do not account for relative arguments of periapsis. I also need to work out how to handle updating orbit lines - I don't want to update them every Update(), or even every FixedUpdate(). Maybe I can store the orbital parameters in a vector and test them on FixedUpdate() to see if they have changed.

MOARdV commented 6 years ago

Ah! Here's something: since the orbits will be drawn with LineRenderer, I can allow each line to have two colors (start and end), similar to the ELLIPSE page object. With two colors, I can draw the orbits similar to how the Map View draws them, with startColor where the vessel currently is, and endColor at the end of the orbit (future position).

MOARdV commented 6 years ago

Very early support for ORBIT_DISPLAY on DropBox. Support for current vessel (for eccentricity < 1.0) and drawing the body that the vessel orbits.

theonegalen commented 6 years ago

My big request for this feature (and all displays) is the ability to go completely monochrome to emulate an early CRT monitor. Greenscale, that horrible Orangescale I remember from library computers in the 90s, Grayscale... The orbit display with RPM seems not to have the ability to change the color of the body itself, which means the greenscale CRT MFD I'm working on has white in it.

MOARdV commented 6 years ago

My big request for this feature (and all displays) is the ability to go completely monochrome to emulate an early CRT monitor.

My intent is that you can configure all of the components in the page config - you can override the atmosphere and body colors, set the various orbit colors, etc. That's actually available with the release I did today. See the documentation for a little more detail.

MOARdV commented 6 years ago

Slow progress. DropBox has the current edition. Renders current orbit, target orbit (if in the same SoI), maneuver node orbit (if in the same SoI), and current body/atmosphere.

The automatic scaling is not perfect if the target or maneuver node has a very different LAN or ArgPe, or a hyperbolic orbit. I will revisit that feature next, I think.

MOARdV commented 6 years ago

One thing I am not happy with is the automatic colors for bodies / atmospheres. I don't think I have the right values, since they're not very saturated. I've added a hack to gain the colors towards full saturation, but it's ... meh. I could use hard-coded color tables like I use on Distant Object Enhancement, but it would be nice to find a color somewhere in KSP that would work. Maybe I can find the Map mode orbit colors?