Jump to content
Sign in to follow this  
Guest

Ground2k - lwm-areafill in FS2004

Recommended Posts

Guest jimkeir

Hi.Thanks for the replies. I'll try replacing all the AreaFills with Polys tonight and see what happens. However, since I'm covering a fairy large area (about 2deg square) that's a lot of LWM polys, particularly since much of the area is water anyway.Another couple of questions, if I may: I've had to replace a few areas with remeshing where the default MS flattens get in the way. I've got my prog to calculate the remesh automatically for only the necessary areas by parsing the MS HP*.BGL and hydrop*.BGL files; does anyone know if there are any other files in the default scenery which would normally hold LWM flattens?I originally had the remeshes created using the two-point polys described here. To try and cut down the resulting code (about 50Mb of BGL source!) I rewrote to use horizontal banding where possible; that is, if adjacent points are within a metre (altitude) they are not created using individual polys but a single line joining the first and last point at the same height. Since I'm remeshing six adjacent areas that's a *lot* of points. FS9 still churns out 30FPS but I'd like to make it as efficient as possible. Has anyone any recommendations for the most efficient remesh style? For example, what if I generate 144 quads per area instead of 144 points? I'm currently sampling each cell at 12x12, creating 144 points per cell. This was decided just through experimenting - any less and the terrain tended to fall into the gaps :)Anyway, thanks for the advice and sorry for the long post.Regards,Jim Keir.

Share this post


Link to post
Share on other sites

Hi Jim:for my last project, the mesh/scenery enhancements of the Canadian Rockies, I faced the same dual problem of crashes with 1x1 AreaFills and dealing with the default flatten switches. I solved both with the same approach, which I outlined in this post:http://forums.avsim.net/dcboard.php?az=sho..._id=15058&page=Your large area seems well suited for this procedure and I'd be happy to give you more advice on specifics. Since I posted the message above, the first steps (locating the FS2002 hyp*.bgl file and the cells/areas to edit or delete) has become much simpler. Steve's new version of his FSTflatten utility provides all necessary information on-screen via a connection with FDSconnect or FSUIPC. It's not available yet but will be shortly.The cons with my approach? Given the problems with the crashes in FS9, I removed the 1x1 AreaFills from Ground2K4, which means that the deactivation of the default HP9*.bgl file in FS9 is required (not optional, as originally intended) to avoid strange overlay effects of the default and new shorelines. Also, if someone else was to take the same approach within the same LOD5 section, our add-ons would be incompatible unless we use each other's base files. Finally, the FS2002 hyl*.bgl and FS9 HP9*.bgl files cover different areas, which means you'll need two different versions if you'd like to maintain backwards compatibility.Other than that, this approach worked really well and I managed to change or replace LWM flattens in four LOD5 areas within a few hours of (tedious) work each. And not a single re-mesh poly had to be made ;-)Cheers, Holger

Share this post


Link to post
Share on other sites
Guest jimkeir

Hi.Thanks for the feedback. That's a nice way of getting round the problem; however, I think I'll persevere. I'm at the point now where by typing a single command and waiting for a minute or so I can go from a raw elevation map to a ready-to-fly terrain, complete with custom land- and water-classes, shorelines and remeshed areas where there are default flattens or water polys. All this is automatically generated and depends only on "resample" and friends, BGLC and the FS9 BGLs. I plan to get it to add inland lakes/rivers by using a second input map containing water elevations. Uh, my original plan was just to write a one-time filter for a scanned map, but the project kind of got out of hand :) I've not yet fully decoded the FS2004 HP*.BGL files but I've got enough of them to get most of the coastlines/flattens for the areas I've tested. The idea is that I should then be able to generate FS2004-flavour LWM files directly and hopefully avoid the crashes that way.I'll post some pics or a sample area tomorrow (at work right now ;( ). If you'd like to test the app (bearing in mind it's not finished), let me know and I'll email a copy.Regards,Jim Keir.

Share this post


Link to post
Share on other sites

Hi Jim:holy cow, that sounds like a neat piece of software - I wouldn't mind having a look at it at some point (I'll send you a PM with my email). I'd also like to hear more (and I'm not the only one, for sure!) about what you've found out about the structure of the FS9 LWM (HP9*.bgl etc.) files. For example, have you been able to decode and/or implement any sloped flatten surfaces?Cheers, Holger

Share this post


Link to post
Share on other sites
Guest jimkeir

Hi.I'll hang on to it for a little longer I think - I was trying some more areas last night and found some more places that weren't decoded properly. I'll keep at it. I also noticed that the HL*.BGL files also contain LWM structures, and I've not looked at those at all.I've not noticed any sloped flattens, but I'd hazard a guess as to where they are. At the start of each Poly stream there are two height fields, which are normally identical. Each point also has a third field, which is normally 0. I'd guess that, for sloped surfaces, the heights are min and max and the third point field is some kind of height within the range. Just a guess right now though.I've attached some sample C code to read a FS2004 LWM BGL file. Please bear in mind:- It's written for GCC 'cos I use Unix at work :)- There's no code to step through the various file headers but they haven't changed apart from the LWMFileHeader version. This has gone from 0x0201 to 0x0300 .- It's based on guesswork and therefore almost certainly doesn't work with every H*.BGL !- It was never really intended for public use. (i.e. nasty variable names, no error checking etc. ).Anyway, hope it helps. I'll be going through more BGLs tonight, hopefully should fix some more problems.Regards,Jim Keir.

Share this post


Link to post
Share on other sites
Guest jimkeir

Hi.I've attached a slightly more friendly version of the C code I posted yesterday. Right now it will only read FS2004-format HP*.BGL files. This isn't meant to be a userland tool, more just a demo of the file-reading code. Use the numeric keypad to scroll around, and +/- to zoom.BTW, there was a bug in the code I posted; lines 113 and 114 should be changed from:for (ly = 0; ly < r; ly++) { for (lx = 0; lx < r; lx++) {to:for (ly = 0; ly < (1<<(r-1)); ly++) { for (lx = 0; lx < (1<<(r-1)); lx++) {Regards,Jim Keir.

Share this post


Link to post
Share on other sites
Guest C_Fumey

In release Ground2K4 5.1 AreaFills will be generated as LWM polys.This release will be available soon.Christian

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • 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.
×
×
  • Create New...