Discussion area flattening experiment - SUCCESS

paddy2

Addon Developer
Addon Developer
Joined
Jul 21, 2012
Messages
384
Reaction score
1
Points
18
Location
Kent, UK
I think this idea has great merit. I am thinking of the process of making a whole new base, be it on the moon or on earth. Having mapped out a suitable area, the one thing I am sure of is that the terrain will not be suitable for a one metre thick disk of concrete to be poured and call it a landing pad. The area will need to be made ready.

Where will the pad go, where is the "hanger" to be placed, do we need a taxiway from hanger to Pad. In short please give me a flattened area in which I can place the required parts to make up my ( new ) base. Earth or moon the bulldozers will have to do their job first.

Oh wait a minute.... thats is just what this does I think. It may be of very very little value but it gets my Vote. ( Value of vote, not of addon! )
 

4throck

Enthusiast !
Joined
Jun 19, 2008
Messages
3,502
Reaction score
1,008
Points
153
Location
Lisbon
Website
orbiterspaceport.blogspot.com
OK Fred, let's forget landed vessels :thumbup:


But the best way to do custom terrain is to model it as a mesh...
So would it be possible to load a mesh and use its vertices as a terrain source?
 

fred18

Addon Developer
Addon Developer
Donator
Joined
Feb 2, 2012
Messages
1,666
Reaction score
100
Points
78
Sorry, missed that part in your posts somehow.

No, I think it should work similar to the current visual filtering, i.e. getting the tile data before usage, then manipulate it.

On that note, my current skeleton callback is like so:
Code:
void FilterElevation(OBJHANDLE hPlanet, int lvl, int ilat, int ilng, INT16 *elev);

Within it, you just do the same that you do at our experiment point in the D3D9Client (provided you use the same that I had posted in the dev thread before). This way, you have only one algorithm for both sides: visual and collision detection.

The oapiSurfaceElevation() function actually uses some internal function I've called "GetSurfacePlane" - that takes a boatload of arguments - with many arguments nulled in order to just get the height value at the given lat/lng point. But this internal function does the whole loading dance with calling something like "GetElevation" and "GetElevMod" to load data from disk. If there is none (or the "Archive only" flag is set), it apparently memcpys from a buffer (presumably the preloaded archive). The point I've described previously is within that "GetSurfacePlane" function, after the elevation data was gathered, but before it is used to calculate the plane.
There I'll put in the trampoline and call the filter function described above.

An oapiSetSurfaceElevation() that works as counterpart to oapiSurfaceElevation() would only set the elevation at one specific point, not on a complete plane defined by e.g. a circle.

Just trying to narrow down the request at the minimum: something like
oapiSetAreaElevation(OBJHANDLE hPlanet, double lng0, double lat0, double lng1, double lat1, double elevation) which sets the constant value of elevation in the whole rectangle from lng0,lat0 to lng1,lat1 could be good? I don't know if it is not correct because it is not "preprocessed" but it seems to me that the tiles are loaded on the go so it should be ok?

my idea is to narrow everything to just a small function to ask, and then, in case we have that function we can build a plugin so Martin would not be distracted from his own development too much. Then of course if he wants to add our idea to the core I would be happy. But to me it would be enough to have the chance to develop the idea.

---------- Post added at 13:34 ---------- Previous post was at 13:26 ----------

OK Fred, let's forget landed vessels :thumbup:


But the best way to do custom terrain is to model it as a mesh...
So would it be possible to load a mesh and use its vertices as a terrain source?

that would require to set elevation point by point, match the levels etc, so it is basically equals to patch the elev files.

or you can set a big fake ghost vessel like AMSO does. if you want. :crystalball:

But I'd like to point out that the scope of this (at least my idea) is exactly the opposite: I want a way not to have to do terrain, but to flatten terrain super easily where I want so I can put items that must stay on flat land (runways, pads, buildings). For modeling mountains there is the default system or there can be other work around, but it would be out of the scope of this particular function, which is a "bulldozer" function as paddy2 correctly defined it: it is meant just to flatten.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,636
Reaction score
2,613
Points
203
Location
Dallas, TX
So this will be for D#D9 only, right?

So it sounds like the idea is to flatten certain aress and then leave the terrain around it alone, right?

So for example. You picked the area at a mountain top and flatten that ere you would have a landing area inside the mountain, right?
 

fred18

Addon Developer
Addon Developer
Donator
Joined
Feb 2, 2012
Messages
1,666
Reaction score
100
Points
78
So this will be for D#D9 only, right?

no. We are using D3D9 to make a demonstration of this since we have access to the code, but the idea is to ask to martin a function to make this (and that would then works for both D3D9 and inline client).

So it sounds like the idea is to flatten certain aress and then leave the terrain around it alone, right?

the idea is to have the chance to flatten small areas easily, without having to deal with the elevation files which are difficult to manage but simply with a function that overrides the elevation values for the areas and uses a constant one in their place.

So for example. You picked the area at a mountain top and flatten that ere you would have a landing area inside the mountain, right?


you choose the coordinates, the size and the height of the flattened area and you'll have a flat area where you can land on like that or if you want you can put a pad or a runway there.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,636
Reaction score
2,613
Points
203
Location
Dallas, TX
Great. So do you see where you could have one elevation at one end and another elevation at the other end? Like a ramp and then a flatten area like LP39a.
 

fred18

Addon Developer
Addon Developer
Donator
Joined
Feb 2, 2012
Messages
1,666
Reaction score
100
Points
78
Great. So do you see where you could have one elevation at one end and another elevation at the other end? Like a ramp and then a flatten area like LP39a.

I'm not sure I understood, but anyway the idea is relevant to just flat (in the sense of horizontal flat) areas. inclined surfaces suffer from height resolution and it becomes another kind of issue. anyway it depends on the type of function that we could possibly get.
 

jarmonik

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,651
Reaction score
785
Points
128
Just trying to narrow down the request at the minimum: something like
oapiSetAreaElevation(OBJHANDLE hPlanet, double lng0, double lat0, double lng1, double lat1, double elevation) which sets the constant value of elevation in the whole rectangle from lng0,lat0 to lng1,lat1 could be good?


That doesn't sound so great. When you are calling oapiSetAreaElevation() it's possible that Orbiter has not even loaded the terrain where to set the elevation. It's possible that amount of terrain kept in memory by Orbiter is very small.


I would support the idea that Face was working on as one option void FilterElevation(OBJHANDLE hPlanet, int lvl, int ilat, int ilng, INT16 *elev); But I would change the INT16 *elev to float *elev. It would sound logical that Orbiter would convert the INT16 data to float when loading it. This is not very far from the tile server idea I had.


If the "flat spots" are implemented as a core feature in the Orbiter then the Orbiter could manage the database and the D3D9 could use a query functions to acquire the data from the Orbiter for rendering.
 

fred18

Addon Developer
Addon Developer
Donator
Joined
Feb 2, 2012
Messages
1,666
Reaction score
100
Points
78
That doesn't sound so great. When you are calling oapiSetAreaElevation() it's possible that Orbiter has not even loaded the terrain where to set the elevation. It's possible that amount of terrain kept in memory by Orbiter is very small.


I would support the idea that Face was working on as one option void FilterElevation(OBJHANDLE hPlanet, int lvl, int ilat, int ilng, INT16 *elev); But I would change the INT16 *elev to float *elev. It would sound logical that Orbiter would convert the INT16 data to float when loading it. This is not very far from the tile server idea I had.


If the "flat spots" are implemented as a core feature in the Orbiter then the Orbiter could manage the database and the D3D9 could use a query functions to acquire the data from the Orbiter for rendering.

I see and I completely understand and agree, that was my doubt. Let's proceed with Face's idea then!

---------- Post added at 14:32 ---------- Previous post was at 14:31 ----------

I am willing to test if you need a guinea pig:)

I'd love to have something to test. But the whole point here is that only Martin can implement the base for this. then I'd be happy to code plugins or anything else is needed but at the moment if Martin does not provide the core function there is not much we can do about this. :shrug:

I just hope that this thread, the video, the new demnostration that Face is working on etc are enough to make him have a go on that function
 

jarmonik

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 28, 2008
Messages
2,651
Reaction score
785
Points
128
So would it be possible to load a mesh and use its vertices as a terrain source?


It would be possible to have a patch utility that would take a mesh as an input and create a set of Elev_Mod files and Surf textures as output. Realtime solution is unlikely. Do you have any mesh candidates for testing purposes ?
 
Last edited:

Donamy

Addon Developer
Addon Developer
Donator
Beta Tester
Joined
Oct 16, 2007
Messages
6,904
Reaction score
196
Points
138
Location
Cape
Would love to be able to land on the moon, and not sink in the mud. Oh wait...
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,636
Reaction score
2,613
Points
203
Location
Dallas, TX
Would love to be able to land on the moon, and not sink in the mud. Oh wait...


Well you can do that now. Some sinkage is normal. If Ummu or what ever come out I hope for precise touchdown points,....
 

kuddel

Donator
Donator
Joined
Apr 1, 2008
Messages
2,064
Reaction score
507
Points
113
Just as a side-note for "flat":
For planet-sized bodies, matching a flat area onto the sphere is usually O.K. and exactly what one would expect,
but for small bodies a "flat-flat" area might be what a base-builder likes to have.

We should keep in mind that an "DONT_MAP_TO_SPHERE" option/flag might be needed.
 

Attachments

  • FlatOnSphere.png
    FlatOnSphere.png
    16.8 KB · Views: 23

fred18

Addon Developer
Addon Developer
Donator
Joined
Feb 2, 2012
Messages
1,666
Reaction score
100
Points
78
Just as a side-note for "flat":
For planet-sized bodies, matching a flat area onto the sphere is usually O.K. and exactly what one would expect,
but for small bodies a "flat-flat" area might be what a base-builder likes to have.

We should keep in mind that an "DONT_MAP_TO_SPHERE" option/flag might be needed.

I surely agree. :thumbup:

Anyway I think that the base point is that we need access to the elevation data that the core has inside. If we get that from Martin then we can build whatever plugin is needed with whatever option. :tiphat:
 

4throck

Enthusiast !
Joined
Jun 19, 2008
Messages
3,502
Reaction score
1,008
Points
153
Location
Lisbon
Website
orbiterspaceport.blogspot.com
It would be possible to have a patch utility that would take a mesh as an input and create a set of Elev_Mod files and Surf textures as output. Realtime solution is unlikely. Do you have any mesh candidates for testing purposes ?


Realtime is not needed, but I think using Orbiter itself for realtime preview (and adjustments) might be interesting.
Just like Fred's Multistage and VBuilder, that has a GUI inside Orbiter.

Indeed I have suitable meshes, based on approximate real data for the Pathfinder landing site:
https://www.orbithangar.com/searchid.php?ID=6348


One covers a larger area, the other just the proximity of the lander, both have textures.
Have fun with them!
 

Face

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 18, 2008
Messages
4,390
Reaction score
577
Points
153
Location
Vienna
I would support the idea that Face was working on as one option void FilterElevation(OBJHANDLE hPlanet, int lvl, int ilat, int ilng, INT16 *elev); But I would change the INT16 *elev to float *elev. It would sound logical that Orbiter would convert the INT16 data to float when loading it. This is not very far from the tile server idea I had.

It seems like Orbiter internally also uses INT16 arrays for the raw elevation data it operates on. This is also the case for the OVP code, so I guess it is best used in both cases with that signature.
 

fred18

Addon Developer
Addon Developer
Donator
Joined
Feb 2, 2012
Messages
1,666
Reaction score
100
Points
78
So what do we do, we just hope that martin find the time and the patience to read this or shall we highlight, recapi and forward this to him in any manner? just to know how to do it properly, without making him lose time, or anything he doesn't like.
 

Face

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 18, 2008
Messages
4,390
Reaction score
577
Points
153
Location
Vienna
Good news, folks: I've made it! The trampoline is installed and hooks Orbiter's core collision detection, so you can overwrite it in a filter function similar to what you've seen before. You can then land vessels on the flat surface.

Debug example client that makes a pancake at Canaveral: http://snoopie.at/face/beta/D3D9Client.dll
Code is here: https://bitbucket.org/face/ovp/commits/e06603ad706b2449a581273d8d8b720c8b1be467

Please use it only with stock Orbiter 2016, not with a beta.

Note that at the moment I don't have forwarded the proper OBJHANDLE from the core hook, so don't use this just yet.
 

DaveS

Addon Developer
Addon Developer
Donator
Beta Tester
Joined
Feb 4, 2008
Messages
9,429
Reaction score
680
Points
203
Top