# Discussionarea flattening experiment - SUCCESS

#### gattispilot

So not sure how I can test it? I saw the bitbucket. Is the dll made already?

#### Face

##### Well-known member
Orbiter Contributor
Beta Tester
So not sure how I can test it? I saw the bitbucket. Is the dll made already?

What I proposed 2 days ago is not done yet (to my knowledge). But I'm close, I guess I can release a first cut tomorrow.

#### Donamy

Donator
Beta Tester
Pardon my lack of knowledge, but does the moon have new texture mode ?

#### Face

##### Well-known member
Orbiter Contributor
Beta Tester
Pardon my lack of knowledge, but does the moon have new texture mode ?

It is a configuration thing. If you have the following in the GBody config, you have the new mode:
Code:
TileFormat = 2

The stock moon configuration has this setting.

---------- Post added at 22:24 ---------- Previous post was at 17:11 ----------

I've finished implementing my proposal. Get the release build of the modded D3D9Client here: http://snoopie.at/face/beta/D3D9Client.dll

With this you can define *.flt files in /Textures/<planet>/Flat/ folders with the following (slightly changed) line definition:
Code:
ELLIPSE <height> <lng> <lat> <major> <minor> <phi> <falloff>
or
RECT <height> <lng> <lat> <length> <width> <phi> <falloff>

* <height> is in integer meter, supposedly w.r.t. mean sphere radius
* <lng> <lat> are double longitude and latitude coordinates, as defined in e.g. base configuration file
* <major> <minor> are ellipse major and minor radius in integer meter, <minor> defaults to <major> if not defined - the meter definition might not be exact, as it uses a decimal degree guess at the latitude circle
* <length> <width> are rectangle length and width in integer meter, <width> defaults to <length> if not defined - meter definition same as above
* <phi> is rotation angle in double degree from equator, with <major> and <length> being parallel to equator
* <falloff> is the integer percentage (e.g. 50 for 50%) of the shape radius where transparent merging with original height is done

Lines with comment start and/or too less arguments are ignored.

Get the full code at https://bitbucket.org/face/ovp/get/D3D9Client/2016.zip

Last edited:

#### fred18

Donator
What I proposed 2 days ago is not done yet (to my knowledge). But I'm close, I guess I can release a first cut tomorrow.

i don't want to be any bottleneck here. I am about to leave with family for easter holidays and packing everything with 2 small daughters it's quite a challenge so I won't have much time available for about a week unfortunately.

Pardon my lack of knowledge, but does the moon have new texture mode ?

I would sum up this saying that if they have mountains and are not flat sphere they have for sure the new texture mode.

#### Face

##### Well-known member
Orbiter Contributor
Beta Tester
i don't want to be any bottleneck here. I am about to leave with family for easter holidays and packing everything with 2 small daughters it's quite a challenge so I won't have much time available for about a week unfortunately.

No worries, I've thrown in a quick&dirty parser. If it turns out to be a good idea, you can always take a look over it and do a more stable parser for it, or perhaps also some in-simulation controls.

#### fred18

Donator
No worries, I've thrown in a quick&dirty parser. If it turns out to be a good idea, you can always take a look over it and do a more stable parser for it, or perhaps also some in-simulation controls.

Great.

Do you think that Jarmo and Kuddel will add this to the D3D9 until martin do it for the Beta or will you/us be forced to update the system in D3D9 at each release? or shall we take this as a demonstration and that's it?

#### Face

##### Well-known member
Orbiter Contributor
Beta Tester
Do you think that Jarmo and Kuddel will add this to the D3D9 until martin do it for the Beta or will you/us be forced to update the system in D3D9 at each release? or shall we take this as a demonstration and that's it?

I don't know. :shrug: I'll certainly keep it updated if it is not included, but I don't really care if it gets "official" or not.

At the glacial pace of Orbiter's core releases we could even afford to get the hooking updated. :lol:

---------- Post added at 23:04 ---------- Previous post was at 22:41 ----------

With the above posted client, you can do something like this to e.g. Brighton Beach:
/Textures/Moon/Flat/test.flt
Code:
Rect -3000 -33.4375 +41.125 2500 2500 0 50
Rect -2400 -33.4375 +41.125 1000 1000 45 50

This will give you this at the base there:

#### fred18

Donator
Code:
ELLIPSE <height> <lng> <lat> <major> <minor> <phi> <falloff>
or
RECT <height> <lng> <lat> <length> <width> <phi> <falloff>

* <height> is in meter, supposedly w.r.t. mean sphere radius
* <lng> <lat> are longitude and latitude coordinates, as defined in e.g. base configuration file
* <major> <minor> are ellipse major and minor radius in meter, <minor> defaults to <major> if not defined - the meter definition might not be exact, as it uses a decimal degree guess at the latitude circle
* <length> <width> are rectangle length and width in meter, <width> defaults to <length> if not defined - meter definition same as above
* <phi> is rotation angle in degree from equator, with <major> and <length> being parallel to equator
* <falloff> is the percentage of the shape radius where transparent merging with original height is done

Lines with comment start and/or too less arguments are ignored.

just the first quick and dirty feedbacks:

- I saw from the code that the "comments" are intended as per code // but I would add also the ";", since it is very common for text file inputs
- I'd add some orbiter.log entries when a flat area is parsed, so users will have a feedback if their line is read or not
- I tried on a random location and it work as expected, but then I tried to flatten the second runway of palmdale base and it didn't work. I haven't checked myself yet, but maybe palmdale use elev_mod and this is the root cause somehow?
- I will put down some code to get the rectangle corners coordiantes from your definitions (length, width, phi etc) and viceversa, since I'd want the option to use also the corners
- The falloff is an integer right? It seems to me from the code that it's an integer that is divided by 100 after parsed so 50% is 50 and not 0.5, correct?
- are multiple definitions per file allowed? so if I have a base I can put all the circles and rectangles there?

#### Face

##### Well-known member
Orbiter Contributor
Beta Tester
just the first quick and dirty feedbacks:
- I tried on a random location and it work as expected, but then I tried to flatten the second runway of palmdale base and it didn't work. I haven't checked myself yet, but maybe palmdale use elev_mod and this is the root cause somehow?
- The falloff is an integer right? It seems to me from the code that it's an integer that is divided by 100 after parsed so 50% is 50 and not 0.5, correct?
- are multiple definitions per file allowed? so if I have a base I can put all the circles and rectangles there?

* From what I have seen, the filtering should also trump the elev_mod data. It does so in the case of the cape, at least.
* The falloff is percent, right.
* Multiple definitions are allowed, as demonstrated by the pictures posted above.

#### fred18

Donator
* From what I have seen, the filtering should also trump the elev_mod data. It does so in the case of the cape, at least.

Then I don't know why the palmdale flattening is compeltely ignored.

basic test, a big square centered on te runway:
Code:
RECT 766.1 -118.072702 34.629199 5000 5000 0 10

#### Face

##### Well-known member
Orbiter Contributor
Beta Tester
Then I don't know why the palmdale flattening is compeltely ignored.

basic test, a big square centered on te runway:
Code:
RECT 766.1 -118.072702 34.629199 5000 5000 0 10

Height is integer, not floating point. It gets ignored because it is not parsed correctly.

#### fred18

Donator
Height is integer, not floating point. It gets ignored because it is not parsed correctly.

Ah yes, sorry! my fault. If I may, I am completely with you that 1 meter is more than enough as resolution but there will be tons of users that will complain that it doesn't work because they had put 0.34 centimeters difference... so if possible I'd switch it to float

On the left the second runway of Palmdale base as it is by default: super bumpy! and if you look around you'll see that also taxiways and everything around is bumpy.

On the right the result with a simple line of text file... a perfectly flat runway and sorroundings... it took 2 minutes to set it up...

Thanks Face for your implementation, this is huge!!!

Last edited:

#### kuddel

##### Donator
Donator
Very good proof-of-concept! :thumbup:
One question (I haven't found time to check for myself):
Can the patches overlap? So a "ring" could be made with:
Code:
// ELLIPSE <height> <lng> <lat> <major> [<minor>] [<phi>] [<falloff>]
ELLIPSE -2000 -33.4375 +41.125 2500
ELLIPSE -3000 -33.4375 +41.125 2000

Last edited:

#### fred18

Donator
Very good proof-of-concept! :thumbup:
One question (I haven't found time to check for myself):
Can the patches overlap? So a "ring" could be made with:
Code:
// ELLIPSE <height> <lng> <lat> <major> <minor> <phi> <falloff>
ELLIPSE -2000 -33.4375 +41.125 2500 2500
ELLIPSE -3000 -33.4375 +41.125 2000 2000

It seems to me that the example posted by face about brighton beach is precisely like that, so I'd say it's a go :thumbup:

#### Donamy

Donator
Beta Tester
Could this be made to work from scenario editor ?

---------- Post added at 11:31 PM ---------- Previous post was at 11:14 PM ----------

I click on the link and it open the file as gibberish.

---------- Post added 04-18-19 at 12:33 AM ---------- Previous post was 04-17-19 at 11:31 PM ----------

Got it working. Thanks

#### gattispilot

How did you get it working?

#### Donamy

Donator
Beta Tester
Far side of the moon.

#### Attachments

• FAr side of the moon.jpg
67.6 KB · Views: 51

#### Donamy

Donator
Beta Tester
Right click on the .dll and save link as. Thanks Fred

#### gattispilot

On save the D3D9Client.dll from post 64? And which folder does it go. It looks like you were able to change things also?

Replies
0
Views
280
Replies
4
Views
351
Replies
32
Views
1K
Replies
12
Views
2K