# TMF tools

## Recommended Posts

Hi George.I've reposted my TMF calculator with the corrections:You are right, the LOD13x is 0-7 and LOD13xx is 0-3, with LOD13y is 0-31. ( Those terms correspond to Christian Stock's subrow, subsubrow, and subcolumn ). 0, 0, 0 = the northwest corner of the LOD8 group area.The numbering of the LOD13 points is 0-255 X 0-255, as we suspected.I'm going to experiment with the calculations for the decal polygons, as I'm not sure of my math... it's a point in a 8192 X 8192 LOD8 grid, offset by 4056 in the "X" value and 4072 in the "Y" value( I think ). Christian said it was offset by 4080, and ranged from 4080 to 12240 ( for 8160 points each way ) ? So either he's right, I'm right, or neither of us is right. :-lolGetting the math right on the polygon placement will be important. Also, switch #3 of the data structure is a tranparency switch according to Christian. I'm going to play with thatI like your tool.

#### Share this post

##### Share on other sites
 Help AVSIM continue to serve you!Please donate today!

You may be right. I played with these values, and found that I couldn't see any change with 4080 and 12240. (I used top view and placed the plane/cross on the edges and found those values). I'm not sure if these values differ regionally, nor where these values come from. My values are found with experiments, I can't explain them...One thing I never understood is how LOD works in the first place. It seems the LOD quadrant stay constant over the earth, although they are mapped on a globe. This means the textures at the equator most be bloated and really compressed at the poles (never checked for that).I'd be interested if someone can put this all together...Yes, I'm reading the post here still sometimes :)Cheers, Christian

#### Share this post

##### Share on other sites

Hi friends.Christian. nice to c u too....I checked the calculator and it is fine.I will upload a newer version as I found a small bug. It gives out all the numbers, including the x/y offsets of a point on the LOD13 quad.I used slew mode, got the points in fs and it worked.I have also made the first lake (real one thanks to u guys) by creating a polygon (with as many sides as you like )in gmax.As Christian said, the problem is when it overlaps two or more different LOD13 quads.I'm working on it.I'll write some quick notes on how to do it so you can check it.It's really nice since it produces code you just compile.C u later guys.George

#### Share this post

##### Share on other sites

One question:The fs2000 sdk defines the span in meters and the samples distance of the different LOD quads.Isn't this wrong ?In my mind, the horizontal span in meters of any quad, depends on it's latitude. On the equator should be maximum decreasing as you go north or south.Do I get something wrong here or it's just another example of perfect documentation ?? :-)CheersGeorge

#### Share this post

##### Share on other sites

Hi George and Christian.The span in meters should be for the equator only... the W-E span would have to shrink as it moves towards a pole. N-S span should stay the same. So, a lake 2000 meters long is difficult to size as you move away from the equator, if based on pixels!Christian! Hello!I made a slight change in your macro as follows:TEXTURE_DATA MACRO number, unknown, type, size LOCAL number_start, number_endnumber_start LABEL BYTE DB numbernumber_end LABEL BYTE; IF NOT ( ( OFFSET number_end ) - ( OFFSET number_start ) ) EQ 4; %OUT texture number has wrong length!; .ERR; ENDIF DB unknown DB type DB size ENDMNote that I commented out the length check of the Texture number... That now allows this: TEXTURE_GROUP texture_data, texture_start_0, texture_end_0texture_data label wordtexture_start_0 label word; TEXTURE_DATA "1206", 0, 1, 4 ; [Texture.1206] // Tan Sand Beach Park TEXTURE_DATA "056b2su6.bmp", 0, 1, 4texture_end_0 label word:-eek Yes. You can now have a texture named to the polygon. It probably won't change with the seasons, but can be unique, and reside in a local or global texture folder... here we go again!:-lol

#### Share this post

##### Share on other sites

