Orbiter dynamics news

Loru

Retired Staff Member
Retired Staff
Addon Developer
Donator
Joined
Sep 30, 2008
Messages
3,731
Reaction score
6
Points
36
Location
Warsaw
Well - in some cases mesh is hardcoded (XR-2) and IMO manually flagging vertices after conversion from 3d editing software may slow down dev process a lot.

Also that way you can define more unusual things like forcefields, magnetic pushers etc. where vertices doesn't match physical structure. IMO that's also pretty fast way to update some of the vessels already released since all you have to do is create additional simplified mesh and name it properly.

But as usual that's only my opnion.
 

martins

Orbiter Founder
Orbiter Founder
Joined
Mar 31, 2008
Messages
2,448
Reaction score
462
Points
83
Website
orbit.medphys.ucl.ac.uk
Reading touchdown points from file is definitely a good idea. I'm undecided if it's better to put them in the mesh file or a separate file. Mesh file would have the advantage of being more compact (no need for additional files), and touchdown points do have a connection to the geometry, i.e. mesh. On the other hand, the touchdown points don't fit perfectly into the vertex definition (no normals or texture coordinates, no element index lists). Currently, touchdown points have two scalar parameters (stiffness and damping) so in theory I could commandeer the texture coordinates for that. But in future there may be additional parameters (friction coefficients, compression directions), so I may need to extend the mesh format accordingly.
 

Hlynkacg

Aspiring rocket scientist
Addon Developer
Tutorial Publisher
Donator
Joined
Dec 27, 2010
Messages
1,870
Reaction score
3
Points
0
Location
San Diego
I like the idea of a sceond (simplified) mesh file. Seems that it strikes a good balance between backwards compatability (if now dynamics mesh present just use the old-fashioned TDPs) and ease of developement.

The dynamics mesh could also be used in future as a basis for collision detection ;)
 

Artlav

Aperiodic traveller
Addon Developer
Beta Tester
Joined
Jan 7, 2008
Messages
5,790
Reaction score
780
Points
203
Location
Earth
Website
orbides.org
Preferred Pronouns
she/her
In Meshland the collision points were defined on their own - either in a special file, or by CollisionSDK calls.

To me that makes more sense if you don't plan on making vessel-vessel collisions - a mesh would only add redundant data and be non-editable manually, and storing them in the msh file would just make them lost.
 

Hlynkacg

Aspiring rocket scientist
Addon Developer
Tutorial Publisher
Donator
Joined
Dec 27, 2010
Messages
1,870
Reaction score
3
Points
0
Location
San Diego
In Meshland the collision points were defined on their own - either in a special file, or by CollisionSDK calls.

To me that makes more sense if you don't plan on making vessel-vessel collisions - a mesh would only add redundant data and be non-editable manually, and storing them in the msh file would just make them lost.

Ok, take a mesh file remove the redundant data and call it *.dyn instead of *.msh.

A mesh (or similar) file is still a lot easier to edit than a dll.

For backwards compatability can than just throw a pointer in the vessel's config to the appropriate *.dyn file.
 

Donamy

Addon Developer
Addon Developer
Donator
Beta Tester
Joined
Oct 16, 2007
Messages
6,916
Reaction score
211
Points
138
Location
Cape
Could the touch down points interact with other vessels ?
 

Grover

Saturn V Misfire
Addon Developer
Donator
Joined
Oct 3, 2010
Messages
1,468
Reaction score
0
Points
0
Location
Ascension Island
getting very complex there, then you need vessels to have planes of collision, not points (as vessels have now), since you always need at least one plane to collide with), so at least one of your vessels would need a collision mesh to act as a cloak around the whole thing, which would be a HUGE killer on framerate for a station and a couple of craft
 

C3PO

Addon Developer
Addon Developer
Donator
Joined
Feb 11, 2008
Messages
2,605
Reaction score
17
Points
53
Or this:
[ame="http://www.youtube.com/watch?v=fvg9z35-bGs"]Mars Exploration Rover's funny clip - YouTube[/ame]
 

asmi

Addon Developer
Addon Developer
Joined
Jan 9, 2012
Messages
350
Reaction score
0
Points
0
Location
Ontario
Reading touchdown points from file is definitely a good idea. I'm undecided if it's better to put them in the mesh file or a separate file. Mesh file would have the advantage of being more compact (no need for additional files), and touchdown points do have a connection to the geometry, i.e. mesh. On the other hand, the touchdown points don't fit perfectly into the vertex definition (no normals or texture coordinates, no element index lists). Currently, touchdown points have two scalar parameters (stiffness and damping) so in theory I could commandeer the texture coordinates for that. But in future there may be additional parameters (friction coefficients, compression directions), so I may need to extend the mesh format accordingly.

I think there should be a way to provide TDPs at a runtime, otherwise it would preclude vessels with dynamic shape (foldable wings, even retracteable gears) so vessel module should be able to dynamically update collision mesh.

However as one of D3D11Client's developers I'm very interested in other side of things, namely terrain. We have implemented a complete 3D terrain engine, but right now we're basically fighting with the fact that Orbiter assumes that surface is flat. Currently we're trying to use AddForce() to simulate terrain, and it kinda works when the "real" surface is above "zero" level, but the vessel can't go in the negatives, and while this is not a big issue for Earth (AFAIK there is only one place on Earth where you can actually fly below sea level), it is a big problem for other celestials - especially for the Moon.
Another problem is that all MFDs take current altitude from Orbiter, so all landing-related MFDs (like VTOL, ILS) don't work properly unless bases are at zero altitude. For now it forced us to introduce wery ugly workarounds like hills and craters for bases so this terrain engine can be usable for something other than staring at beautiful landscape and atmosphere :) This is what it looks like:
Brighton Beach.jpg

After giving some thought at the problem, I think there should be a way for graphics clients (and possibly other modules) to provide to Orbiter's core an altitude at any given point of surface, as well as partial derivatives (two pairs of (dy/dx, dy/dz) in local frame (alt == y), we need two derivatives as terrain doesn't have to be smooth function). In addition to that the should be a method to return a terrain structure for any given patch of surface - this will greatly improve performance for collision detection as you could request a whole piece of terrain below the vessel in one call, so avoiding a need to retrieve this information on a point-by-point basis. Below are the prototypes for the methods that I envision will be enough to cover the subject:
Code:
/*
Returns altitude of point in question, and optionally partial derivatives
x, z - coordinates of the point in question
ddx, ddy - pointers to arrays of two elements each for partial derivatives, optional, can be nullptr - in this case they are not returned
*/
void GraphicsClient::GetAltitude(double x, double z, double ** ddx, double ** ddz);

/*
Returns a patch mesh, and its dimensions
x1, z1 - coordinates of one corner of the patch
x2, z2 - coordinates of another corner of the patch
mesh - a pointer to a variable that receives a pointer to a two-dimensional array of vertices representing the mesh
pointsCountX, pointsCountZ - a pointers to a variables receiving the dimensions of array
*/
void GraphicsClient::GetAltitudePatchMesh(double x1, double z1, double x2, double z2, VECTOR3 ** mesh, int * pointsCountX, int * pointsCountZ);

/*
This function releases the memory for the array returned by GraphicsClient::GetAltitudePatchMesh() method. This method is nessessary as Orbiter itself, and its modules can be built against different versions of CRT.
mesh - pointer received in GraphicsClient::GetAltitudePatchMesh() call
*/
void GraphicsClient::ReleaseAltitudePatchMesh(VECTOR3 ** mesh);
 
Last edited:

martins

Orbiter Founder
Orbiter Founder
Joined
Mar 31, 2008
Messages
2,448
Reaction score
462
Points
83
Website
orbit.medphys.ucl.ac.uk
I think there should be a way to provide TDPs at a runtime, otherwise it would preclude vessels with dynamic shape (foldable wings, even retracteable gears) so vessel module should be able to dynamically update collision mesh.
Yes, this is provided anyway. It's currently implemented as an extended version of VESSEL::SetTouchdownPoints(), with variable number of points and additional parameters per point. I may also add methods to modify individual points. Additionally, I am thinking of allowing to bind touchdown points into animations similar to mesh groups, which should reduce the need of modifying points manually.
However as one of D3D11Client's developers I'm very interested in other side of things, namely terrain. We have implemented a complete 3D terrain engine, but right now we're basically fighting with the fact that Orbiter assumes that surface is flat. Currently we're trying to use AddForce() to simulate terrain, and it kinda works when the "real" surface is above "zero" level, but the vessel can't go in the negatives, and while this is not a big issue for Earth (AFAIK there is only one place on Earth where you can actually fly below sea level), it is a big problem for other celestials - especially for the Moon.
Another problem is that all MFDs take current altitude from Orbiter, so all landing-related MFDs (like VTOL, ILS) don't work properly unless bases are at zero altitude. For now it forced us to introduce wery ugly workarounds like hills and craters for bases so this terrain engine can be usable for something other than staring at beautiful landscape and atmosphere :) This is what it looks like:

After giving some thought at the problem, I think there should be a way for graphics clients (and possibly other modules) to provide to Orbiter's core an altitude at any given point of surface, as well as partial derivatives (two pairs of (dy/dx, dy/dz) in local frame (alt == y), we need two derivatives as terrain doesn't have to be smooth function). In addition to that the should be a method to return a terrain structure for any given patch of surface - this will greatly improve performance for collision detection as you could request a whole piece of terrain below the vessel in one call, so avoiding a need to retrieve this information on a point-by-point basis. Below are the prototypes for the methods that I envision will be enough to cover the subject:
The terrain engine sounds exciting, and I am happy to add any required API interfaces to Orbiter. In fact, this was already briefly discussed by Artlav earlier in the thread.
The interaction between Orbiter and the graphics client regarding terrain will need some careful planning, because this is a point where physics and graphics are closely connected.

How closely is the terrain engine tied into the DX11 graphics engine? Is there a way to keep the terrain engine isolated from the pure graphics routines, or does your terrain engine require some specific DX11 functionality? I am asking because currently Orbiter can run without a graphics engine attached, so API functions like the ones you mentioned aren't guaranteed to be available at runtime. This would either require a dummy graphics client that returns default values for those functions, or the terrain API could be separated from the graphics API, e.g.

DX11Client --> TerrainClient --> oapi::GraphicsClient

or, a bit more elaborately with a separate terrain API (oapi::TerrainClient?)
Code:
                   +-------------Orbiter------------+
+---------------+  |                                |
|  DX11Client   |---->GraphicsAPI                   |
+---------------+  |        ^                       |
                   |        |                       |
+---------------+  |        |                       |
| TerrainClient |---->TerrainAPI                    |
+---------------+  |                                |
                   +--------------------------------+
where the internal connection between "GraphicsAPI" and "TerrainAPI" represents passing elevation data for surface patches.

In general, I would like to avoid making the simulator physics too dependent on the graphics engine used. If the terrain engine can be kept independent of a specific graphics engine, this would also simplify the development of future graphics clients, because the terrain code wouldn't have to be rewritten or ported. Any thoughts on the practicality of this?

I was also thinking about writing a small proof-of-concept terrain engine, just to figure out the best way to design the interfaces, but maybe it's more efficient to leave this to you guys and just provide the required interface support.

Out of interest: what algorithms are you using for your terrain engine? Is it some ROAM-type approach? Do you have any references (online papers etc.) I could have a look at?
 

Artlav

Aperiodic traveller
Addon Developer
Beta Tester
Joined
Jan 7, 2008
Messages
5,790
Reaction score
780
Points
203
Location
Earth
Website
orbides.org
Preferred Pronouns
she/her
Theoretically, a terrain engine is easily separateable from any graphics representation.
OGLAClient, Orulex, Orbiter Galaxy and Spaceway share the same terrain engine, and that one can be easily adapted to a simple, clean Orbiter module.

So, my advice would be to provide hooks or interface for custom terrain modules, independent of GCs - then it can be used by graphic clients, by generic terrain modules, by surface bases, etc.

I don't think collision detection or terrain elevation determination should in any way or form be bound to triangle mesh, but instead a call/callback should be added for getting a set of elevation data from the module.

Asmi's suggested functions seem like a good choice (except i would have used VECTOR3 coordinates wrt the planet's centre instead of lat/lon).
I would also add an array variation - input of a set of coordinates, returns set of elevations.
That would allow to request the whole set of touchdown points for a vessel in one go, a compromise between a point-by-point approach and big bitmap approach.

Generaically, there would be two kinds of modules - global, covering a planet or all planets, and local - covering a surface base or some location. Seconds should override the firsts, firsts should be mutually exclusive with other firsts.

Maybe i'm overexpecting things here - it's unlikely that there would be more than a couple terrain modules, no?

---------- Post added at 21:50 ---------- Previous post was at 21:44 ----------

Preemptive clarification - i separate the ideas of terrain engine and terrain rendering.
Like client-server, backend-frontend.

Engine does the elevation computation (heightmap interpolation and mixing, fractal terrain, etc), and nothing else.
The rendering part is what turns the terrain engine's output into visible triangles.

The module interface i suggested is to fit the engine part, dealing with the raw data, and is not in any shape or form connected to the visible stuff, ROAM, and other LOD things.
 

asmi

Addon Developer
Addon Developer
Joined
Jan 9, 2012
Messages
350
Reaction score
0
Points
0
Location
Ontario
Yes, this is provided anyway. It's currently implemented as an extended version of VESSEL::SetTouchdownPoints(), with variable number of points and additional parameters per point. I may also add methods to modify individual points. Additionally, I am thinking of allowing to bind touchdown points into animations similar to mesh groups, which should reduce the need of modifying points manually.
I don't think tying collision mesh to animations is a good idea, because as a result of animation some points that were "on the outside" of collision mesh will cease to be them - for example gears are parts of collision mesh when they are down, but they aren't when gears are up as they are now hidden inside fuselage, so instead fuselage's underbody is vessel's border.

The terrain engine sounds exciting, and I am happy to add any required API interfaces to Orbiter. In fact, this was already briefly discussed by Artlav earlier in the thread.
The interaction between Orbiter and the graphics client regarding terrain will need some careful planning, because this is a point where physics and graphics are closely connected.

How closely is the terrain engine tied into the DX11 graphics engine? Is there a way to keep the terrain engine isolated from the pure graphics routines, or does your terrain engine require some specific DX11 functionality? I am asking because currently Orbiter can run without a graphics engine attached, so API functions like the ones you mentioned aren't guaranteed to be available at runtime. This would either require a dummy graphics client that returns default values for those functions, or the terrain API could be separated from the graphics API, e.g.

DX11Client --> TerrainClient --> oapi::GraphicsClient

or, a bit more elaborately with a separate terrain API (oapi::TerrainClient?)
Code:
                   +-------------Orbiter------------+
+---------------+  |                                |
|  DX11Client   |---->GraphicsAPI                   |
+---------------+  |        ^                       |
                   |        |                       |
+---------------+  |        |                       |
| TerrainClient |---->TerrainAPI                    |
+---------------+  |                                |
                   +--------------------------------+
where the internal connection between "GraphicsAPI" and "TerrainAPI" represents passing elevation data for surface patches.

In general, I would like to avoid making the simulator physics too dependent on the graphics engine used. If the terrain engine can be kept independent of a specific graphics engine, this would also simplify the development of future graphics clients, because the terrain code wouldn't have to be rewritten or ported. Any thoughts on the practicality of this?
This feature was developed by another developer, Glider, so I will try to explain details to the best of my knowledge, but if you'll need more details, we can ask him for further clarifications.

Currently we have heightmaps for several celestials which are essencially the same as *.tex files, but consist of 129x129 16bit float png-encoded tiles containing a point's altitude within [-32k, 32k] meters, which appears to be more than enough to cover all celestials with more or less known real terrain. They are tiled in exact same way as regular *.tex files are, incliding different levels of detailing. We use those maps to dynamically morph initially-flat terrain using hardware tesselation feature available in DX11, which essentially is simply hardware solution that allows to subdivide initially-lowres mesh. This allows us to have great accuracy (Glider tells it's in 0.1 meter range at L18), while still having modest memory footprint.

Currently we have heightmaps for Earth, Moon and Mars. As far as I understand, it's a real data. For other celestials we're currently using a generated terrain using libnoise, but it's handled by the terrain loading, so as far as the rest of the client goes, the source of data doesn't matter.

As you can see, as far as raw data goes, it's completely independent from the GC itself, and can be separated with no issues as long as we still can gain access to raw data - while DX10/11 devices directly supports 16bit float textures, DX9 and OGL will possibly need to convert this some other format. If collision detection and aforementioned API implemented outside GC they only reason we'll need those maps is for rendering terrain itself, so this can totally be moved out of GC with little effort.

