Jump to content
Sign in to follow this  
Guest christian

exporations into VTP line endings, hooks, etc

Recommended Posts

Guest christian

It seems that I got a bit behind, and I'm catching up with VTP lines :)I missed the discussion about hook ends on VTP lines involving at least Edgar and Dick (Edgar sent me a pm).I had a bit of a snoop yesterday, and came to the following conclusion:FS2004 default data doesn't seem to use hooks. Loading the data into TMFViewer can give the impression of hooks, but I don't think they are real. For one, the lines start from (and ends at) one edge and then go into the middle, which gives a 'hook' impression. However, looking at decompiled data itself, I couldn't really make out a hook pattern. (Then agian I only examined 5 roads or so).What is happening is that most lines are ended with very short segments (usually between 0-5). Since these segments are usually only a few units long, this can further give the impression of hooks. Say, we have a line (100,10). Putting a short (2,1) segment on the end creates a hook, but only because we can't specify (2,0.2). I'm resonably convinced that this is what's happening.This leaves a few questions:Why do we get the line starts between point 1 and 2 phenomenon?My guess is that at point one the width is set to 0 (since no width has been specified), and this creates the artifact. This is obviously battled by creating very short segments at beginning and end. (It has to be commented though, that the line doesn't grow in width, but the starting point is rather abrupt).Why do we need multiple short segments?My guess (and this really is only a guess) is to prevent autogen. It seems that a road has to be a certain width (and length) before autogen appears (otherwise it's beeing excluded by the sides that are too close to each other, just like the sides disable other autogen).What is the algorithm that determines how many short segments to use?I haven't got a clue.Now, these are just my opinions, and as I said I'm trying to catch up. I may be wrong on this, so feedback is appreciated :)Cheers, Christian

Share this post


Link to post
Share on other sites
Guest falko

About endings and hooks of vtp-roads:After my experience asm-code for roads that does'nt create artifacts looks like this: VTPLayer 32, 0 VTPNumTexturesInLayer 1, 0 VTPTextureId 0, 0 VTPPolyCount 1, 0 VTPPolyMethod2 5, 1, 0 VTPWidePoint 7458, 1, 8685, 0 ;1 VTPWidePointWidth 1 VTPWidePoint 7458, 1, 8685, 0 ;2 VTPWidePointWidth 16 VTPWidePoint 7457, 0, 8685, 0 ;3 VTPWidePoint 7350, 0, 8685, 0 ;4 VTPWidePoint 7349, 1, 8685, 0 ;5 VTPWidePointWidth 0 This is the code for a 2-point road. The road with width 16 goes from VTPWidePoint 3 to VTPWidePoint 4.If you omit the VTPWidePoint 4 then the shape of the road would become a triangle. This feature is used when creating shorlines that should not end abruptly. The two endpoints are needed to keep the width at 16 over the entire length of the road.Notice that the coordination of the 3. VTPWidePoint is different from the first and second VTPWidePoint. If the cooerdination of the three first VTPWidePoint is the same then you may get artifacts.The same happens if the coordinations of the last VTPWidePoint and VTPWidePoint before are the same.The first and the last VTPWidePoint should point to the same direction as the ends of the road, else you will get....

Share this post


Link to post
Share on other sites

Hello,what Falko describes here, is in my optinion the classical algorithm, which is implemented for instance by the Ground2k design program (up to version 5.32). - the first 2 points have the same coordinates but different widths (effect: the increase of width from 0 to x is (visually) compressed into a single location/point in the scenery) If both points don't have the same coordinates you'll get the desribed triangle shape for the line width.- the same applies basically for the end of a line - line width change compressed into close coordinates (here point 4 to point 5)- the hook effect (coordinate distance near 1-2) between point 2 and 3 and again at the end of a line (here point 4 and 5) is added for reasons unknown to me (maybe an earlier experience in GS2k2?)This whole approach/algorithm is in my optionion based on the FS VTP scenery SDK (description of the VTPWidePoint-structure) and experience around line-width increase (point 1 and 2 with the same coordinates).This was working fine for FS2k2.However, I disagree Falko, this algorithm does not prevent FS2k4 from displaying "straying autogen lines" - at a certain point of complexity (I do not know, what it is: number of points in one VTP line or the number of VTP lines in a scenery file???) usually a line of telephone poles appears - running from north-west to south east, crossing a whole cell area. Especially visible (and annoying), when crossing a runway.I think, a look at the original default sceneries might help. I use Jim Keirs great LWMviewer tool to have a look at the structures, which build the default VTP scenery files.The first, most obvious thing is: These files don't use VTP lines build only from VTPWidePoint-structures (like described in the scenery SDK), but use a mix of VTPWidthPoint and VTPChildPoint structures (recently deciphered by Jim Keir, Richard Ludowise and a third guy (sorry, forgot the name))Next obvious thing is (in my opinion): these VTP lines start and end with short length segments (I would call them hooks, because some of them point almost 90 degrees away from the main line, but I didn't checked them all). The most prominent examples are bridges - these are basically 2 point-lines, but (I believe) all of them have 90-degree hooks added to them at each end (leaving the whole line in the shape of the letter 'Z' ).As far as I tested, the same applies for each VTP line, which crosses a cell border: the line goes a little bit into the territory of the neighbouring cell and ends with a hook/short-line-segment.These VTPChildpoint structures have certain side effect: when used, the displayed line in FS starts in the middle between point 1 and 2 and ends between the last 2 points in a line. Therefore you cannot simply add a hook/short-line-segment to each end of a line, but must embrace the start- and endpoint of a line with 2 points (Richard Ludowise made a clear drawing of this effect in an earlier thread about autogen problems...)As a proof of concept I build my ChildpointConverter program (chptconv.zip), which converted "old-style" VTP lines (like in Falko's example), into "Childpoint-style" lines, like they are used in my opinion by the FS default sceneries. I honestly believe they brought some improvement: There where less problems with these straying autogen lines (and results in smaller scenery files). In my tests unwanted autogen was suppressed, when hooks where added.However, there are still reports of unwanted autogen lines. So the current solution is not 100% perfect...I think, further investigation could go into the direction of dividing VTP-line sources by the used layer (FS default sceneries uses sperate files for roads, railways, bridges etc. each with a different layer).And there are, as far as I know, reports about limits of the number of lines per defined texture(??).In my opionion, it would be a sensible approach to build VTP line sceneries like the default sceneries are built. (VTPWidePoint/VTPChildPoint-combinations, lines crossing into neighbouring cell territories, using short-segments for each end of the line). If these short-segments are always hooks, pointing 90 degrees away, needs to checked...Another problem I see here, is the smooth start of a line - line width growing slowly from 0 to x. In my described approach the lines seems to start at width x.As for something completely different: Can someone explain to me the display of VTP lines in TMFViewer? The line is displayed as a chain of boxes, with smaller boxes around each line point. This display makes it indeed harder to recognise hooks, as Christian wrote in his first message. LWMviewer just displays lines between all points in a line, so the hooks are much more obvious.Regards,EdgarBTW: The newest version of Christian Fumeys Ground2k4 (5.33) seems to implement the VTPChildPoint approach as well (maybe without the hooks).

Share this post


Link to post
Share on other sites

Hi Christian.To add to Edgar's post:The widths of the default road lines seem to determine the "hook" lengths. A width of 45 will have a starthook length of about 9. A road width of 20 will have a starthook length of about 4. It's a ratio of 5:1 ( 4.8 to 1 ? ).The hooks are usually close to 90 degrees.As Edgar indicates, the initial and 2nd point bracket the visual start of the line, the last 2 points bracket the visual end of the line.TMFViewer shows these lines in a specific way.All VTPChildpoint structures are composed as a parent and seven children to make a segment... with the last segment as up to seven children. The parent point is green, with the childpoints as blue. Red boxes are the visual endpoints... not really points at all, but the appearent start and end of the lines. The start of the line can be found as a green-red-blue 3-box combo.Every 9th point is a parent point, so every 9th box is green in TMFViewer.Stream lines sometimes have hooks, but usually when they overlap an LOD8 border ( seen easily with LWMViewer ).I believe that the childpoint structure is somehow needed to control the autogen... and it does seem to do so. But as Edgar warns, odd diagonal lines of vector autogen can crop up, possibly due to a large number of lines per LOD8 Cell, or possibly a great number of lines per BGL.Dick

Share this post


Link to post
Share on other sites
Guest luissa

HiHere is a kind of illustration to the last post!Regards, Luis; ROAD1 - as Fumey described in this thread VTPPolyMethod2 5, _IsLine_, 0 VTPWidePoint 9000, _UseWidth_, 4960, 0 VTPWidePointWidth 0 VTPWidePoint 9000, _UseWidth_, 4960, 0 VTPWidePointWidth 35 VTPWidePoint 9050, 0, 4960, 0 VTPWidePoint 9100, 0, 4960, 0 VTPWidePoint 9100, _UseWidth_, 4960, 0 VTPWidePointWidth 0; ROAD2 - as per SDK terrain - does not show VTPPolyMethod2 2, _IsLine_, 0 VTPWidePoint 9000, _UseWidth_, 4980, 0 VTPWidePointWidth 35 VTPWidePoint 9100, 0, 4980, 0; ROAD3 - simple as abobe but with more points (4). Does not show; and if the number of points is 3 or 5 it will show; strange artifacts in TMFViewer VTPPolyMethod2 4, _IsLine_, 0 VTPWidePoint 9000, _UseWidth_, 5000, 0 VTPWidePointWidth 35 VTPWidePoint 9030, 0, 5000, 0 VTPWidePoint 9070, 0, 5000, 0 VTPWidePoint 9100, 0, 5000, 0; ROAD4 - Minimum number of Child points . Hooks are perpendicular; to the line. Width is about 8 * 4.8 = 35 meters. Note that the; first 3 points define a right turn!; The last 3 points (point; 2 3 and 4) define a left turn VTPPolyMethod2 4, _IsLine_, 0 VTPWidePoint 9000, _UseWidth_, 5020, 3 VTPWidePointWidth 35 VTPChildPoint 0, 0, -8, 0 VTPChildPoint 100, 0, 8, 0 VTPChildPoint 0, 0, -8, 0; ROAD5 - as 4 but with a midle normal point (not child). It seems; that midle points could be normal wide points. Unwanted autogen; could be the problem VTPPolyMethod2 5, _IsLine_, 0 VTPWidePoint 9000, _UseWidth_, 5040, 1 VTPWidePointWidth 35 VTPChildPoint 0, 0, -8, 0 VTPWidePoint 9050, 0, 5036, 2 VTPChildPoint 50, 0, 4, 0 VTPChildPoint 0, 0, -8, 0; ROAD6 - The WidePointWidth = 70. It shows that the start; width depend on the distance between point 1 and 2. Also; the end width depends on the distance between points N-1 and N VTPPolyMethod2 5, _IsLine_, 0 VTPWidePoint 9000, _UseWidth_, 5060, 1 VTPWidePointWidth 70 VTPChildPoint 0, 0, -8, 0 VTPWidePoint 9050, 0, 5056, 2 VTPChildPoint 50, 0, 4, 0 VTPChildPoint 0, 0, -8, 0; ROAD7 - The WidePointWidth = 35 but distances from point 1 to 2; and from points N-1 to N is larger VTPPolyMethod2 5, _IsLine_, 0 VTPWidePoint 9000, _UseWidth_, 5090, 1 VTPWidePointWidth 35 VTPChildPoint 0, 0, -16, 0 VTPWidePoint 9050, 0, 5082, 2 VTPChildPoint 50, 0, 8, 0 VTPChildPoint 0, 0, -16, 0

Share this post


Link to post
Share on other sites
Guest luissa

Hi again,Firstly I am sorry for changing the name of Falko in my previous post. I think that any VTP line should have at least 4 points. Points 1 and 2 will generate the "true first" point and points N-1 and N will generate the "true last point". Based on TMFViewer display I assume that each midle point is internally translated to 2 points (points 3a and 3b as in the picture).We could think as the lines being drawn as triangles. For a 3 point line (made with 5 points) 4 triangles are needed:1 2 3a3a 3b 13b 3a 55 4 3bIn order to avoid artifacts as shown in the second case starting points 1 2 and 3 should make a "left turn". On the contrary ending points, 3 4 and 5, in this case, should make a "right turn".I do not know if there is any difference in using Child or Parent Points. Normal points work here but they probably generate unwanted autogen scenery.Regards, Luis; first ROAD is OK! Points 1 2 and 3 make a left turn VTPPolyMethod2 5, _IsLine_, 0 VTPWidePoint 9000, _UseWidth_, 5004, 0 VTPWidePointWidth 35 VTPWidePoint 9000, 0, 4996, 0 VTPWidePoint 9050, 0, 5000, 0 VTPWidePoint 9100, 0, 5004, 0 VTPWidePoint 9100, 0, 4996, 0; second ROAD is not OK! Points 1 2 and 3 make a right turn VTPPolyMethod2 5, _IsLine_, 0 VTPWidePoint 9000, _UseWidth_, 5046, 0 VTPWidePointWidth 35 VTPWidePoint 9000, 0, 5054, 0 VTPWidePoint 9050, 0, 5050, 0 VTPWidePoint 9100, 0, 5054, 0 VTPWidePoint 9100, 0, 5046, 0http://forums.avsim.net/user_files/67569.gifhttp://forums.avsim.net/user_files/67570.jpg

Share this post


Link to post
Share on other sites
Guest C_Fumey

Hello all,see the attached picture; it explains what Ground2K generates.Edgar and I have worked a lot in order to find a solution.I'm not sure that my method is really good. Until now, only one guy has reported to me that poles have disappear.RegardsChristian

Share this post


Link to post
Share on other sites
Guest christian

Thanks for all that info, guys.I think, I'll need to do some more exploration, and probably rather use LWMViewer...One unanswered question, I guess, is still the occurance of multiple short segments.I'll be back with some more exploration results as soon as I find some time.Cheers, Christian

Share this post


Link to post
Share on other sites
Guest JoeW

This reared it's ugly head with me yesterday. I was doing a 2 lane undivided asphalt road into the airport and got telepoles marching across my runways...I tryed several things that didn't help... I was making the lines( roads)away from the airport.... I drew the line in the opposite direction, toward the airport and that cured the Telepole problem marching across the runways.Joe W.

Share this post


Link to post
Share on other sites
Guest luissa

Hi,In converting the width of VTP lines from "meters" to "VTPWidePointWidth units" I match 1223 meters to 255 VTP units. The reason being that width of VTP lines is coded as an unsigned 8-bit number.This is OK in the Equator. Here the "2 points line ends" should be perpendicular to the line. But, near the poles, this is not like to happen. Also, near the poles, the width of a line going W to E should differ from a line going N to S.I tried to test this last statement. Unfortunately I used N60 W30 which was not enough to make a strong conclusion. I placed 4 LandClasses and made a road going from left to right and then turning down. The width was constant an equal to 120 meters. Pictures illustrate what I have done. The experiment is not sufficient to conclude that roads are thiner when running N/S near the poles. May be I report here further findings if this is of interest to other people.Regards, Luishttp://forums.avsim.net/user_files/68105.jpghttp://forums.avsim.net/user_files/68106.gifhttp://forums.avsim.net/user_files/68107.jpghttp://forums.avsim.net/user_files/68108.jpg

Share this post


Link to post
Share on other sites
Guest christian

As promised, I've done further research...Firstly, apologies to the 'hook people'. I'm a converted 'hook believer' myself now :). It seems to me that hooks are the MS way to make sure a line starts where it should start. As Dick explained already, basically, we have to draw the starts and ends of the line, which looks like a hook.This is usually used for roads and shore lines. However, MS didn't use this algorithm for streams, railroads, and utility lines. With one exception: if two lines should join, the hook approach is used to prevent a gap.Now some new(?) findings. I'm guessing that the hooks don't cure the autogen problem per se. I found that in most cases, all lines have 5 end points / 4 short segments at the end (to fix autogen?). These segments are typically 2 units long, but can be sometimes up to 5 units long. This is used for all lines, except the shore lines.The shore lines have another 'specialty', and that is that can vary their width considerably. Given that the width is largely unknown, there really is no good explanation for this. Maybe just an MS feature to vary things a bit around? It makes the shore lines look like snakes more than anything...Cheers, 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...