Hi George. I think I have the decal poly math.; TERRAIN DECALS DATAdecal_data label worddata_start_0 label word DECAL_DATA 1, 0, 0, 0, 1, 0, 0 DECAL_GEOMETRY 1, DECAL_POLYGON, 1, 0 DECAL_POINTS 4 DECAL_POINT 0 + 4096 - 40 , 0 + 4096 - 24 DECAL_POINT 0 + 4096 - 40 , 255 + 4096 - 24 DECAL_POINT 255 + 4096 - 40 , 255 + 4096 - 24 DECAL_POINT 255 + 4096 - 40 , 0 + 4096 - 24 DECAL_DATA 1, 7, 3, 31, 1, 0, 0 DECAL_GEOMETRY 1, DECAL_POLYGON, 1, 0 DECAL_POINTS 4 DECAL_POINT 0 + ( ( ( 7 * 4 ) + 3 ) * 256 ) + 4096 - 40, 0 + ( 31 * 256 ) + 4096 - 24 DECAL_POINT 0 + ( ( ( 7 * 4 ) + 3 ) * 256 ) + 4096 - 40, 255 + ( 31 * 256 ) + 4096 - 24 DECAL_POINT 255 + ( ( ( 7 * 4 ) + 3 ) * 256 ) + 4096 - 40, 255 + ( 31 * 256 ) + 4096 - 24 DECAL_POINT 255 + ( ( ( 7 * 4 ) + 3 ) * 256 ) + 4096 - 40, 0 + ( 31 * 256 ) + 4096 - 24data_end_0 label wordThat's the NorthWest ( 0, 0 ) of the 8192 X 8192 decal poly grid, and the SouthWest ( 8191, 8191 ). ( 7 * 4 ) + 3 = 31 so... you should understand why I wrote the example this way.The decal polygons don't have the visual distance range of the water polygons! They snap into view abruptly, and at fairly close range.I'll enclose the "PolyBnds.asm", "Waterbnds.asm", and the "RhumbaTMFMacro.inc"( use them with BGLC )The approximate location is N43* 14' 31.5" by W88* 35' 37" in Wisconsin, USA.

#### Share this post

##### Share on other sites

Hi all.Here's the results of a crude mesh experiment:The land was very flat, and had no rock surface. The area seems restricted to the LOD13 area... you can almost make out the border. I used 3 3-point flatten sets.; TERRAIN FLATTEN POLYGON DATAflatten_data label worddata_start_0 label word FLATTEN_DATA 3, 0, 0, 0, 1, 1, 0 FLATTEN_POLYGON 3, 500, 0 FLATTEN_POINT 20, 74 FLATTEN_POINT 21, 74 FLATTEN_POINT 21, 75 FLATTEN_POLYGON 3, 520, 0 FLATTEN_POINT 28, 110 FLATTEN_POINT 28, 113 FLATTEN_POINT 29, 113 FLATTEN_POLYGON 3, 350, 0 FLATTEN_POINT 253, 253 FLATTEN_POINT 254, 253 FLATTEN_POINT 254, 255data_end_0 label word

#### Share this post

##### Share on other sites

Here's a single, diagonal, 2-point flatten. Note the top plateau seems to be the original mesh... just raised. It may take a while to establish rules for the flatten polygons used in this manner.

#### Share this post

##### Share on other sites

Looks like u'r rocking Rhumba !! :-)I have very limited time the last 4-5 days and the forcast remains the same.I have so far played with the flatten (and lake as it's the same) commands. They work just fine. I'll put on line for testing the latest fsregen.I'll study the above posts and ask more...Cheers for now..

#### Share this post

##### Share on other sites

Hi AllI have put together a little guide on how to design lakes, coasts etc in gmax.Also the test version of fsregen to do that is here :http://www.nhreas.com/images/fsregendocs/lakes.htmlPlease check it and let me know if worked...The thing is Under heavy construction...This is done in gmax - pain free :-)http://www.nhreas.com/images/fsregendocs/final.jpg

#### Share this post

##### Share on other sites

Hi George.I'll check out the tool and Gmax tomorrow. Hopefully, some others will become involved in the experiments, so we can speed the learning process. Also, to all interested, a newer version of BGLC was given in the FS2002 Special Effects SDK.

#### Share this post

##### Share on other sites

George, I don't know if this is a petty error, or perhaps a significant one. LOD 0 is defined as a set of 6 divisions of the globe, not 4 as you state. Refer to page 9 of the fs2000 terrainsdk.the divisions for lod 0 are at the equator, and at longitude 0, 120, and -120.Bob B

#### Share this post

##### Share on other sites

Thanks Bob.I'll correct it. It's only in the docs.I wrote it for people that have no idea about the whole concept.Cheers.

#### Share this post

##### Share on other sites

Hi all.I got Friday night (all night) finishing the decals.Rhumba, I got a problem and I'm too tired to go bug hunting.I have not studied your math yet, appart from the suggested offsets for the x-y axis.I seem to get an offset error though. The picture bellow is a flatten-lake area on top of a decal area, both automatically created. Why do I get such an offset I do not know. In gmax they are cocentric.What I do is get for every point the x-y coordinates of an LOD 8 quad in the range of 0-8192. Then I add the offsets you mention (4056 and 4072) and use the results in the DECAL_POINT.The exported scenery test in centered at n38* 7.68 e20* 30.029.If you spot a mistake in my method please tell me.Thanks.Georgehttp://www.nhreas.com/fsregendocs/decalerror.jpg

#### Share this post

##### Share on other sites

George,You need to take some time off, look at the lists of above posts. You have been talking to yourself!!:-lol

#### Share this post

##### Share on other sites

Talking to myself !! It's not the first time !! :-)I got a big project waiting and once I'm into it I will have no time for fsregen. So I try to do as much as I can over the weekend.After a fair amount of sleep (I like Saturdays!) I got another version of FsRegen and a little howto for decals and flatten areas.Hope this helps people a bit with both design and hacking :-)Just follow the link from the main fsregen page : http://www.nhreas.com/fsregen.htmlCheers !George

#### Share this post

##### Share on other sites

Hi George and W.We'll all be talking to ourselves before this is cracked! :-8 I'm sorry if I've been quiet, but the few minutes I've had this week are now devoted to cracking shorelines... Microsoft gave us a single road and a single shoreline example in the Oshgosh scenery... I think these guys just like teasing us. George, could you email me, or post the actual txt files of the pond and the beach? I'm suspecting the problem may be with the pond, not the sandy decal. Wouldn't their shapes be the same, just slightly larger for the sand area?My fear now is that the offsets are not as straight-forward as I first thought, and may have hidden variables that control the placement. Christian Stock used a different set of decal offsets to produce his Ryan's Creek airport background ( a TMF decal ). This research alone may take a few weeks to sort out, and we may have to settle for approximation, with hand-editing for the final bgl.We definitely need more minds to work on the problem... simply testing alterations in variables is horribly time consuming, as FS2002 takes so long to reset after a scenery library change... it takes much less time to play with the data or the structures, regenerate the bgl, delete the Scenery.DAT file, than it takes FS to reset! I'll bet Christian nearly went mad at times... and imagine, he was working all alone on this! We're trying to create a bgl in a manner M\$ never used! Their tools are much different, I'm sure, and we can only hope to get close with this approach, as we have no clue what they used to get their data into the sim. For example, I'm sure they had digital data for coasts, roads, streams... and this data was crunched and made into bgls without human intervention, to produce perfectly matching lakes and shores. We may have to "adjust" the numbers by trial and error, because our understanding of the data-structures and variables is just a guess.

#### Share this post

##### Share on other sites

I studied the textures from the Oshkosh scenery last night, and I don't think there is any technique used beyond simple custom photo-terrain applied via resample.exe.The only thing I noticed was that their master photo reminded me of a mix between terrascene data and the other default textures from the program. This makes for very distinct freeways and excellant merging into the default.The file names of the textures are identical to what u get when you run resample.exe on a photo. The water areas are an alpha channel, just like we do with resample.Bob Bernstein

#### Share this post

##### Share on other sites

Hi Bob, Rhumba everybody..I'm downloading the Oshkosh now. You say there is only one river in it ? Actualy is there any bgl terrain that is very small and we know for sure there is a lake or a river in it ?Rhumba, during the tests I left the original gmax triangles in so I could see what was going on. Check the pic bellow. I have the feeling that you are too close and the proper placement is right under our noses. I 'll have a go as well since I don't think any more development in software is possible or wise without further knowledge.The pic below is next to NZRC and the values I used for the result you see are : Y and X offset 4082, and span 8160. As you say it takes for ever to restart fs and see any changes that's why I thought by making fsregen and let people tell us what they got we multiply our fire power. Of course the best thing to do is find the proper way to do it and to scrap this adhoc method.Anyway, guys have a nice weekend and happy huntingGeorgehttp://www.nhreas.com/fsregendocs/decal_check.jpg

#### Share this post

##### Share on other sites

Hi all.As for Oshgosh:hyposh.bgl is a pond.hylosh.bgl is the shoreline of the pond.rr91IG1.bgl is a line decal... a road that will look like a rail-line, as explained in the docs. ( FS2002 doesn't have actual railroad tracks.)As I said, they did it on purpose.:-xxrotflmao The hylosh is the key to solving the line decals.

#### Share this post

##### Share on other sites

George, I was very interested in trying it. But there seemed to be a problem. After exporting makemdl generated a file called lake.asm. There was no lake_0.asm. However, when trying to load it in the first step, fsregen seemed to insist on the presence of lake_0.asm, so the process failed. The material I had applied as per the instructions did not appear in the slot. I am particularly interested as this could possible be adapted for making coastlines - is this possible? Many thanks for all your great work. Best regards, Chris

#### Share this post

##### Share on other sites

Hi Chris.Check that you have the latest makemdl.exe.If you export the file "lake.bgl" and you see the files "lake.asm" and "lake.azm" then you have the older version.MS changed the generated files to "lake.asm" and "lake_0.asm" with the new makemdl.Hope this helps.Regarding the coastlines I think is is possible, apart from the waves effect that we do not know yet how to do it.The other guys here are working on it.CheersGeorge

#### Share this post

##### Share on other sites

George, that was quick! I posted an hour ago, then found the problem was exactly as you said. I still use the old makemdl due to a bug that causes a problem in the virtual cockpit. I thought of using the newer makemdl - but copied the old one right back in mistake! With the new makemdl that part works fine now. I returned to update my post and saw you had got in there already. What excellent service! Problem is now that bglc generates loads of errors when trying to compile tempLake.asm. (tried with old and new bglc). Still checking that.... Many thanks, Chris

#### Share this post

##### Share on other sites

Hi, George, fsregen creates the tmpLake.asm file okay now, but sadly bglc doesn't seem to like it. Here's tmpLake.asm:********************************************************; ========= FSregen v0.29a - test. TMF Know How and macros by Christian Stockheader label BGLCODE dw 1 dd 0393AFh dd 02FB12h dd 01DAAAAAAh dd 01E000000h dd 9 dup(0) dd (offset terrain_data) - (offset header) dd 15 dup(0) dd 87654321h dw 3 dup(0) dd 10 dup(0)terrain_data label BGLCODE dd (offset terrain_header_end) - (offset terrain_data) dd 0202h dd 12 dup(0) dd (offset flatten_header) - (offset terrain_data) dd 10 dup(0)terrain_header_end label BGLCODEflatten_header label BGLCODE FLATTEN_HEADER 513, flatten_list, flatten_data, flatten_endflatten_data label BGLCODEdata_start_0 label BGLCODE FLATTEN_DATA 1,2, 0, 25, 1, 1, 1 FLATTEN_POLYGON 11, 0, 0 FLATTEN_POINT 247, 29 FLATTEN_POINT 240, 24 FLATTEN_POINT 233, 21 FLATTEN_POINT 228, 21 FLATTEN_POINT 227, 23 FLATTEN_POINT 225, 26 FLATTEN_POINT 220, 34 FLATTEN_POINT 224, 40 FLATTEN_POINT 233, 45 FLATTEN_POINT 244, 45 FLATTEN_POINT 251, 39data_end_0 label BGLCODEflatten_list Label BGLCODE FLATTEN_LIST 1, flatten_groupsflatten_groups Label BGLCODE FLATTEN_GROUP 250, 473, flatten_data, data_start_0, data_end_0flatten_end label BGLCODE***************************************************** and here's part of the error report in the DOS window:*******************************************************c:temptmpLake.asm(28) : error A2008: syntax error : FLATTEN_Dc:temptmpLake.asm(29) : error A2008: syntax error : FLATTEN_Pc:temptmpLake.asm(30) : error A2008: syntax error : FLATTEN_Pc:temptmpLake.asm(31) : error A2008: syntax error : FLATTEN_Pc:temptmpLake.asm(32) : error A2008: syntax error : FLATTEN_Pc:temptmpLake.asm(33) : error A2008: syntax error : FLATTEN_Pc:temptmpLake.asm(34) : error A2008: syntax error : FLATTEN_Pc:temptmpLake.asm(35) : error A2008: syntax error : FLATTEN_Pc:temptmpLake.asm(36) : error A2008: syntax error : FLATTEN_Pc:temptmpLake.asm(37) : error A2008: syntax error : FLATTEN_Pc:temptmpLake.asm(38) : error A2008: syntax error : FLATTEN_Pc:temptmpLake.asm(39) : error A2008: syntax error : FLATTEN_Pc:temptmpLake.asm(40) : error A2008: syntax error : FLATTEN_Pc:temptmpLake.asm(41) : error A2006: undefined symbol : BGLCOc:temptmpLake.asm(41) : error A2175: invalid qualified typec:temptmpLake.asm(43) : error A2006: undefined symbol : BGLCOc:temptmpLake.asm(43) : error A2175: invalid qualified typec:temptmpLake.asm(44) : error A2008: syntax error : FLATTEN_Lc:temptmpLake.asm(46) : error A2006: undefined symbol : BGLCOc:temptmpLake.asm(46) : error A2175: invalid qualified typec:temptmpLake.asm(47) : error A2008: syntax error : FLATTEN_Gc:temptmpLake.asm(48) : error A2006: undefined symbol : BGLCOc:temptmpLake.asm(48) : error A2175: invalid qualified type************************************************************ I was careful to choose lat/long coordinates to put it in the centre of the LOD13 quadrant. I'm using the original FS2000 SDK bglc (also tried the new version). The lake is about 200 meters across in Gmax. Many thanks, Chris

#### Share this post

##### Share on other sites

Hi Chris.I just copied/pasted your code to a file and compiled straight away.Make sure you have the grginc.inc and tmfmacros.inc in the bglc folder along with the other inc files. Ideally they should be placed in your fsregen folder.I have uploaded this package http://www.nhreas.com/download/bglc+inc.zipthat will solve the problem. Another friend complained about the same problem, so I do not know if the two above mentioned files in the 0.29 distribution are wrong (my mistake).Anyway, I have also uploaded v0.29b_test that has a couple of bug fixes and most important, will let you get the quad details next to the one you are designing. You can then place helping rectangles in gmax with the given dimensions and design more quads in parts. Then export to each quad's center position and you should be set for more complex terrain modifications.I hope all this makes sense. If anyone's feeling like writing any HowTo's I will be greatfull and I'll put them on line will all credit given and many many thanks.That's it for now, hope you have fun.All the bestGeorge

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account

## Sign in

Already have an account? Sign in here.

Sign In Now

• Tom Allensworth,
Founder of AVSIM Online

• ### Hot Spots

• Flight Simulation's Premier Resource!

AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

Click here for more information and to see all donations year to date.
• ### Donation Goals

AVSIM's 2019 Fundraising Goal

Donate to our annual general fund. This donation keeps our doors open and providing you service 24 x 7 x 365. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. We reset this goal every new year for the following year's goal.

\$20,145.00 of \$36,000.00 goal reached.
Donate Now