Elevation Grid Generator

Note that alterations to the YSFlight .EXE is forbidden
Grigor
Contributor
Contributor
Posts: 201
Joined: Wed Mar 16, 2011 7:57 am
Favorite Aircraft: Ball-Bartoe Jetwing
OS: Windows XP
Has thanked: 58 times
Been thanked: 122 times

Elevation Grid Generator

Post by Grigor »

This program generates ELEVATION GRIDS for YS Flight Scenery Files from GREYSCALE bitmaps.

1) Run the program from wherever you like - no installation necessary.
2) A file menu will ask for a bitmap filename.
3) Enter the grid size - number of segments is generated automatically from the bitmap file.
4) Enter the height amplification, if desired.
5) Enter a filename, if desired.
6) Press the "Do it!" button and a file will be generated containing the elevation grid.

From there you can use the Scenery Editor to apply finishing touches.

- I recommend using landscape rather than portrait format, or better still plain square.
- Colour images will work, though not as accurately.
- Also included is the AutoHotkey Script, if you would like to tinker with the code.

Enjoy the scenery!

Grigor.
Elevation Grid Generator0.1.zip
(409.47 KiB) Downloaded 494 times
(Added gradient colour selection and fixed output filename error... Also fixed the default sky and ground colours.)
Attachments
Elevation Grid Generator.zip
(400.82 KiB) Downloaded 517 times
Last edited by Grigor on Thu Nov 06, 2014 1:53 am, edited 3 times in total.
User avatar
Gunny
Business Class Membership
Business Class Membership
Posts: 3250
Joined: Sun Feb 06, 2011 6:17 pm
Favorite Aircraft: Any thing with a prop.
Location: New Iberia.LA.
OS: Windows 10 & XP SP3
Has thanked: 586 times
Been thanked: 786 times

Re: Elevation Grid Generator

Post by Gunny »

Now this could be revolutionary in a manner of speaking;}}}} Thanks Grigor
Image[/align=centre]
User avatar
Dragon029
Veteran
Veteran
Posts: 601
Joined: Sun Feb 06, 2011 6:09 am
Favorite Aircraft: F-35A
Location: Australia
Has thanked: 42 times
Been thanked: 85 times
Contact:

Re: Elevation Grid Generator

Post by Dragon029 »

This is great; how well does it run as the image sizes get larger; or rather, what's the largest bitmap you've tried it with?
Per Ardua Ad Astra
>>> Dragon Addon Pack <<<
(PAK-FA, F/A-52, F/A-36, MQ-21)
Grigor
Contributor
Contributor
Posts: 201
Joined: Wed Mar 16, 2011 7:57 am
Favorite Aircraft: Ball-Bartoe Jetwing
OS: Windows XP
Has thanked: 58 times
Been thanked: 122 times

Re: Elevation Grid Generator

Post by Grigor »

I've just tried out a 320 x 250, and it works OK... I guess the only limit would be how much graphics data your machine can handle.

Even Testmap_1.bmp at 60x60 pixels, with a grid size of 400 x 330 makes for spectacular scenery and fun flying.

I've always been a little nonplussed at the flatness of most YS landscapes... even just a small variation of low rolling hills makes a difference. Of course, I do most of my flying at treetop level, so...
User avatar
Gunny
Business Class Membership
Business Class Membership
Posts: 3250
Joined: Sun Feb 06, 2011 6:17 pm
Favorite Aircraft: Any thing with a prop.
Location: New Iberia.LA.
OS: Windows 10 & XP SP3
Has thanked: 586 times
Been thanked: 786 times

Re: Elevation Grid Generator

Post by Gunny »

It works great but I would suggest that you keep the grids small.Since it is for the purpose of scenery editor just a big collection of polygons.I tried a 1000x1000x300 and holy cow the visuals where great but the lag was unacceptable for my old xp machine and the crap for graphics intell processor.Those of you with REAL graphics processors I am sure will get much better results.And if you where thinking of large expanses of rolling hills I would not suggest it.But still it will make the elevation grid process just that much easier to deal with as long as you use it frugally.Thanks again Grigor.
Image[/align=centre]
Grigor
Contributor
Contributor
Posts: 201
Joined: Wed Mar 16, 2011 7:57 am
Favorite Aircraft: Ball-Bartoe Jetwing
OS: Windows XP
Has thanked: 58 times
Been thanked: 122 times

Re: Elevation Grid Generator

Post by Grigor »

I tried out a 256 x 256 bitmap and even that was too much for my old XP machine... 120 squared works. Take a look at Testmap_3.bmp in the updated download.
User avatar
Dragon029
Veteran
Veteran
Posts: 601
Joined: Sun Feb 06, 2011 6:09 am
Favorite Aircraft: F-35A
Location: Australia
Has thanked: 42 times
Been thanked: 85 times
Contact:

Re: Elevation Grid Generator

Post by Dragon029 »

Yeah, the reason I asked originally was because I got curious after seeing the 60x60 bitmaps and so I tried a bitmap with 500x500; I let it run for about 3-5 minutes and then decided it was either going to take a very long time or it might maybe have become frozen (memory usage was only climbing maybe 2kb every ~10 seconds; which is probably reasonable considering the file sizes we're working with). I guess my two recommendations if you get the time would be to add a % complete bar (I'm not sure what metric you would use though; maybe % of pixels processed?) and second, (if possible) I'd recommend having the bitmap not stay on your screen while processing, that way larger bitmaps can still be used, with the program just running in the background.
Per Ardua Ad Astra
>>> Dragon Addon Pack <<<
(PAK-FA, F/A-52, F/A-36, MQ-21)
Grigor
Contributor
Contributor
Posts: 201
Joined: Wed Mar 16, 2011 7:57 am
Favorite Aircraft: Ball-Bartoe Jetwing
OS: Windows XP
Has thanked: 58 times
Been thanked: 122 times

Re: Elevation Grid Generator

Post by Grigor »

Yeah... the bitmap needs to be on screen - I could move it to the top left - but that's the clunky way the program reads the value of each pixel. As for a progress bar, I'm not sure whether that would just slow it down further. Perhaps we'll just recommend not using anything bigger than say 150x150 pixels... that only takes a second to scan.
Freki79
Newbie
Newbie
Posts: 9
Joined: Mon Dec 17, 2012 11:32 am
Favorite Aircraft: F-16

Elevation Grid Generator

Post by Freki79 »

Did you try any bigger resolution?
Things like this are nice! :P (just experiments)
I should only be able to obtain ocean elevation faces to zero elevation, or zero slope at least, anf then hide them. I hate to see grids disappear when i fly high on them, is there a way to fix the distance to which ys flight draw the grids?
Attachments
Screenshot - 01_04_2015 , 11.33.png
Freki79
Newbie
Newbie
Posts: 9
Joined: Mon Dec 17, 2012 11:32 am
Favorite Aircraft: F-16

Elevation Grid Generator

Post by Freki79 »

This is better, sorry. Those pikes should have been rolling hills in my intention though, and water more spreaded.
Attachments
Screenshot - 01_04_2015 , 11.41.png
Stingx
Veteran
Veteran
Posts: 583
Joined: Tue Dec 04, 2012 4:31 am
Favorite Aircraft: ufo
Has thanked: 2 times
Been thanked: 27 times

Elevation Grid Generator

Post by Stingx »

Yasss. I wish we could have things like this and fractal scenery put in maps. I hope Soji's figured that gen thing.
Freki79
Newbie
Newbie
Posts: 9
Joined: Mon Dec 17, 2012 11:32 am
Favorite Aircraft: F-16

Elevation Grid Generator

Post by Freki79 »

If i need a precise measure grid, for example 20 km in the scenery editor, how can i do?
User avatar
Flake
VFA-49
VFA-49
Posts: 4375
Joined: Thu Feb 10, 2011 8:47 pm
Favorite Aircraft: Boeing F/A-18A
Location: Australia
OS: Windows 10 (x64)
Has thanked: 861 times
Been thanked: 1279 times
Contact:

Elevation Grid Generator

Post by Flake »

Bump. How do I change the size of the imported grid in Scenery Editor? It's way too small!
I am an accountant working full-time (and some). I'm not here as often as I would like to be. Send a message if you need me. There are a few people in the community who can get in contact with me urgently if you need - don't be afraid to ask. I just don't check here as frequently as I used to. Sorry!
User avatar
waspe414
Staff
Staff
Posts: 1581
Joined: Thu Feb 10, 2011 9:35 pm
Favorite Aircraft: Kiowa, Mitten, Hornet
Location: Canada
Has thanked: 154 times
Been thanked: 506 times

Elevation Grid Generator

Post by waspe414 »

I can't recall any option in Scenedit to scale things, nor did I find one in a quick search.
You can do it by editing the .ter file, though the vertical scaling is a little involved.
TerrMesh
NBL 2 2
TMS 85.31 70.99
BLO 0.00 L 1 0 0 255 1 0 0 255
BLO 0.00 R 1 0 0 255 1 0 0 255
BLO 0.00
BLO 0.00 R 1 0 0 255 1 0 0 255
BLO 33.57 L 1 0 0 255 1 0 0 255
BLO 0.00
BLO 0.00
BLO 0.00
BLO 0.00
END
NBL specifies subdivisions on both axes, which affects the number of BLO sections. Unspecified BLO sections will be hidden zero elevation faces.
TMS defines the length and width in meters.
I wrote down exactly what the BLO lines meant somewhere else, but the first number, before the L or R, is that point's height.

Changing the horizontal scaling is easy. Changing the vertical scaling requires modifying each BLO line input.
Actual UltraViolet
Image Image
Image
I stole your turnip. Now you must come and defend your honour. ~ Hank Green
User avatar
Flake
VFA-49
VFA-49
Posts: 4375
Joined: Thu Feb 10, 2011 8:47 pm
Favorite Aircraft: Boeing F/A-18A
Location: Australia
OS: Windows 10 (x64)
Has thanked: 861 times
Been thanked: 1279 times
Contact:

Elevation Grid Generator

Post by Flake »

Cheers bruv. Manual edit appears the go.
I am an accountant working full-time (and some). I'm not here as often as I would like to be. Send a message if you need me. There are a few people in the community who can get in contact with me urgently if you need - don't be afraid to ask. I just don't check here as frequently as I used to. Sorry!
User avatar
Welshy
Staff
Staff
Posts: 2042
Joined: Thu Feb 24, 2011 4:53 pm
Favorite Aircraft: Sea Jet
Location: Wales
OS: Windows NT
Has thanked: 249 times
Been thanked: 254 times
Contact:

Elevation Grid Generator

Post by Welshy »

Did I just hear Flake talking like a chav?
YSFHQ Elected Overlord
Overlord of VMFA-125 (CVW-171)
Previously Supreme Overlord of 323rd CAW
Friendly Neighbourhood Miscreant
Head Honcho at Talking Aero and British Defence
If you see me post like this in a thread pay attention!
User avatar
Flake
VFA-49
VFA-49
Posts: 4375
Joined: Thu Feb 10, 2011 8:47 pm
Favorite Aircraft: Boeing F/A-18A
Location: Australia
OS: Windows 10 (x64)
Has thanked: 861 times
Been thanked: 1279 times
Contact:

Elevation Grid Generator

Post by Flake »

I am an accountant working full-time (and some). I'm not here as often as I would like to be. Send a message if you need me. There are a few people in the community who can get in contact with me urgently if you need - don't be afraid to ask. I just don't check here as frequently as I used to. Sorry!
User avatar
decaff_42
Staff
Staff
Posts: 3838
Joined: Sat Oct 29, 2011 7:23 pm
Favorite Aircraft: SR-71 Blackbird
Location: Eastern United States
OS: Mac OSX
Has thanked: 844 times
Been thanked: 1726 times
Contact:

Elevation Grid Generator

Post by decaff_42 »

I could probably whip up an excel tool to do this task. Gimmie a week or so. I remember that I built an excel tool to create elevation grids. I'm not sure if I released it. If I haven't I will tack on this feature and give it a whirl...that is if I can find it on my HD
Check out my website YSDecaff for all my tutorials and addon releases.
Visit my GitHub page for Python codes: https://github.com/decaff42?tab=repositories

YSFlight Addon Database - Find links to nearly every addon made for YSFlight!
Submit Addon To Database
User avatar
decaff_42
Staff
Staff
Posts: 3838
Joined: Sat Oct 29, 2011 7:23 pm
Favorite Aircraft: SR-71 Blackbird
Location: Eastern United States
OS: Mac OSX
Has thanked: 844 times
Been thanked: 1726 times
Contact:

Elevation Grid Generator

Post by decaff_42 »

Okay, I think I have the code working properly now. It can only handle 30x50 node elevation grids, but it should work alright.
If someone is willing to test it on a windows machine, that would be helpful! :D I'll PM you a link.
Screen shot 2015-04-28 at 12.56.42 PM.png
Here is my test elevation grid imported into Scenery Editor.

I cannot handle colors very well, but that is pretty much the easiest step to do in Scenery Editor. Making the node elevations is the harder part.

You can now import and scale an elevation grid in the x,y, and z directions. :D
Check out my website YSDecaff for all my tutorials and addon releases.
Visit my GitHub page for Python codes: https://github.com/decaff42?tab=repositories

YSFlight Addon Database - Find links to nearly every addon made for YSFlight!
Submit Addon To Database
User avatar
Flake
VFA-49
VFA-49
Posts: 4375
Joined: Thu Feb 10, 2011 8:47 pm
Favorite Aircraft: Boeing F/A-18A
Location: Australia
OS: Windows 10 (x64)
Has thanked: 861 times
Been thanked: 1279 times
Contact:

Elevation Grid Generator

Post by Flake »

Okie doke, quick tut from me:
Also notes:

Develop a terrain map bmp file - you can photoshop one or whatever you are happy with.

0,0,0 Black is NO elevation at all. 255,255,255 is maximum elevation.

Whatever size you save the bmp as is the size of the grid in subdivisions - so 50*50 pixels is a good size but 200+px is overkill.

Now, if you are me and use win 7: Set the compatability for the program to: Run Win XP SP3, Disable visual themes, Disable desktop composition, Run as admin.

Launch the program and choose the height amplification and terrain size - Size of grid is distance X/Y in meters. Height amplification is the 255m * amplification for each pixel - so if a pixel is perfect white and amplification is 1, it should be 255m above ground, the generated node.

Generate the grid and it should create a new field.

In Scenery Editor (latest test I use...)

File,Import,Scenery... Load the field.

I like to move the grid out of the child scenery and into the root so... Alt+SC, select the grid, Alt+ETR (grid goes to root), Alt+SS (To select the scenery) Select the scenery, ALT+EDS (Delete the scenery). Now you can alt+SC the grid again, then ALT+OVHZ to hide zero elvation faces, then just move and place to suit (ALT+EVI / ALT+ERI) then finally set the gradation color.

Save the field, load and test in YSF - should be all good.

EDIT: Bump.
I am an accountant working full-time (and some). I'm not here as often as I would like to be. Send a message if you need me. There are a few people in the community who can get in contact with me urgently if you need - don't be afraid to ask. I just don't check here as frequently as I used to. Sorry!
Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests