Png2Ter - Convert PNG file to Elevation Grid!

Note that alterations to the YSFlight .EXE is forbidden
Post Reply
User avatar
Flake
Staff
Staff
Posts: 4059
Joined: Thu Feb 10, 2011 8:47 pm
Favorite Aircraft: Honda CBR600RR. Shit I mean Boeing F/A-18A.
Location: Newcastle, Australia
OS: Windows 10 (x64)
Has thanked: 716 times
Been thanked: 978 times

Png2Ter - Convert PNG file to Elevation Grid!

Post by Flake » Wed Jun 21, 2017 8:54 am

Png2Ter v1.0

Image
About
Similar to Grigors AutoHotKey based elevation grid generator, this program converts a greyscale PNG to a YSFlight Elevation Grid file (TER). This program does NOT use AHK and only relies on .NET 3.5, so users of WinXP+ should be able to use this program without issue!

Instructions
  1. BACK UP YOUR CURRENT FLD FILE! I am NOT responsible if this program breaks and you lose ALL your work! You've been warned!
  2. Draw a Grid Plan PNG file in such a way that a 0% brightness pixel, that is #000000 would be elevation 0 meters and a 100% brightness pixel, that is #FFFFFF would be the maximum height of the grid. See included Example folder for a demo of this.
  3. Open Png2Ter and set the desired parameters, this may require some experimentation on your part!
  4. DRAG AND DROP your PNG representation of the desired elevation grid onto the program, it will generate the grid for you.
  5. Import generated grid into SceneryEditor, set Zero Elevation Faces to be invisible, and apply color gradation as desired.
  6. Save your new FLD - You're done!
Notes
Please adjust colors, face visibility etc. in Scenery editor!

Also note grids are quite large - you should make many small grids rather than one large grid, so please use multiple PNG files of each mountain rather than blobs of mountains!


Image

User avatar
Zack
Staff
Staff
Posts: 387
Joined: Wed Mar 21, 2012 10:34 pm
Favorite Aircraft: F-16C Fighting Falcon
Location: Northern California/Bay Area
OS: Windows 10
Has thanked: 39 times
Been thanked: 143 times

Re: Png2Ter - Convert PNG file to Elevation Grid!

Post by Zack » Wed Jun 21, 2017 9:41 am

Flake wrote:
Wed Jun 21, 2017 8:54 am
ou should make many small grids rather than one large grid, so please use multiple PNG files of each mountain rather than blobs of mountains!
You can't tell me what to do! :lol:

Great work flake, you're making me want to do maps more often now! Thanks for this. :D
Image

User avatar
Catraille
Newbie
Newbie
Posts: 16
Joined: Mon Aug 12, 2013 8:38 am
Favorite Aircraft: F-106
OS: OSX 10.10, Fedora 25
Has thanked: 12 times
Been thanked: 26 times

Re: Png2Ter - Convert PNG file to Elevation Grid!

Post by Catraille » Wed Jun 21, 2017 11:26 pm

I'm just a random passerby, but if anybody around here is interested in creating a .ter of real location, QGIS might help you make a grayscale height image.
http://qgis.org

Tutorials can be found here:
http://johnflower.org/tutorial/getting-height-maps-qgis
http://johnflower.org/tutorial/export-h ... t-composer

Note: I can't test whether the method described in the site above works (I'm a Mac user, so I can't run this program. I hope I could!), so just take it as a random idea. If this method doesn't work please tell me. I will delete this post.
ImageImage

User avatar
Flake
Staff
Staff
Posts: 4059
Joined: Thu Feb 10, 2011 8:47 pm
Favorite Aircraft: Honda CBR600RR. Shit I mean Boeing F/A-18A.
Location: Newcastle, Australia
OS: Windows 10 (x64)
Has thanked: 716 times
Been thanked: 978 times

Re: Png2Ter - Convert PNG file to Elevation Grid!

Post by Flake » Wed Jun 21, 2017 11:40 pm

That looks promising. I tried other programs already but never found this. Hopefully it's good!
Image

User avatar
u2fly
Veteran
Veteran
Posts: 1125
Joined: Fri Oct 02, 2015 9:27 am
Favorite Aircraft: Antonov An-225 Mriya
Location: Ukraine
OS: Linux
Has thanked: 590 times
Been thanked: 248 times
Contact:

Re: Png2Ter - Convert PNG file to Elevation Grid!

Post by u2fly » Thu Jun 22, 2017 9:29 am

There are many ways how do same task in Blender - https://www.versluis.com/2017/06/how-to ... n-blender/
One issue that not solved for do it usable for Blender - there no scripts for export terrain mesh to TER-file for YSFlight.
I will try make this script for both YSFS 1.x (for Blender 2.49b) and YSFS 2.x (for Blender 2.7X) add-ons as soon as possible.
/!\ READ YSFLIGHT HANDBOOK (.PDF) | updated 2017/05/03

“Spending #NewYearsEve w/ brave #Ukrainian Marines at a forward combat outpost - we stand w/ them in their fight against #Putin's aggression”
http://pic.twitter.com/vkz0gdozVV
- John McCain, U.S. Senator for Arizona, Republican party
(31 DEC 2016)

User avatar
Granny Apple Smith
Veteran
Veteran
Posts: 985
Joined: Wed Mar 28, 2012 8:49 pm
Favorite Aircraft: The Boeing 757
Location: Providence, Rhode Island
OS: Windows 10/Gentoo
Has thanked: 245 times
Been thanked: 194 times

