Elevation Grid Generator

Note that alterations to the YSFlight .EXE is forbidden
User avatar
Grigor
Contributor
Contributor
Posts: 171
Joined: Wed Mar 16, 2011 7:57 am
Has thanked: 24 times
Been thanked: 95 times

Elevation Grid Generator

Post by Grigor » Wed Nov 05, 2014 4:59 am

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 91 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 77 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: 3188
Joined: Sun Feb 06, 2011 6:17 pm
Favorite Aircraft: Any thing with a prop.
Location: New Iberia.LA.
OS: Windows XP SP3
Has thanked: 539 times
Been thanked: 682 times

Re: Elevation Grid Generator

Post by Gunny » Wed Nov 05, 2014 5:17 am

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: 84 times
Contact:

Re: Elevation Grid Generator

Post by Dragon029 » Wed Nov 05, 2014 11:26 am

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?
Royal Australian Air Force
Per Ardua Ad Astra
>>> Dragon Addon Pack <<<
(PAK-FA, F/A-52, F/A-36, MQ-21)

User avatar
Grigor
Contributor
Contributor
Posts: 171
Joined: Wed Mar 16, 2011 7:57 am
Has thanked: 24 times
Been thanked: 95 times

Re: Elevation Grid Generator

Post by Grigor » Wed Nov 05, 2014 7:02 pm

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: 3188
Joined: Sun Feb 06, 2011 6:17 pm
Favorite Aircraft: Any thing with a prop.
Location: New Iberia.LA.
OS: Windows XP SP3
Has thanked: 539 times
Been thanked: 682 times

Re: Elevation Grid Generator

Post by Gunny » Wed Nov 05, 2014 8:09 pm

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]

User avatar
Grigor
Contributor
Contributor
Posts: 171
Joined: Wed Mar 16, 2011 7:57 am
Has thanked: 24 times
Been thanked: 95 times

Re: Elevation Grid Generator

Post by Grigor » Thu Nov 06, 2014 1:52 am

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: 84 times
Contact:

Re: Elevation Grid Generator

Post by Dragon029 » Thu Nov 06, 2014 3:27 am

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.
Royal Australian Air Force
Per Ardua Ad Astra
>>> Dragon Addon Pack <<<
(PAK-FA, F/A-52, F/A-36, MQ-21)

User avatar
Grigor
Contributor
Contributor
Posts: 171
Joined: Wed Mar 16, 2011 7:57 am
Has thanked: 24 times
Been thanked: 95 times

Re: Elevation Grid Generator

Post by Grigor » Thu Nov 06, 2014 10:44 am

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 » Wed Apr 01, 2015 9:34 am

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 » Wed Apr 01, 2015 9:45 am

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 » Wed Apr 01, 2015 4:25 pm

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 » Wed Apr 01, 2015 4:54 pm

If i need a precise measure grid, for example 20 km in the scenery editor, how can i do?

User avatar
Flake
Staff
Staff
Posts: 4236
Joined: Thu Feb 10, 2011 8:47 pm
Favorite Aircraft: Honda CBR1000RR (2004).
Location: Australia
OS: Windows 10 (x64)
Has thanked: 800 times
Been thanked: 1119 times
Contact:

Elevation Grid Generator

Post by Flake » Sun Apr 26, 2015 10:29 am

Bump. How do I change the size of the imported grid in Scenery Editor? It's way too small!

User avatar
waspe414
Veteran
Veteran
Posts: 1148
Joined: Thu Feb 10, 2011 9:35 pm
Favorite Aircraft: CH-136 Kiowa
Location: Canada
Has thanked: 94 times
Been thanked: 157 times

Elevation Grid Generator

Post by waspe414 » Sun Apr 26, 2015 7:42 pm

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
Staff
Staff
Posts: 4236
Joined: Thu Feb 10, 2011 8:47 pm
Favorite Aircraft: Honda CBR1000RR (2004).
Location: Australia
OS: Windows 10 (x64)
Has thanked: 800 times
Been thanked: 1119 times
Contact:

Elevation Grid Generator

Post by Flake » Mon Apr 27, 2015 1:52 am

Cheers bruv. Manual edit appears the go.

User avatar
Welshy
Staff
Staff
Posts: 1873
Joined: Thu Feb 24, 2011 4:53 pm
Favorite Aircraft: AgustaWestland AW189
Location: Chepstow, Old South Wales
OS: Windows 10
Has thanked: 184 times
Been thanked: 161 times
Contact:

Elevation Grid Generator

Post by Welshy » Mon Apr 27, 2015 7:34 am

Did I just hear Flake talking like a chav?

YSFHQ Elected Admin
Officer Commanding VMFA-125 (CVW-171)

If you see me post like this in a thread pay attention!
Image

User avatar
Flake
Staff
Staff
Posts: 4236
Joined: Thu Feb 10, 2011 8:47 pm
Favorite Aircraft: Honda CBR1000RR (2004).
Location: Australia
OS: Windows 10 (x64)
Has thanked: 800 times
Been thanked: 1119 times
Contact:

Elevation Grid Generator

Post by Flake » Mon Apr 27, 2015 8:31 am


User avatar
decaff_42
First Class Membership
First Class Membership
Posts: 3403
Joined: Sat Oct 29, 2011 7:23 pm
Favorite Aircraft: SR-71 Blackbird
Location: Eastern United States
OS: Mac OSX
Has thanked: 532 times
Been thanked: 1179 times
Contact:

Elevation Grid Generator

Post by decaff_42 » Mon Apr 27, 2015 4:25 pm

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 by Bitbucket page for Python codes: https://bitbucket.org/decaff42/

Feel free to ask me a question! I'll try to answer it as well as I can or recommend a more knowledgeable member if necessary.

User avatar
decaff_42
First Class Membership
First Class Membership
Posts: 3403
Joined: Sat Oct 29, 2011 7:23 pm
Favorite Aircraft: SR-71 Blackbird
Location: Eastern United States
OS: Mac OSX
Has thanked: 532 times
Been thanked: 1179 times
Contact:

Elevation Grid Generator

Post by decaff_42 » Tue Apr 28, 2015 4:59 pm

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 by Bitbucket page for Python codes: https://bitbucket.org/decaff42/

Feel free to ask me a question! I'll try to answer it as well as I can or recommend a more knowledgeable member if necessary.

User avatar
Flake
Staff
Staff
Posts: 4236
Joined: Thu Feb 10, 2011 8:47 pm
Favorite Aircraft: Honda CBR1000RR (2004).
Location: Australia
OS: Windows 10 (x64)
Has thanked: 800 times
Been thanked: 1119 times
Contact:

Elevation Grid Generator

Post by Flake » Tue May 05, 2015 12:31 pm

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.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest