Sign in to follow this  
Guest fumey

VTPNumTexturesInLayer...Data Hierarchy

Recommended Posts

Hi all.With Arno Gerretsen's help, and the NL-2000 team, I've gotten a much better understanding of VTP Layers and the texture usage within layers.It had been my habit to restate the 'VTPDataArea' for each poly or line. That works quite well. VTPDataAreaVTPLayerVTPNumTexturesInLayerVTPTextureIdVTPPolyCount.VTPDataAreaVTPLayerVTPNumTexturesInLayerVTPTextureIdVTPPolyCountAlso, you could restate the 'VTPDataArea' for each Layer, which I have been doing lately. But I also restated the 'VTPDataArea' if a new texture was used.VTPDataArea__VTPLayer__VTPNumTexturesInLayer__VTPTextureId__VTPPolyCount.VTPDataArea__VTPLayer__VTPNumTexturesInLayer__VTPTextureId__VTPPolyCountThe NL-2000 team have been stating the 'VTPDataArea' once for each Cell. This is a very elegant solution. But it does require organising the data by Layer, then by texture, then finally by poly ( or line ).If you keep the nesting organised, it works well:VTPDataArea__VTPLayer__VTPNumTexturesInLayer____VTPTextureId______VTPPolyCountMore complicated:VTPDataArea Cell1__VTPLayer 1__VTPNumTexturesInLayer____VTPTextureId 1______VTPPolyCount.____VTPTextureId 2______VTPPolyCount.____VTPTextureId 3______VTPPolyCount..__VTPLayer 2__VTPNumTexturesInLayer____VTPTextureId 1______VTPPolyCount..__VTPLayer 3__VTPNumTexturesInLayer____VTPTextureId 1______VTPPolyCount.____VTPTextureId 2______VTPPolyCount...VTPDataArea Cell2__VTPLayer 1__VTPNumTexturesInLayer____VTPTextureId 1______VTPPolyCount.____VTPTextureId 2______VTPPolyCountThis Hierarchy was actually displayed on page 5 of the FS2002 terrain SDK, but we needed some more complicated examples to make the solution evident.Here's a better look at how this organisation appears for some VTPm2 lines in a single Cell:; -------------------------------------datamark_v0 label word ;;VTPDataArea 2, 1, 0, 0 ; Declaring 2 layers to be used in this data structure;; ...................................................................layer 1 of 2; ; VTPLayer 31, 0 ; first we do layer 31 VTPNumTexturesInLayer 2, 0 ; and we decide to have 2 textures in this layer;;; ; roads ( made as layer 31 ); VTPTextureId 1, 0 ; first we'll do the road texture VTPPolyCount 3, 0 ; and we have 3 polys using this texture; VTPPolyMethod2 31, 1, 0 ; road segment #1 VTPPolyMethod2Ex 13 VTPWidePoint 6900, 1, 6802, 0 VTPWidePointWidth 1 ............................;; VTPPolyMethod2 18, 1, 0 ; road segment#2 VTPWidePoint 6582, 1, 7266, 0 VTPWidePointWidth 1 ..............................;; VTPPolyMethod2 31, 1, 0 ; road segment #3 VTPPolyMethod2Ex 73 VTPWidePoint 5988, 1, 8674, 0 VTPWidePointWidth 1 ..............................;;; ;; different texture road ( made as layer 31 ); VTPTextureId 4, 0 ; now we do the stream texture VTPPolyCount 1, 0 ; just one line with this texture; VTPPolyMethod2 22, 1, 0 VTPWidePoint 6080, 1, 7610, 0 VTPWidePointWidth 1 ...............................;;; ;; sandbar made with shoreline ( made as layer 32 )..layer 2 of 2;; VTPLayer 32, 0 ; Here's the second layer VTPNumTexturesInLayer 1, 0 ; We'll use one texture in this layer; VTPTextureId 3, 0 ; shoreline texture VTPPolyCount 1, 0 ; only one line used; VTPPolyMethod2 31, 1, 0 VTPPolyMethod2Ex 7 VTPWidePoint 5823, 1, 7201, 0 VTPWidePointWidth 1 ..............................;;datamark_v1 label word; -------------------------------------Attached is an example. It is based on some scenery by 'BrianB', who was kind enough to share his code in a previous thread, but now rearranged to illustrate the more complete nesting of the data structures, as Arno showed me.Dick

Share this post


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

Nice overview you made of it :).We have indeed followed the structure as given in the SDK and that seems to be the most efficient way (although it requires some organising of the polygons and textures).Arno


Member Netherlands 2000 Scenery Team[a href=http://home.wanadoo.nl/arno.gerretsen]http://home.wanadoo.nl/arno.gerretsen/banner.jpg[/a]

Share this post


Link to post
Share on other sites

HelloDick, thanks you for your response abot VB6FR.DLL and yout tests with the VTP SDK structure.I have always used the VTP SDK structure without problems.To be precise, with VTP until now, I have only created lines and never polys (the second step). But !!! doing some tests with a very simpler structure (1 cell, 1 layer, 1 texture, 1 line) I note some troubles. Could anyone confirm these tests with lines :textures 1134 & 1135 : same (concrete ?)1136 & 1137 : same (dirt ?)1089 to 1096 : all the same1026 to 1034 : all the same except 1031 (ice) which is good. Wave effects amways appear.Christian

Share this post


Link to post
Share on other sites

I am not at home now, so I can't check, but I remember that some of the texture entries in the terraintexture.cfg file refer to the same texture actually. So that can explain that they are the same.When trying different textures a time ago I also found that some didn't look really different, but I can't remember the numbers and never looked at it systematically :).Arno


Member Netherlands 2000 Scenery Team[a href=http://home.wanadoo.nl/arno.gerretsen]http://home.wanadoo.nl/arno.gerretsen/banner.jpg[/a]

Share this post


Link to post
Share on other sites

Hi Christian.The 'terraintextures.cfg' file does assign the same texture names to many of it's numbers.If someone were clever with textures, they could make customised ones, and change the assignments in a new 'terraintextures.cfg'. Then when black sand shores were shown in the sim, they would actually be black.It could be quite a project. But, unless the default sceneries use those assignments, it wouldn't make much sense to change the default 'terraintextures.cfg' file, as we can use our own custom textures, and call them by name in the BGL.EDITED ------------I just looked at hyl512140.bgl, from Hawaii, and it has several different shorelines types:1053 ocean/white sand/no surf ( with waves )1055 ocean/black sand/no surf ( with waves )1056 ocean/urban/no surf ( with waves )1044 ocean/white sand/with surf ( with waves )1046 ocean/black sand/with surf ( with waves )1047 ocean/urban/with surf ( with waves )1068 lake/bank/perrenial ( no waves )They all look the same in the sim, due to the same texture and wavecontroller assignment. I think MS just got a little lazy here. :) They could have made more textures for us.So... if somebody good with textures is looking for a big project, here you go.I think the urban would be riprap or concrete wall. Surf could be a different look... perhaps rocks & boulders, rather than just sand... and could be assigned a different wave by creating a different wavecontroller efect... I think it could change the looks of lots of shores and perhaps roads and streams as well.Dick

Share this post


Link to post
Share on other sites

Hi DickYhanks for checking line textures; I feel good now.About island I have tested this in ocean (the island crossing the LOD8 borders)- create landclasses- with LWM, for each LOD13 declared with a landclass: - fill with water using LWMDataAreaFill1x1 - create land poly(s) - create water poly(s) in land poly(s) if needed (for lake/pond in the land poly(s)It works fine.About mesh (with Resample.exe), I have tried LOD9 including lakes made with LWM or Scasm.If the mesh is precise enough, the sim is good and we don'nt need to give elevation for the lake. Of course, if you have river, no elevation is requested if you want the line or LWM polys following the mesh. Excuse me, but I can see that Landclasses don't always work as expected.I have used Landclass Assistant, 257x257 raw file as you advise, 256x256 with my own values (CellX/Y dimensions) but I have sometimes troubles.Some textures are not well located;Sometimes they are uniformly green, grey (with autogen !)I can't determine the general rule in using Landclasses.With LWM, For custom textures ("253) it seems that we need at least 4 adjacent textures (making a 'square'); that's the same problem I have with Resample.exe (not yet tested with VTP)Christian

Share this post


Link to post
Share on other sites

Hi Christian.A resampled Bitmap, sliced by resample ( used for photoreal ) is the same BGL as a landclass with #253 ( or #252 for seasons ). It's just 2 ways to do the same thing, only that resampling a Bitmap will produce the slices. The BGL produced is a matrix of verticies, each having a landclass assignment. Most people think the assignment is for the cell... but the cell ( grountile ), is generated at runtime as a blend of the assignments of the 4 corners ( verticies ) of that cell.4 adjoining CUSTOM textures are needed, because of the blending normally done by the sim. The singular vertex given the landclass or CUSTOM assignment is supposed to blend into the 4 groundtiles that vertex touches. There is no blending with FS2002 for CUSTOM, so all 4 touched groundtiles will be unblended, with the CUSTOM assignment overriding the generic landclass, when the groundtile is generated at runtime.This is not the case with CFS2... those CUSTOM textures are crudely blended to the adjoining landclass. Looks terrible.There are 'm' textures that are masks useded for the blending, and I have not tried to create an 'm' for a CUSTOM set of textures, to see if it will then blend... I suspect it won't.------------------------The sim doesn't just place a texture like a VTP. There is masking, blending, alpha water... lots of things going on, that are very CPU dependant. Then the LWM and VTP polys and lines get processed, with their transparent alpha.... All this before the GPU even gets the data to display.------------------------A visual exercise would be to use cellgrid to view the landclasses you make. The verticies are defined by the corners of the cellgrids... this should help you to note the blending that flows out from the vertecies, to create the actual runtime groundtile.The number of verticies in a landclass is always the ( number of cells + 1 ). IF several landclasses are joined, like Justin Tyme's new US landclass, then the number of vertices will still be the ( number of cells + 1 ). That's where I came up with the idea of using a 257x257 matrix of verticies, for a single LOD5 landclass. There are lots of different opinions on this. ( What happens when 2 or 4 landclass TMFs are joined, if we already have a 257x257 set of points? The resultant superset landclass should now be 513x513, but we have joined 4 sets at 257x257... so it is now 514x514??? I don't know. Locic says it should be 513x513 { cells + 1 }. )-------------------------You can place a CUSTOM texture as a VTP poly, by using "252" or "253" as the texture number. But there are 2 things to remember:1) VTP textures must be vertically flipped ( and that must be done after the autogen is created, as the autogen displays properly ). This is a bug in the terrain engine.2) The texture format should be 8-bit, mipped, with Alpha as transparent, if you wish to use transparency. The DXT1 will display, but the alpha will not be water or transparent... it will be black. So the texture format should be changed by Imagetool, after vertical flipping.------------------------There are some advantages to using VTP for placing CUSTOM textures, rather than as a CUSTOM BGL made by resample. You can have transparency. You can 'trim' the texture. For example, you can make a CUSTOM of a city, and just shape the poly to the city's edges... and let the default landclass take care of the countryside. That solves a lot of problems with blending the CUSTOM to the default textures. Most CUSTOM textures are for the cities, villages, and the airfields. The placement of water can still be done with LWM polys.You can place VTP lines and polys over the CUSTOM texture. Using a Layer of 4-7, you can then use LWM polys to mask water, rather than needing an alpha channel for that.By using a transparent sheet for the CUSTOM, you could use the sheet as a nearly transparent layer, upon which to place CUSTOM autogen anywhere, overriding the default autogen. ( I'd still like to find a way to display the autogen without any texture! I've done it, but then you cannot VTP over it.)There still some room for experimentation here. I had been playing with making CUSTOM textures, with just a grid of city streets, and a grassy or concrete coloring of the city blocks. Then I can add autogen to populate the blocks with trees and buildings. Making the streets with VTP lines might interfere with the autogen ( not tested ).I think the autogen needs to be in the SceneDBWorldTexture folder, unlike resample-produced BGLs, that can have it in a local folder. 'jmf' posted some on that in an earlier thread.I don't know why gray or green tiles would show. That usually indicates a texture is missing, or you have tried an invalid landclass number... not assigned in lclookup.bgl...Dick

Share this post


Link to post
Share on other sites

Hello Dick,Thanks for your explanations.I have found why I obtained so bad results with Landclasses.I must put the landclasses alone in a directory containing a 'Scenery' directory (no 'Texture' directory needed), and the FS priority must be higher than the others containing LWM, VTP ... BGL (except excludes)I tried also to modify terraintextures.cfg.I took texture value 1164 and changed the names of the textures to new personnal ones containing railways.It works if we keep the same sequence of naming convention hw,hw,su,su,su,lw;I have tried also to modify the 'size' to 2 and 1; good results, but visually it's horrible.I have tried also to add a new texture in terraintextures.cfg; FS fails.The last test, create a line with texture value < 1024, FS fails; according to the SDK, we can use that for polygons, but not for lines (not written)For Water classes, no result at all.I think that using 257x257 raw file for landclass allows to avoid to create one landclass bgl more, in order to get good results on the 256 'line' or column.But 256x256 raw files work fine.I have tested also 32x32 raw files, but if I get the landclasses, all the surrounded LOD13 are filled with water, and I think that corresponds to a LOD5 surface.Christian

Share this post


Link to post
Share on other sites

Hi Christian.Here's a short thread on waterclass.http://ftp.avsim.com/dcforum/DCForumID10/1278.htmlWaterclass requires the use of the OLD resample.exe, to get a valid BGL. The thread explains the naming conventions.WaterClass also appears to be assigned to the verticies, not the cells. The watertiles ( cells ) are runtime generated, and blended, just like groundtiles.Other threads:http://ftp.avsim.com/dcforum/DCForumID10/1138.htmlhttp://ftp.avsim.com/dcforum/DCForumID10/1458.html----------------Both landclass and waterclass must be at least a multiple of an LOD5, and the actual cell count is 256x256 for each LOD5 covered. I use 257x257, because that is the number of verticies that define a 256x256 matrix. It works for me. But as you point out, 256x256 also appears to work, although John Cillis, Burkhard Renk, and Justin Tyme have all found registrational problems with 256x256... perhaps those problems plague 257x257 as well. A little tinkering with the sourcefile usually solves those problems. Waterclass is almost exactly the same as landclass... a slight change in the INF file... and, of course the values are different.You can use TMFViewer to look at the 'worldwc.bgl' to view the default waterclasses of the world.Dick

Share this post


Link to post
Share on other sites

Hi Dick,Thanks for your answer.For waterclasses I have not tested with the old Resample.exe (but done with Landclasses); When I ran Tmfviewer I got a error message for the watercalsses bgl, but did not think to test with the first release of Resample.exe.I wish you all a very happy new yearBonne et heureuse annee 2003Christian

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