Jump to content
Sign in to follow this  
rhumbaflappy

VTP & Custom LandClass #252

Recommended Posts

Guest

Dear friends,It seems that what Dick has suggested in the past really works.This is the bit of code used to test the idea. To test this you need to place the bgl in a folder without texture folder at the same level and the correspondent texture which in this case is 012121110322321??.bmp in the SCENEDBWORLDTexture folder together with the agn if you want autogen with your custom folder. This obviously solves the problem of having wave effects together with custom textures.Now the problem is: Yes, there is a problem. As already reported by Dick in a post a long time ago, the texture coordinates are not according to what it says in the SDK. Is there a way to place the texture correctly whithout having to invert all the textures? Maybe the only way is with Method 1 but I haven

Share this post


Link to post
Share on other sites

Hi jmf.This is very good news! You've found out how to have custom autogen with a custom texture using VTP polys!And you've now seen first hand the effects of the vertical inversion of VTPs. There is no way to undo this for VTP2s... except by using a paint program to vertically flip the texture.Using VTP1s, you can force the flipping in the code. VTPPolyMethod1 4, 0, 1 VTPPointXYUV 0, 0, 0, 255 VTPPointXYUV 255, 0, 255, 255 VTPPointXYUV 255, 255, 255, 0 VTPPointXYUV 0, 255, 0, 0I'll play with this some tomorrow, and see what I can find out.The alpha should be transparent, so I'm thinking it's a problem with the texture. I use 8-bit mipped with alpha ( 87Kb size ) for VTP textures... I'll work on that as well.If we can have autogen with CUSTOM VTP that is a real plus! I never thought of your solution. I'm noting the autogen is not flipped vertically... so I'm guessing the VTP1 code solution may be the best.This allows resampled photoreal to be placed as a VTP layer with autogen, and should allow us to also have shorelines, roads, streams, LWMs... appear over the photoreal, as your sceeen shot indicates. Also, with the appropriately named textures, you can have seasons with this method. Mesh-clinging photoreal, with autogen, as a layer we can manipulate... perfect! ( this should work as a textured water layer ( 0-3 ) as well... allowing autogen over water? )This eliminates all restrictions on photoreal.:)Dick

Share this post


Link to post
Share on other sites
Guest

Hi Dick,solved the problem with the transparency! It seems it does not work with DXT1. 8 bit with alfa works great! Thanks for the suggestion!The problem is that the filesize grows from 43k to 87k which for a large number of tiles might be a lot a HD space!!One other thing! Since VTP allows placement of textures over an entire cell, how big can these textures be? I am wondering if I could cover a wider area by merging the textures or even better by not slicing them in the first place. What are the constraints on the texture size and aspect ratio? Is this known?I was not looking at placing a texture of 40 mb over an entire cell but may be a 1024 * 1024 or 2048 * 2048 or even 2048 * 1024 texture placed over 4 x 4 areas, 8 x 8 areas or 8 x 4 areas respectively. It would speed up coding a lot!! Also less textures to flip vertically! ;) And much compact texture directories!!Cheersjmf

Share this post


Link to post
Share on other sites

Hi jmf.I don't know about the size constraints, but I wouldn't be surprised if we are restricted to 256x256. Also, a DXT1 may be alright, if you're willing to make an LWM bgl for the watermask.Dick

Share this post


Link to post
Share on other sites
Guest

HI again,Silly question mine! Of course that for custom textures I can only use textures 256 x 256 because each tile has a fixed size and texture name.Now, I tried method1 but it seams that the only way to make the texture show up is by specifying the filename and not the landclass 252. I hear an alarm sound here and I hope I made a mistake somewhere. Otherwise the only way is to flip over all the textures!Anyone know of an utility that does this in a batch mode fashion?Below is the code with both method 1 & 2.Cheersjmfinclude TDFMacros.incinclude TDFheaders.incBGLHeader 34, 32, -15, -18, TerrainHeaderStart, VTPHeaderVTPHeader label wordVTPFileHeader 256, VTPIndexStart, TextureStart, VTPEndVTPStart label word; Cell_349_161 Area Datadatamark_1 label word; VTPDataArea 1, 0, 5, 30 ; layercount,autocalc,u,v VTPDataArea 1, 1, 0, 0 ; layercount,autocalc,u,v VTPLayer 4, 1 ; layerid,replace VTPNumTexturesInLayer 1, 0 ; texturecount,0 VTPTextureId 0, 0 ; id,0 VTPPolyCount 1, 0 ; polycount,0 VTPPolyMethod2 4, 0, 0; VTPPolyMethod1 4, 0, 1 ; pointcount, strip, uvexplicit VTPPointXY2 5355, 11730 VTPPointXY2 5355, 11985 VTPPointXY2 5610, 11985 VTPPointXY2 5610, 11730; VTPPointXYUV 0, 0, 0, 255 ; VTPPointXYUV 255, 0, 255, 255; VTPPointXYUV 255, 255, 255, 0; VTPPointXYUV 0, 255, 0, 0 datamark_2 label wordCell_349_161 EQU VTPCellID 0, 349, 161VTPIndexStart label wordVTPIndexHeader 1, VTPIndexData, VTPStartVTPIndexData label wordVTPIndexEntry Cell_349_161, VTPStart, datamark_1, datamark_2TextureStart label wordVTPTextureListHeader 1, TextureIndexStart, TextureDataStart, TextureDataEndTextureIndexStart label wordVTPTextureListEntry TextureDataStart, texturemark_1, texturemark_2TextureDataStart label wordtexturemark_1 label wordVTPTextureName "252";VTPTextureName "012121110322321Fa.bmp;012121110322321Fa.bmp;012121110322321Fa.bmp;012121110322321Fa.bmp;012121110322321Fa.bmp;012121110322321Fa.bmp;"VTPTextureType 1, 0, 0, 4texturemark_2 label wordTextureDataEnd label wordVTPEnd label word

Share this post


Link to post
Share on other sites

Hi jmf.I think I have a solution to the problem that will allow you to code the vertical flip, rather than redo all your slices.include TDFMacros.incinclude TDFHeaders.inc; N23* 14.72' E24* 59.71'; Autogen testBGLHeader 25, 20, 26, 22, TerrainHeaderStart, VTPHeaderVTPHeader label word VTPFileHeader 256, VTPIndexStart, TextureStart, VTPEndVTPDataStart label worddatamark_0 label word VTPDataArea 1, 0, 10, 28 VTPLayer 4, 0 VTPNumTexturesInLayer 1, 0 VTPTextureId 0, 0 VTPPolyCount 1, 0 VTPPolyMethod1 4, 0, 1 VTPPointXYUV 0, 0, 0, 255 VTPPointXYUV 255, 0, 255, 255 VTPPointXYUV 255, 255, 255, 0 VTPPointXYUV 0, 255, 0, 0 VTPDataArea 1, 1, 10, 28 VTPLayer 5, 0 VTPNumTexturesInLayer 1, 0 VTPTextureId 1, 0 VTPPolyCount 1, 0 VTPPolyMethod2 4, 0, 0 VTPPointXY2 6630, 11220 VTPPointXY2 6885, 11220 VTPPointXY2 6885, 11475 VTPPointXY2 6630, 11475datamark_1 label wordCell_437_189 EQU VTPCellID 0, 437, 189VTPIndexStart Label word VTPIndexHeader 1, VTPIndexData, VTPDataStartVTPIndexData label word VTPIndexEntry Cell_437_189, VTPDataStart, datamark_0, datamark_1TextureStart label word VTPTextureListHeader 2, TextureIndexStart, TextureDataStart, TextureDataEndTextureIndexStart label word VTPTextureListEntry TextureDataStart, texturemark_0, texturemark_1 VTPTextureListEntry TextureDataStart, texturemark_1, texturemark_2TextureDataStart label word texturemark_0 label word VTPTextureName "013033230323210Wi.bmp;013033230323210Hw.bmp;013033230323210Sp.bmp;013033230323210Su.bmp;013033230323210Fa.bmp;013033230323210Lm.bmp" VTPTextureType 0, 0, 0, 0 texturemark_1 label word VTPTextureName "253" VTPTextureType 0, 0, 0, 0 texturemark_2 label wordTextureDataEnd label wordVTPEnd label word[/font]The project folder has both 'scenery' and 'texture' sub-folders. The 'scenery' contains the BGL, the 'texture' contains the slices ( properly named ).The 'FS2002scenedbworldtexture' contains the autogen and '013033230323210Su.bmp'.... but this texture is altered! This texture is transparent ( actually it has 1 pixel as grey, and the rest as transparent, 8-bit, and not mipped ).The code uses #253 so only one texture needs to be in the worldtexture folder, as 253 is for all seasons, and we just want the autogen.The result is the autogen shows on layer #5, and the seasonal textures are on layer #4 ( flipped vertically due to the use of VTP1 for that layer ).This may not be the final, or best solution, but it works, and places the autogen correctly onto the correctly orientated texture.If this turns out to be the best solution, we might be able to construct a Macro to take the tedium out of the coding.It's a little bit of trickery. I tried both polys as layer #4, and it worked, but I get a FS crash to desktop occasionally... I don't know why. That problem may have to do with one of the scenery.dat files. I noted that the scenery.dat file is created no matter where the sim was started... probably due to the use of the VTPm2 poly calling a landclass texture... not sure... and it may only be a concern during the design stage....possibly the header should be expanded to include the entire world?This actually allows placing custom autogen anywhere, irregardless of the displayed texture. We could place the autogen of a custom city on a cement texture if desired, as the CUSTOM name's texture is transparent, and the VTP1 poly isn't really tied to it. ( We might want to experiment with the transparent texture type ).Dick

Share this post


Link to post
Share on other sites

Hi jmf.Here's the autogen in the desert.include TDFMacros.incinclude TDFHeaders.inc; N23* 14.72' E24* 59.71'; Autogen testBGLHeader 25, 20, 26, 22, TerrainHeaderStart, VTPHeaderVTPHeader label word VTPFileHeader 256, VTPIndexStart, TextureStart, VTPEndVTPDataStart label worddatamark_0 label word VTPDataArea 1, 1, 10, 28 VTPLayer 4, 0 VTPNumTexturesInLayer 1, 0 VTPTextureId 0, 0 VTPPolyCount 1, 0 VTPPolyMethod2 4, 0, 0 VTPPointXY2 6630, 11220 VTPPointXY2 6885, 11220 VTPPointXY2 6885, 11475 VTPPointXY2 6630, 11475datamark_1 label wordCell_437_189 EQU VTPCellID 0, 437, 189VTPIndexStart Label word VTPIndexHeader 1, VTPIndexData, VTPDataStartVTPIndexData label word VTPIndexEntry Cell_437_189, VTPDataStart, datamark_0, datamark_1TextureStart label word VTPTextureListHeader 1, TextureIndexStart, TextureDataStart, TextureDataEndTextureIndexStart label word VTPTextureListEntry TextureDataStart, texturemark_0, texturemark_1TextureDataStart label word texturemark_0 label word VTPTextureName "253" VTPTextureType 0, 0, 0, 0 texturemark_1 label wordTextureDataEnd label wordVTPEnd label word[/font]I don't know if you can see it, but the transparency leaves a slight darkening tint to the LOD13 Area. That's why I'm wondering if there is a better texture solution for the transparency.Dick

Share this post


Link to post
Share on other sites

Well, I thought I found the solution for the transparent texture... just don't have one! But it doesn't work properly, as it interferes with the texture we want to lay.The properly named autogen will display without any texture in the worldtexture folder!... so just make the properly named autogen and move it to that folder, and a reference to LC# 253 in the VTPm2 poly will display the autogen without any texture at all ( so there is no disk-space penalty for displaying the autogen ).So we can display CUSTOM autogen anywhere we want, without any texture being displayed... But it seems to interfere with other texture layers being displayed... more testing needed!Dick

Share this post


Link to post
Share on other sites

Hi jmf.I've tried everything I can think of, and the solution seems to be as I outlined above.Draw VTPm1, flipping the texture vetically in the code. The texture must be stored in the local 'texture' folder. Then draw a VTPm2 transparent, "phoney", CUSTOM textured poly, and have that texture and it's autogen in the 'scenedbworldtexture' folder. The autogen is orientated correctly, and the VTPm1 orientates the texture correctly.They can have the same #4 layer. Note that I made the texture reference to #253 ( single season ), and I made that the first texture in the index... as you'd just add more textures to the index for more CUSTOM areas covered, and this way those new textures can be in order... not a big deal.include TDFMacros.incinclude TDFHeaders.inc; N23* 14.72' E24* 59.71'; Autogen testBGLHeader 25, 22, 26, 23, TerrainHeaderStart, VTPHeaderVTPHeader label word VTPFileHeader 256, VTPIndexStart, TextureStart, VTPEndVTPDataStart label worddatamark_0 label word VTPDataArea 1, 0, 10, 28 VTPLayer 4, 0 VTPNumTexturesInLayer 1, 0 VTPTextureId 1, 0 VTPPolyCount 1, 0 VTPPolyMethod1 4, 0, 1 VTPPointXYUV 0, 0, 0, 255 VTPPointXYUV 255, 0, 255, 255 VTPPointXYUV 255, 255, 255, 0 VTPPointXYUV 0, 255, 0, 0 VTPDataArea 1, 1, 10, 28 VTPLayer 4, 0 VTPNumTexturesInLayer 1, 0 VTPTextureId 0, 0 VTPPolyCount 1, 0 VTPPolyMethod2 4, 0, 0 VTPPointXY2 6630, 11220 VTPPointXY2 6885, 11220 VTPPointXY2 6885, 11475 VTPPointXY2 6630, 11475datamark_1 label wordCell_437_189 EQU VTPCellID 0, 437, 189VTPIndexStart Label word VTPIndexHeader 1, VTPIndexData, VTPDataStartVTPIndexData label word VTPIndexEntry Cell_437_189, VTPDataStart, datamark_0, datamark_1TextureStart label word VTPTextureListHeader 2, TextureIndexStart, TextureDataStart, TextureDataEndTextureIndexStart label word VTPTextureListEntry TextureDataStart, texturemark_0, texturemark_1 VTPTextureListEntry TextureDataStart, texturemark_1, texturemark_2TextureDataStart label word texturemark_0 label word VTPTextureName "253" VTPTextureType 0, 0, 0, 0 texturemark_1 label word VTPTextureName "013033230323210Wi.bmp;013033230323210Hw.bmp;013033230323210Sp.bmp;013033230323210Su.bmp;013033230323210Fa.bmp;013033230323210Lm.bmp" VTPTextureType 0, 0, 0, 0 texturemark_2 label wordTextureDataEnd label wordVTPEnd label wordDick

Share this post


Link to post
Share on other sites
Guest

Hi dick,I am sorry but I was away! I only saw your messages now! I need to digest them carefull I will get back to you soon. It is strange that we need to "trick" the sim to do what we need. However for my particular case I am inclined to prefer the flipping of the textures even if I have to write a small utility to do that! But you end up finding a new way of doing things ;)What I find strange though it why the texture does not show up with the VTP1 method.Cheersjmf

Share this post


Link to post
Share on other sites
Guest

Hi Dick,Now I understand what you are doing! Very tricky ;)You are using VTP1 to display the texture correctly and VTP2 to place the autogen associated with that texture.In terms of coding and as you suggest a macro could simplify the process. But still we have to supply the names of all the CUSTOM textures which for a large area can be a bit tedious process (unless there is a way to work out those names from the area or cell cordinates).On the other hand I am not to happy about the dupplication of textures in two different folders. I wonder if placing the texture to be displayed in project's texture folder and the associated agn file in scenedbworld texture folder would allow us to see the autogen even in the absence of the texture.One other thing I was wondering is if the macro VTPPointXY2 could be changed to display the texture in the correct orientation. Maybe if we understand the process by which the sim calculates the UV parameters for method2 we could do something.I think we are playing with things that even Microsoft do not know about ;)Cheersjmf

Share this post


Link to post
Share on other sites

Hi jmf.VTPm2 is always orientated to the north, and tiled exactly to the LOD13 bounds. If you overlap a bound, it will just repeat, always orientated...just like a default groundtile Landclass texture. I did find a freeware image batch processor... XnView, that works as expected. It will flip bitmaps... but flip them before the slices converted to anything other than a simple bitmap, and create your autogen before flipping, as autogen is displayed correctly.In XnView, the menu item is: Tools......Multi Convertthen select the 'Advanced Options' button, for the vertical flip.The batch can be done for a whole folder with the 'Add Folder' button, and a different folder can be used to gather the resultant flips. Very nice, and the price is right!That would solve the problem of a dual bitmap for you, as you could then just use VTP2 with the flipped slices. But we should remember the transparent trick for the future, if needed.Why on earth this vertical flipping occurs with the terrain engine is beyond me. I consider it a bug, unless there is some undocumented switch we have missed to correctly orientate textures.------------------There is one consideration about adding files to the scenedbworldtexture folder. A large amount of textures culd quickly build up in this folder... 6 textures plus the autogen for each tile. With the "trick" method, we have an extra texture for the transparent phoney, but now we add only 1 texture and one autogen to the scenedbworldtexture folder.... I don't know if that should be a concern. It would be nice if the autogen could be in the 'local' folder, but that doesn't seem possible with this method.Dick

Share this post


Link to post
Share on other sites

Hi jmf.After playing with this all day, I discovered we cannot have night textures with VTPm1... they just don't show. So, again the SDK isn't quite truthful.So, placing CUSTOM textures as VTP polys, with autogen, needs to use VTPm2 polys ( using the '252' texture name, as you first surmised ).The CUSTOM textures, and autogen, need to be in the 'scenedbworldtexture' folder. The textures need to be flipped vertically AFTER the autogen is created, then can be formatted as DXT1-mipped with imagetool. The textures need the correct CUSTOM name ( you can slew to the area and use LandCalc2 for that purpose ).The water will need to be LWM water polys, and the default water can be used with the CUSTOM slices, as the original LWMs still work.Layers 4-7 are available for land, letting the LWMs still work, and shorelines, roads, streams still work. And other poly layers may be used, but they will exclude the CUSTOM autogen where they lie, as do LWMs streams, roads... Other poly shapes may have their own autogen if they are referenced as landclass numbers, rather than names.-----------------We are be able to use portions of CUSTOM textures, and still have the autogen work! That would allow you to use a photoreal of a city ( or airport ) with it's edges 'trimmed' by the poly shape. So you can display just a city to it's limits, if desired, and the autogen will behave, sticking to just the shape of the poly, and in the proper orientation. ( the CUSTOM texture must still be 256x256, and flipped after autogen created ). Runways will still exclude autogen in an area twice as long and wide as the runway ( hardcoded in the sim ).------------------------I haven't played with the texture format much. I think 8-bit mipped will also work, and that would allow transparency to be used with the CUSTOM texture, if desired. So then portions of the CUSTOM could be used, and parts rendered tranparent by the texture itself. So you could allow an underlying texture to be used.I was thinking of making a Terrascene-derived set of textures that are just roads, and making the rest of the texture transparent. I can then make an autogen for the houses. After flipping and mipping, the CUSTOM textures ( roads with trasparency ) can be overlayed onto a grassy polygon for my small town. The end result is accurately placed streets and autogened houses, over a base texture of grass, and they should all change with the seasons, and allow streams, other roads, water, etc...Dick

Share this post


Link to post
Share on other sites
Guest

Hello Rhumbaflappy I wanted to try your method : I designed a custom autogen file (in ..worldtexture), but with no associated bmp. In my bgl, i used a small VTPm2 polygon (about 100*100 units, only a part of the LOD13 area) with 252 (or 253) as class number texture. Well, may autogen is correctly displayed above the default landclass texture, but the problem is my VTP roads (layer 31 or 32) are not displayed in the entire LOD 13 area where this VTPm2 is located (i thought only those overlapped by my VTPm2 polygon would be not displayed). Is it a problem of mine or a general problem ?

Share this post


Link to post
Share on other sites

Hi Greywander2002.You're getting the same problem I had noticed in post #7, above.The missing CUSTOM texture excludes all the VTP layers.Post #8 is the answer.Here's some code that uses a Macro to ease the task of placing CUSTOM textures as a layer. This code uses texture #253 for all-season CUSTOM, and it works well with transparent 8-bit textures ( although there is a slight tint to the transparent area ). In the screenshot, I used a mask of grey road lines in the transparency, to make city streets.include TDFMacros.incinclude TDFHeaders.inc; -------------------------------------VTPm2CUSTOM Macro AreaX, AreaY, Layer, bReplace, TextureID WORD ( AreaY * 800h ) + ( AreaX * 40h ) + ( 1 * 20h ) + 1 BYTE ( bReplace * 80h ) + Layer BYTE ( 0 * 80h ) + 1 BYTE ( 0 * 80h ) + TextureID BYTE ( 0 * 80h ) + 1 BYTE ( 0 * 40h ) + ( 0 * 20h ) + 4 WORD AreaX * 255 + 4080 WORD AreaY * 255 + 4080 WORD AreaX * 255 + 4335 WORD AreaY * 255 + 4080 WORD AreaX * 255 + 4335 WORD AreaY * 255 + 4335 WORD AreaX * 255 + 4080 WORD AreaY * 255 + 4335EndM; -------------------------------------; N42* 38.37' W88* 37.55'; -------------------------------------; Autogen testBGLHeader 43, 42, -88, -89, TerrainHeaderStart, VTPHeaderVTPHeader label word VTPFileHeader 256, VTPIndexStart, TextureStart, VTPEndVTPDataStart label worddatamark_0 label word VTPm2CUSTOM 27, 22, 32, 1, 0 VTPm2CUSTOM 28, 22, 32, 1, 0 VTPm2CUSTOM 29, 22, 32, 1, 0 VTPm2CUSTOM 30, 22, 32, 0, 0 VTPm2CUSTOM 26, 23, 32, 1, 0 VTPm2CUSTOM 27, 23, 32, 1, 0 VTPm2CUSTOM 28, 23, 32, 1, 0 VTPm2CUSTOM 29, 23, 32, 1, 0 VTPm2CUSTOM 30, 23, 32, 0, 0 VTPm2CUSTOM 26, 24, 32, 0, 0 VTPm2CUSTOM 27, 24, 32, 0, 0 VTPm2CUSTOM 28, 24, 32, 1, 0 VTPm2CUSTOM 29, 24, 32, 0, 0; ---------------------------------------------datamark_1 label wordCell_194_134 EQU VTPCellID 0, 194, 134VTPIndexStart Label word VTPIndexHeader 1, VTPIndexData, VTPDataStartVTPIndexData label word VTPIndexEntry Cell_194_134, VTPDataStart, datamark_0, datamark_1TextureStart label word VTPTextureListHeader 1, TextureIndexStart, TextureDataStart, TextureDataEndTextureIndexStart label word VTPTextureListEntry TextureDataStart, texturemark_0, texturemark_1TextureDataStart label word texturemark_0 label word VTPTextureName "253" VTPTextureType 0, 0, 0, 4 texturemark_1 label wordTextureDataEnd label wordVTPEnd label word( I haven't got to the autogen yet, but it will work ).http://www.flatface.net/~rhumba/Pics/Delavan%20topdown.JPGDick

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...