Re: Png2Ter - Convert PNG file to Elevation Grid!

Post by Granny Apple Smith » Thu Jun 22, 2017 10:07 am

You could also rewrite this to make a png2fld or pc2 ;)
Image
Beginner ATC for hire!
Current Projects:
-Pilatus PC12
-Mooney M20
-New England Scenery
Fine Print:
**Word of Caution**
My knowledge is limited. Anything I write in my posts may or may not be accurate. To be honest I think its all crap.

User avatar
Kujo
Veteran
Veteran
Posts: 934
Joined: Fri Feb 08, 2013 2:28 am
Favorite Aircraft: Lockheed Martin F-16 Fighting Falcon
Location: Nice Try, NSA
OS: Windows 8.1 - 64 Bit
Has thanked: 651 times
Been thanked: 591 times
Contact:

Re: Png2Ter - Convert PNG file to Elevation Grid!

Post by Kujo » Thu Jun 22, 2017 11:36 pm

u2fly wrote:
Thu Jun 22, 2017 9:29 am
One issue that not solved for do it usable for Blender - there no scripts for export terrain mesh to TER-file for YSFlight. I will try make this script for both YSFS 1.x (for Blender 2.49b) and YSFS 2.x (for Blender 2.7X) add-ons as soon as possible.
Hey, making this would actually be a serious improvement and advancement in making scenery. I'd want to try it out once it's done
Image

User avatar
Nodoka Hanamura
Veteran
Veteran
Posts: 906
Joined: Thu Apr 07, 2011 8:01 pm
Favorite Aircraft: Su-24, Mig-29, Su-27, F-18, F-15, ADF-01, Icon A5
Has thanked: 505 times
Been thanked: 259 times

Re: Png2Ter - Convert PNG file to Elevation Grid!

Post by Nodoka Hanamura » Thu Jun 22, 2017 11:38 pm

Impressive. I can see it being used to import Heightmaps into YS sometime down the line.
Image

User avatar
Flake
Staff
Staff
Posts: 4059
Joined: Thu Feb 10, 2011 8:47 pm
Favorite Aircraft: Honda CBR600RR. Shit I mean Boeing F/A-18A.
Location: Newcastle, Australia
OS: Windows 10 (x64)
Has thanked: 716 times
Been thanked: 978 times

Re: Png2Ter - Convert PNG file to Elevation Grid!

Post by Flake » Fri Jun 23, 2017 6:10 am

Quoting OP wasn't necessary, removed...

Yeah that's sort of the goal actually.
Image

User avatar
Dragon_Mech
Veteran
Veteran
Posts: 565
Joined: Wed Jul 15, 2015 12:18 pm
Favorite Aircraft: F-14, F-15D&E, SR-71, King Air 200, B737
Location: Mansfield, Mo. USA
OS: Windows 7 Ultimate
Has thanked: 91 times
Been thanked: 126 times

Re: Png2Ter - Convert PNG file to Elevation Grid!

Post by Dragon_Mech » Sun Jun 25, 2017 9:49 am

this could be very helpful in making canyon maps and setting most of the foundation work for tunnels and caverns. i may have to learn to make maps and play with this.
Owner, Dragonic Machine Industries
Image

User avatar
Welshy
CVW-171
CVW-171
Posts: 1723
Joined: Thu Feb 24, 2011 4:53 pm
Favorite Aircraft: Sea Harrier FA2
Location: FALKLANDS/GIBRALTAR FTW
OS: Windows Server
Has thanked: 92 times
Been thanked: 58 times
Contact:

Re: Png2Ter - Convert PNG file to Elevation Grid!

Post by Welshy » Sun Jul 16, 2017 1:19 pm

Flake will this work fine with DEM imported grayscales? If so this could be a game change!

VMFA-125 Officer Commanding of the 171st CVW

Formerly Officer Commanding 323rd Expeditionary Air Wing

User avatar
Flake
Staff
Staff
Posts: 4059
Joined: Thu Feb 10, 2011 8:47 pm
Favorite Aircraft: Honda CBR600RR. Shit I mean Boeing F/A-18A.
Location: Newcastle, Australia
OS: Windows 10 (x64)
Has thanked: 716 times
Been thanked: 978 times

Re: Png2Ter - Convert PNG file to Elevation Grid!

Post by Flake » Sun Jul 16, 2017 1:41 pm

It measures based on the luminosity value of the pixel. Greyscale is what I personally use.
Image

User avatar
Welshy
CVW-171
CVW-171
Posts: 1723
Joined: Thu Feb 24, 2011 4:53 pm
Favorite Aircraft: Sea Harrier FA2
Location: FALKLANDS/GIBRALTAR FTW
OS: Windows Server
Has thanked: 92 times
Been thanked: 58 times
Contact:

Re: Png2Ter - Convert PNG file to Elevation Grid!

Post by Welshy » Sun Jul 16, 2017 2:48 pm

This therefore means real world Digital Elevation models can be used. As a note to all scenery devs, NASA distributes files of the earths terrain which can be broken down and converted to TIFFs easily which then converting to grayscale PNGs will be perfect

VMFA-125 Officer Commanding of the 171st CVW

Formerly Officer Commanding 323rd Expeditionary Air Wing

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests