Png2Ter - Convert PNG file to Elevation Grid!

Note that alterations to the YSFlight .EXE is forbidden
Post Reply
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:

Png2Ter - Convert PNG file to Elevation Grid!

Post by Flake »

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!


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
Zack
Contributor
Contributor
Posts: 401
Joined: Wed Mar 21, 2012 10:34 pm
Favorite Aircraft: F-16C Fighting Falcon
Location: Northern California/Bay Area
OS: Windows 10
Has thanked: 47 times
Been thanked: 158 times

Re: Png2Ter - Convert PNG file to Elevation Grid!

Post by Zack »

Flake wrote: Wed Jun 21, 2017 8:54 amou 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
User avatar
Catraille
Newbie
Newbie
Posts: 16
Joined: Mon Aug 12, 2013 8:38 am
Favorite Aircraft: F-106
OS: Ubuntu, Arch Linux
Has thanked: 13 times
Been thanked: 29 times

Re: Png2Ter - Convert PNG file to Elevation Grid!

Post by Catraille »

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
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:

Re: Png2Ter - Convert PNG file to Elevation Grid!

Post by Flake »

That looks promising. I tried other programs already but never found this. Hopefully it's good!
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
u2fly
Senior Veteran
Senior Veteran
Posts: 1485
Joined: Fri Oct 02, 2015 9:27 am
Favorite Aircraft: Antonov An-225 Mriya
Location: Ukraine
OS: Linux
Has thanked: 1051 times
Been thanked: 339 times

Re: Png2Ter - Convert PNG file to Elevation Grid!

Post by u2fly »

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.

U.S. Senator John McCain wrote:“Spending #NewYearsEve w/ brave #Ukrainian Marines at a forward combat outpost
- we stand w/ them in their fight against #Putin's aggression”

pic.twitter.com/vkz0gdozVV [archived]
(31 DEC 2016)
User avatar
Barr
Veteran
Veteran
Posts: 1012
Joined: Wed Mar 28, 2012 8:49 pm
Favorite Aircraft: The Boeing 757
Location: Providence, Rhode Island
OS: Windows 10/Gentoo
Has thanked: 272 times
Been thanked: 206 times

Re: Png2Ter - Convert PNG file to Elevation Grid!

Post by Barr »

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.
Deleted User 1872

Re: Png2Ter - Convert PNG file to Elevation Grid!

Post by Deleted User 1872 »

u2fly wrote: Thu Jun 22, 2017 9:29 amOne 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
User avatar
Nodoka Hanamura
Veteran
Veteran
Posts: 947
Joined: Thu Apr 07, 2011 8:01 pm
Favorite Aircraft: Su-24, Mig-29, Su-27, F-18, F-15, ADF-01, Icon A5
OS: Windows 10 / Linux
Has thanked: 539 times
Been thanked: 276 times

Re: Png2Ter - Convert PNG file to Elevation Grid!

Post by Nodoka Hanamura »

Impressive. I can see it being used to import Heightmaps into YS sometime down the line.
█████████████████████████████████████████████████████████████████████
Member of YSCE Development Committee - I don't code, I compile.
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:

Re: Png2Ter - Convert PNG file to Elevation Grid!

Post by Flake »

Quoting OP wasn't necessary, removed...

Yeah that's sort of the goal actually.
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
Dragon_Mech
Veteran
Veteran
Posts: 571
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: 94 times
Been thanked: 127 times

Re: Png2Ter - Convert PNG file to Elevation Grid!

Post by Dragon_Mech »

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
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:

Re: Png2Ter - Convert PNG file to Elevation Grid!

Post by Welshy »

Flake will this work fine with DEM imported grayscales? If so this could be a game change!
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:

Re: Png2Ter - Convert PNG file to Elevation Grid!

Post by Flake »

It measures based on the luminosity value of the pixel. Greyscale is what I personally use.
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:

Re: Png2Ter - Convert PNG file to Elevation Grid!

Post by Welshy »

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
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!
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests