Sign in to follow this  
Guest luissa

VTP lines and LWM masks don't match?!?

Recommended Posts

I'm using the same set of data to generate VTP shore lines and LWM masks, but the points aren't identical. I noticed that this is also the case for default scenery.The problem is that I get water bleeding through the shorelines, which looks quite ugly. Is this a known problem and is there a fix?Cheers, Christian

Share this post


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

Hi Christian,I hope someone can give you a positive comment on your question. Nevertheless I tried to reproduce the problem that you describe. I made a polygon on land and I declared it as a LWM polygon (type=water) to make a lake. Then I duplicated the polygon as a line and I declared the line as a VTP line (texture=1052 ; width=100 meters). The LWM polygon and the VTP lines have exactly the same number of points at the same positions. I get no bleedthrough. Would it be the case that I am using a very large width? Or has it anything to do with the line texture number? What values are you using?Regards, Luis

Share this post


Link to post
Share on other sites

Thanks for your reply Luis.Have you checked in TMFViewer? That's where the difference in points is actually visible (hard to see in FS2004). (To compare, you'll have to use version 2 LWMs, because version 3 LWMs don't show in TMFViewer. Also, you'll have to zoom in quite far). I was using a width of 85 metres, and the waves-white beach shoreline.I assume, I may get the bleedthrough because my segments are very short, since my data is very detailed. So the point difference actually matters (whereas in the default data it doesn't really matter that much). Also possible that my algorithms are wrong, but after some serious brain excersises yesterday I came to the conclusion that my algorithms should be right...Cheers, Christian

Share this post


Link to post
Share on other sites

Hello Christian,I have the same problem. In my opinion it only appears in FS2k4. The same scenery does not have this problem in FS2k2.I am using Ground2k, which uses the same source polygon to generate LWM and VTP data ("LWM with shore") - I suppose this results in exactly the same points for LWM-masks and VTP-lines.I switched to manually adding the shore-lines and put them a little bit towards the land side - without big success, water is still bleeding through sometimes and the "into-land" offset differs for different lines (see left and right shore of a lake).If I remember correctly, I have the same problem for larger segments.I am also interested in the right solution...Cheers,Edgar

Share this post


Link to post
Share on other sites

Hi Christian.I think this is due to the number of points per LOD13 Area. VTP uses 255 and LWM uses 256. I think LWM cheats, and displays "0" as "1" ( 1 and 0 are placed at the same spot ). If true, that would throw our calculations for LWM off by one point both vertically and horizontally, as VTP effectively displays 0-254 while LWM displays 1-255.That may explain why VTP polys sometimes show separations at the LOD13 seams when viewed from different distances.Just an idea.Dick

Share this post


Link to post
Share on other sites

Hi guys,I have often noticed this problem with the default (!) scenery, so it seems as if it is not limited to us.Best regards.Luis

Share this post


Link to post
Share on other sites

Hello,I am sorry if I take the discussion a litle off of the topic. I would like to comment on the width of shorelines. 6 years ago I had a programe called Beaches (http://www.it.uc.pt/~luis/fltsim.html) which placed shorelines as TexPoly()s. The textures were very similar to the ones that MS uses today. They were made by 4 vertical stripes with a difference: the width of the stripes were 128 64 32 and 32. The aim was to get some kind of "multiresolution width". I used to stretch the textures so that they would exactly apply to the whole width of the polygon beach. Then I used to repeat the textures along the lenght of the beach polygons using a scale factor so that the stretch applied to the width dimension was also apllied to the lenght dimension.VTP texture lines use 4 stripes of width 64. The purpose is similar to the one in my old programme which was to make a kind of a single non squared texture of witdth 64 and length 1024 (a big lenght is needed or the user sees many repetitions). With TexPoly()s I could make beaches in whatever detail I wanted. But VTP2 polygons are limited to 4.8 meters per pixel. Because VTP textures lines have a width of 64 pixels, the witdh of the beaches is 255 meters maximum (I wrongly wroted in this forum, some days ago, this width to be 1223!). I am reaching to my conclusion which is: beaches made from VTP lines must have 255 meters or they will be clipped. Following are 2 pictures of the same "corner" of a VTP beach: one is 255 meters wide and the other is 85 meters wide as Christian refers to. For such a "thinner" beach, a custom texture should be prepared where the 4 64 pixels stripes should have only a few opaque pixels along the axis at 32, with larger transparent borders.These transparent borders are more or less "random" to further give the impression that the beach texture has no repetitions. If the borders come closer to the axis of texture there is the danger of water (or land) show up where it should be covered by the texture. Of course there is the possibility of wrong coordinates being used for LWM and VTP. In translating lat/lon values to LWM/VTP points I just make the points to coincide with a "LOD21 grid shifted down and down by a LOD22" which I call a "LOD21.5 grid". Jim Kier reported that:http://forums.avsim.net/dcboard.php?az=sho...ing_type=searcheg, MS does not uses the whole range of 256 values for points in a LOD13. I have looked at the 255 meters wide beach corner in TMFViewer and in fact I actually see that the points do not coincide! I made both VTP and LWM points going to a "Snap to LOD21.5 grid"! I am confused!Regards, Luishttp://forums.avsim.net/user_files/68785.jpghttp://forums.avsim.net/user_files/68786.jpghttp://forums.avsim.net/user_files/68787.gif

Share this post


Link to post
Share on other sites

Thanks for your reply, guys.I'm so glad that this is a common problem, and even occurs in the default data. Good thinking, Dick, I think you may have a point. Hmm, I'm thinking about this a bit more now. LWM uses 1-155 (255 points). How many does VTP really use? 255 or 254.96875?After looking at a few files, I don't think it's a simple 1/1 point offset. I think MS is using different algorithms to place LWM and VTP points! This would really complicate things. However, there is a slight trend to a NW offset as far as I can see.It seems like Edgar's solution is the best for now: adjust the shore lines manually to fit in problem areas. This is a pain, but maybe a small resize and small SE translation will clear up most problem areas.I think Luis is right with transparency causing this behaviour. But if the lines would match, the transparency should be on the 'right' side of the water line, and not bleed into it. (at least if the bitmaps are sensible).Once again MS inconsistencies seem to create traps and make things overly complicated. Will they ever learn?Cheers, Christian

Share this post


Link to post
Share on other sites

Hi Christian.If you find anything significant about the matchup ( or lack of matchup ) please let us know. :)"Once again MS inconsistencies seem to create traps and make things overly complicated. Will they ever learn?" The new MakeMDL simplified the scenery objects to the point where we cannot move them dynamically, control the V1, or get rid of the shadows. :-lol Dick

Share this post


Link to post
Share on other sites

Hi, Christian, when adding VTP functions to AutoAsm a bit over a year ago I came across this problem. You need an equation to convert from LWM coordinates to VTP. After some trial and error I came up with this: suppose x is the position inside the LOD13 square (range 1 to 255) and x13 is the position of the LOD13 square inside the LOD8 square (range 0 to 31) then VTP x value = 4081.5 + 255/256*(x + x13*256) and similar for y - the integer value is used in the asm file. It's a little surprising as you might expect the offset to be 4080. Even if I remove the 0.5 from the offset there's a significant error. Also, for a point in the top left of the LOD8 square the VTP coordinate is 4082, 4082. For vertical and horizontal lines the registration between LWM and VTP lines seems to be perfect. However, for diagonal lines small puddles of water can appear behind the shoreline, but that's probably due to other factors. Best regards, Chris

Share this post


Link to post
Share on other sites

Hello Chris,Thank you for the formula. I use a different one but I did not tested it very much. If I find something interesting I will post here. What I am using, for the X coordinate, is:Vtp.X(TCell.X) = Lwm.X + (255 * Area.X) + 4080 + (Cell.X - TCell.X) * 8161TCell.X and Cell.X are, respectively, the X coordinate of the Target Cell (the Cell where I want to get the VTP coordinate) and the X coordinate of the Cell where the point belongs to.Regards

Share this post


Link to post
Share on other sites

Thanks, guysI'll give you formulas a whirl and see how that works.Cheers, Christian

Share this post


Link to post
Share on other sites

Hello,I have to correct the formulae I am using for VTP and LWM points :-(!Following is a small experiment using TMFViewer only. I did not check things in FS. I generated a BGL with 16 landclasses at N40 W40 (I need to open this BGL in the first place in TMFViewer or otherwise I can not see the latitude and longitude on the status bar). Then I generated a second BGL consisting on 4 LWM water AreaFills (in blue). Then I generated a 3rd file with a middle LWM water square made as polygon (green in the picture). I used the following macro for this middle square:; Area01X01Poly.scm macro; used instead of AreaFill 1X1 to avoid crashes (?); %1 = type 0=water 1=land 2=flatten 3=transparent; %2 = column 0 ... 31; %3 = row 0 ... 31; %4 = height if type=0 or =2mif( [%1 == 2] ) LWMAreaDrawPoly( 1 2 %2 %3 )melse LWMAreaDrawPoly( 1 3 %2 %3 )mifendmif( [%1 == 1] ) LWMPoly( 4 1 %4 0 0 255 0 255 255 0 255 )melse LWMPoly( 4 0 %4 0 0 255 0 255 255 0 255 )mifendAs far as could test the borders of the 4 AreaFills coincide with the LOD13 grid and I will assume that they really mark these borders. The problem with the LWM polygon is that its corner at (0, 0) goes ONE unit further into the NW LOD13! On the contrary the SE corner at (255, 255) seems to match OK with the AreaFills! See the figures.Finally I changed my macro to:mif( [%1 == 1] ) LWMPoly( 4 1 %4 1 1 255 1 255 255 1 255 )melse LWMPoly( 4 0 %4 1 1 255 1 255 255 1 255 )mifendSo that the polygon now has its NW corner at (1, 1). In this case it matches perfectly the AreaFills at the NW corner, as shown in the last picture! Therefore I will go to check what happens in FS before I exclude the use of ZERO in LWM coordinates! I need to check both the cockpit and the map views.Regards, Luishttp://forums.avsim.net/user_files/69183.gifhttp://forums.avsim.net/user_files/69184.gifhttp://forums.avsim.net/user_files/69185.gifhttp://forums.avsim.net/user_files/69186.gif

Share this post


Link to post
Share on other sites

Hi again,In addition to my last post, I confirm that FS shows correctly both the (0, 0) to (255, 255) and the (1, 1) to (255, 255) squares! I had to change my settings to "no filtering" in the display options. It looks like FS clips the edges of the center square when it grows into the north and west neigbours squares.I have done another experiment which was to use a VTP photo tile in the center of 4 LWM water masks. I used a macro whose coordinates are as in:; VTPm2Custom.scm macroVTPPoly( 2 4 0 ) VTPPointXY( [ %1 * 255 + 4080 ] [ %2 * 255 + 4080 ] ) VTPPointXY( [ %1 * 255 + 4335 ] [ %2 * 255 + 4080 ] ) VTPPointXY( [ %1 * 255 + 4335 ] [ %2 * 255 + 4335 ] ) VTPPointXY( [ %1 * 255 + 4080 ] [ %2 * 255 + 4335 ] )The Area in question was %1=21 (a big X) and %2=7 (a small Y) and I noticed that the center VTP poly fits exactly between the 4 LWM squares. So I will take this case to derive the correspondence between LWM and VTP coordinates. :) Regards, LuisPS: the picture shows the NW corner of the VTP blue poly which touches the SE corner of the LWM mask.http://forums.avsim.net/user_files/69199.gif

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