Even more, it's just occured to me that if we'll be able to settle down on inputs for the terrain engine (that's it, physical part of it), this engine could simply be integrated into Orbiter itself, or included as a standard extension since I don't see a reason for many different terrain engines to exist. Either way, I would be more than happy to help in this area, as that's exact this that prevents us from releasing new version of D3D11Client, and if your plans include 3D terrain support coming up with some stop-gaps would seems wasterful on our side.

I was also thinking about writing a small proof-of-concept terrain engine, just to figure out the best way to design the interfaces, but maybe it's more efficient to leave this to you guys and just provide the required interface support.
They way I see it, the TerrainClient is going to have just two responsibilities: loading/retreiving heightmap (and possibly landcover - such a feature is also in works now) data and feeding this data to graphics clients, and collision detection. If it's so, in can be implemented fairly easily, as the bits of this thing are already in our client.

Out of interest: what algorithms are you using for your terrain engine? Is it some ROAM-type approach? Do you have any references (online papers etc.) I could have a look at?
We use hardware tesselation to dynamically subdivide original low-res primitives, and subdivision factor (i.e. how fine to subdivide) can be manipulated for each primitive independently. For now we use hardcoded values, but there are plans to make them dependent of apparent primitive size, and smooth out tesselated primitives using Bezier curves, or N-Patch-like approach. It is technically ROAM-type approach, but thanks to advanced features in modern video hardware, we can do it entirely on GPU which provides for very and fast implementation. It isn't based on any specific paper, but rather is a fusion of ideas from different sources. There are still things to be done, but it's pointless to do them until we have resolved aforementioned major problems.
 

N_Molson

Addon Developer
Addon Developer
Donator
Joined
Mar 5, 2010
Messages
9,288
Reaction score
3,257
Points
203
Location
Toulouse
Quite exciting ! :thumbup:

An addon like a lunar lander would be greatly improved by the new touchdownpoints systems and terrain collision :yes:
 

asmi

Addon Developer
Addon Developer
Joined
Jan 9, 2012
Messages
350
Reaction score
0
Points
0
Location
Ontario
Quite exciting ! :thumbup:

An addon like a lunar lander would be greatly improved by the new touchdownpoints systems and terrain collision :yes:
I think introduction of a real terrain would bring the simulator to a next level as right now it's very good at simulating spaceflights, but not so much at piloting vessels near celestials' surfaces. If we'll add landcover into the mix (with variable friction coefficients for different kinds of terrain - like show, rock, sand, water, etc.), this will close a major gap in Orbiter as end-to-end simulation solution - at the end of the day, we're not just flying in the middle of nowhere, but are going from one place to another, and these places are mostly on the surface of some celestial. Think of a possibility to land on a very top of Everest mountain, or to splash into the ocean, or even to land on an aircraft carrier in the middle of Atlantic ocean - all of that will become possible to implement in GC!
 

luki1997a

Active member
Joined
Dec 9, 2010
Messages
314
Reaction score
0
Points
31
Location
Biłgoraj
If there will be terrain and collision detection it would be great! New Orbiter w/ D3D11Client and we have very modern, cool simulator :)

But my question is, if collision detection would be implemented, will it behave like MeshLand? I mean it was a little bit unstable, which turns rolling on the surface to rotating:lol:

I think if terrain would be implemented, Orbit MFD should behave as always, showing radius of orbit, but Surface MFD should behave like radar, which shows altitude exactly below the ship.

:hailprobe: and :hail: you, Martin ;)
 

Zachstar

Addon Developer
Addon Developer
Donator
Joined
May 1, 2008
Messages
654
Reaction score
0
Points
0
Location
Shreveport, Louisiana
Website
www.ibiblio.org
Absolutely amazing work! And the talk about a standardized way of Terrain collision and rendering is even better!

BTW Asmi, I will admit my utter fail at keeping up with the DX9 and DX11 clients. However I just have to point out how utterly amazed I am to hear you can handle such amazingly high resolutions. Is anyone else in the various industries using DX11 in a similar method or are y'all making history on this forum?
 

RisingFury

OBSP developer
Addon Developer
Joined
Aug 15, 2008
Messages
6,427
Reaction score
492
Points
173
Location
Among bits and Bytes...
That's outstanding!

Is it just me, or does the docking port flex as well? Also, how come the vessel doesn't tip over when sitting on the front landing gear only?
 

N_Molson

Addon Developer
Addon Developer
Donator
Joined
Mar 5, 2010
Messages
9,288
Reaction score
3,257
Points
203
Location
Toulouse
Very interesting feature, with a lot of potential applications ! :thumbup:
 
Top