Sign in to follow this  
rhumbaflappy

Dick, Jim & others: new land/water mask findings...

Recommended Posts

I think we tackled the new format (0x300) of the LWM masks in earlier posts, but there seems to be a serious limitation. I strongly suspect that LWMPoly2Ex does NOT work! I haven't confirmed 100%, but:1) the included ASM files don't work. Either FS9 crashes or I get spikes. Smaller airport flatten ASM files (that don't use LWMPoly2Ex) work fine.2) I couldn't find any polygons with more than 63 points in the default LWM files (I haven't decompiled all of them, but there is a trend that polygons have a max point count of about 16).This would make version 0x300 useless for coastline building (in my opinion). I'm inclined to go with version 2 LWM polys and substitute Area Fills with 4 sided polys. Doesn't seem to have any impact on framerates and visuals, so maybe the best strategy.Can anyone confirm?Cheers, Christianfiles: hp* - failing water masksflt* - successful flatten polysTMFmacros - my LWM/VTP BGLC macro collectionhttp://forums.avsim.net/user_files/52126.zip

Share this post


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

Hi Christian.Try this code in the attached zip file. I added this structure:LWM_DATA_POLY3 MACRO count, attrib, heightstart, fractionstart, heightend, fractionendIF count LT 63 DB attrib * 80h + countELSE DB attrib * 80h + 63ENDIF DW heightstart DB fractionstart DW heightend DB fractionendIF count GE 63 DB count - 63ENDIF ENDMAnd altered lines to look like this: LWM_DATA_AREA_DRAW_POLYGONS 1, MASK_TRANSPARENT, 11, 13 LWM_DATA_POLY3 150, MASK_WATER, 0, 0, 0, 0 LWM_DATA_POINTZ 255, 255, 0 LWM_DATA_POINTZ 1, 255, 0 LWM_DATA_POINTZ 1, 207, 0 LWM_DATA_POINTZ 2, 209, 0........It then views fine in LWMViewer.Dickhttp://forums.avsim.net/user_files/52134.zip

Share this post


Link to post
Share on other sites

Ouch! Looks like I outsmarted myself by trying to get away without a new poly3 macro. Thanks for pointing out my mistake, Dick! Views fine in FS9 now. Now it looks like my -9999 height doesn't work, but I'll have to double check that...Cheers, Christian

Share this post


Link to post
Share on other sites

yes, I can confirm:LWM_DATA_POLY3 48, MASK_WATER, -9999, 0, -9999, 0LWM_DATA_POINTZ 95, 76, 0LWM_DATA_POINTZ 97, 73, 0LWM_DATA_POINTZ 101, 69, 0...sets the height to -9999m rather than 'no height'. I'll try to find out if MS changed -9999 to something else, or if we lost the capability to not set an explicit height...Cheers, Christian

Share this post


Link to post
Share on other sites

Hi Christain.Unless we find a substitute for -9999, we might very well go back to poly2s.Dick

Share this post


Link to post
Share on other sites

I'm doing tests with many LWM WATER polygons and points; there is no problem, using areafillnxn as well, with or without height.It could be some limits in FS9 :- number of points and/or polys per LOD13 (and/or LOD8 ...?)- number of points (62 ?) for concave polys.I have limited the number of points up to 62 for concave polys and it works well. (release V5.2 to come) I don't remember why I have decided that, may be, because with convex polys, I have never found polys with many points (17 in my tests).It could be also similar limitations for VTP2 polys and/or lines.For LWM LAND polys, for the moment, I go on generating polys instead of AreaFills; Note : I have decreased drastically the needed time for LWM BGL generation; to continue with VTP2 polys and lines.Christian

Share this post


Link to post
Share on other sites

I'm doing tests with many LWM WATER polygons and points; there is no problem, using areafillnxn as well, with or without height.It could be some limits in FS9 :- number of points and/or polys per LOD13 (and/or LOD8 ...?)- number of points (62 ?) for concave polys.I have limited the number of points up to 62 for concave polys and it works well. (release V5.2 to come) I don't remember why I have decided that, may be, because with convex polys, I have never found polys with many points (17 in my tests).It could be also similar limitations for VTP2 polys and/or lines.For LWM LAND polys, for the moment, I go on generating polys instead of AreaFills; Note : I have decreased drastically the needed time for LWM BGL generation; to continue with VTP2 polys and lines.Christian

Share this post


Link to post
Share on other sites

Hi.I've just posted the source for LWMViewer's BGL file interpretation on my website. Maybe this will help - until MS get round to releasing the rest of the SDK, anyway.I've not put up the full source simply because it's still changing pretty fast, but the basic file interpretation stuff seems more or less stable now.There's a link on http://www.jimkeir.co.uk/LWMViewer.htmlBTW, I made a small change to the bitmap saving code. I didn't mention it before because it won't affect many people but for those of you using the bitmap export, it might be worth updating.Just a word of warning - LWMViewer is a little more lenient than FS2004 in a few cases. I've created V3 LWM BGLs which have displayed fine in the viewer but crashed FS. In all cases, these were to do with extended polygon counts being too high; LWMViewer stops reading when it reaches the end of the data section (more or less) while FS2K doesn't.I should probably put a warning in for these errors.HTHJim Keir

Share this post


Link to post
Share on other sites

Hmm, I've browsed through a number of files, but no indication of a -9999 substitute. I guess that leaves 2 options:1) stick with Poly2, which is fine as long one doesn't use AreaFill commands (which don't seem to make any impact on frame rates).2) assign heights to all LWM polygons. this could be easily done by writing a macro in a GIS environment.Solution 1 has the advantage that it works with FS2002 and FS2004...I wouldn't bother waiting for an SDK. In a year we'll get a re-release of the FS2002 SDK, with maybe 2 sentences changed. We'll probably know more already then we'll ever learn from any SDK.Cheers, Christian

Share this post


Link to post
Share on other sites

Hi Jim,if you use a BGLC macro that will only allow DB count_ex (ie 255), you shouldn't have any problems. I have used more than 200 extra points without any problems here. Moving the count_ex AFTER the second height entry fixed all my problems.Cheers, Christian

Share this post


Link to post
Share on other sites

Hi Christian.I'm of a mind that the only advantage of the FS9 LWMs is that you can possibly remesh with greater control... each vertex of the polygon could have a different height. square polygons of LOD12 size ( 1/256th of LOD7 ) could remesh an LOD7 mesh to undo the effects of default flattens. The flattens are still my pet peeve... MS could have fixed that, and allowed a code that would return mesh to it's pre-flattend state.As far as water and land, the old commands are fine, and for sloping water, the -9999, 0 height works like a charm, if the mesh is right.I would like to see areasfills from FS9 code, to see if they goof up the map and GPS view ( I'm betting they do unless they are the "base" bgl ).I don't believe the SDK will tell us much, either. I agree we'll probably get a rewrite with 2 sentences changed ( and those sentences will probably be wrong! ). :-doh Still, I look forward to the SDKs with the hope they'll get it right, and add some useful tools.I think Jim has done a great job with his code investigations and the LWMViewer!It is good to hear from you, Christian. I don't forget the debt we owe you for your TMF discoveries.Dick

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