Sign in to follow this  
Guest GerrishGray

Displaying photoreal with LandClass

Recommended Posts

Hi all.I've been looking into the possibility of bypassing some of Resample's functions to place CUSTOM tiles into FS2002. One way to get some flexibility in photoreal texture placement, is to us landclass BGLS ( ClassU8 ), to place the textures.Landclass source files can be created by a paint program, saving the result as an 8-bit RAW file ( a simple array with no header info ). Value #254 is a transparent value, allowing the default ( underlying ) texture to show on the tile. Value #253 is for CUSTOM textures... with value #252 for seasonal custom textures. The custom texture's filename acts as the world locator, and will be used by the landclass BGL... properly plugged into the correct location marked by either #252 or #253.So if you have a texture properly named ( CUSTOM resampling can derive the correct names ), and you know where to place a tile on a 256x256 data source, you should be able to place photoreal tiles anywhere in an LOD5 landclass area. Not just in rectangular blocks, as CUSTOM resampling does, but scattered, joined, lumped, or singly, anywhere you want, as long as the correct names are used, and the tile is marked as value #252 or #253.There is a lot of misunderstanding as to how to make an INF file to accurately display a 256x256 data source.Christian Stock has discovered that the Resample-created TMF file actually has a 257x257 array!But does that entire array get shown? Or does only that array mark the verticies of the landclass tiles? Or are edges dropped from that array, in order to display 256x256?I'll need a lot more experimentation to determine that!But what we do need, in order to place photoreal textures, is an INF file that allows accurate placement from a 256x256 source.Here's what I get:; nwcornerlc.inf; 256x256 source with value #253 at position 0,0[Destination]DestDir = .DestBaseFileName = "256"UseSourceDimensions = 1[source]Type = ClassU8SourceDir = .SourceFile = "256.raw"Lat = 25.3125Lon = 22.5NumOfCellsPerLine = 256NumOfLines = 256; 255 spanCellXdimensionDeg = 0.014705882352941176470588235294118CellYdimensionDeg = 0.011029411764705882352941176470588We use a 256x256 data source, but assume a 255x255 span, and that will allow accurate placement of textures, both in the source, and displayed at the world coordinates. The Lat and Lon coordinates are the usual for an LOD5 landclass mesh.This INF works with either version of Resample, and allows the accurate placing of any landclass or CUSTOM texture.Here's a CUSTOM inf I used to get the filename and texture... note the resultant texture must be converted to DXT1. I'll throw away the BGL... if you save the filename, you could replace the texture with anything you want ( in case you don't like Resample's resultant bitmap ). ; nwcustom.inf Uses a 256x256 blue bitmap; I'll discard the BGL and save the bitmap for use with landclass[Destination] DestDir = "." DestBaseFileName = "nwcustom" BuildSeasons = 0 UseSourceDimensions = 1[source]; nw corner Type = Custom SourceDir = . SourceFile = "blue.bmp" Lat = 25.3125 Lon = 22.5 NumOfCellsPerLine = 256 NumOfLines = 256 CellXdimensionDeg = 0.000057220458984375 CellYdimensionDeg = 0.00004291534423828125Dick

Share this post


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

Hi Dick,This sounds really interesting.I hope I didn't missunderstand you but does this mean that I will be able to use landclass data with alot better resolution than LOD5. I'm having quit som data with a pixelsize of 50 meter wich I would like to use to build a high resolution VFR scenery. Do you think that would be possible using your technique?RegardsAnders

Share this post


Link to post
Share on other sites

Sorry Anders.The visual resolution of Landclass, photoreal, LWM, and VTP sceneries is fixed at 4.8 meters.

Share this post


Link to post
Share on other sites

excellant approach...if we used a landclass type with 254, does that mean the entire texture (lod13 I assume) would be transparent, or could there be an overlay with transparent edges?Now that you've taught us the meaning of the numbering, we dont really need to run resample.exe to get it...easy to craft a spreadsheet that spits out the name for the LOD13 tile that contains any point.Bob Bernstein

Share this post


Link to post
Share on other sites

Hi Bob.#254 is a see-through for landclass... the previous texture shows in that area.#252 and #253 are the values that will display the CUSTOM texture on the LOD5 tile ( LOD13 size ). #252 needs the seasons ( I'm not sure if all are needed, but I assume this will also include LM/night textures ).The alpha channel will be water...just like any other photoreal. So 'feathering in' the tile is not possible. It will have a sharp edge, like any photoreal texture. So we still need to be creative in blending the image at the edges. I haven't tried DXT3, but I'm assuming it won't work. I don't know what a simple 8-bit with alpha ( CFS2 ) will do, either.We still need resample to generate the LandClass BGL ( so far ).And you're right that we could use a spreadsheet to give us the name(s) of the needed CUSTOM textures. I just use Resample for that now.The old resample does a good job, and doesn't seem to resample a texture for a tile if it's a multiple of 256, and the right CellX and CellY dimensions are used.There's nothing shocking here, just using the right numbers for a 256x256 source.Try it out!Dick

Share this post


Link to post
Share on other sites

Dear Dick,Many thanks for your many valuable posts in this forum, which I allways read with the greatest attention. I understand your way of, say, placing a single photo tile, using Type = ClassU8. However it seems to me that it is exactely the same as using Type = Custom. If you use a INF file (Type = Custom) with a destination coverage of a single photo tile, the generated BGL also covers a complete LOD5 quadrant as in a LandClass BGL. If you check this BGL with TmfViewer you will see a 256 x 256 area with values of 254 except on the location where you specified the photo tile which will be 253 (if no seasons case). For scattered tiles I thought I could use an INF file with multiple destinations sections but, actually, I never tried it. If that is not possible, then I see a bypass using your method.What would be VERY USEFUL was to place a photo tile with BGLC and Terrain Vector Data techniques. May be (you are the expert!), it is not too difficult to write a simple script or program that would generate the required data to cover a LOD13 quadrant with a square 256 x 256 texture, given the location of the LOD13 quadrant. The advantadge being using the alpha channel for transparency and not for water.Kind Regards, Luis

Share this post


Link to post
Share on other sites

Hi Luis.Yes, you understand where I'm going with this. VTP Method1 is great for adding a tile with transparency... CUSTOM is great for adding the water. An edge could be feathered by using a default texture ( or screenshot ) for the VTP1, and then altering that texture so it is clear ( alphaed ) in the middle, and solid at the edge. That would be a blended edge. Then place that over a photoreal tile... haven't tried this yet!!! So I don't know if that is possible. But it is intriguing. You could have a blended edge with alpha water, using 2 textures and 2 bgls.Or the ugly black-bordered textures of Resample2 could be used as a basis of a transparently edge-blended VTP1 placed textures.I tried a multi INF file for photoreal, and got a zillion textures before I stopped it. I haven't tried it with the OLD Resample. I also haven't tried tmfmerge.A simple 8-bit with alpha has water as the alpha. I move a Smiley to the texture folder, and renamed it as '013033200000000Su.bmp'. It shows properly ( and orientated properly ), from the Landclass BGL. If you've got the right name, and the tile is #252 or #253, it will show.

Share this post


Link to post
Share on other sites

Hi Dick,In FS2000 and FS2002 I used the alpha channel to place a photo polygon over a flatten area with "old" TexPoly() command. With 4 bits of alpha (16 levels of transparency) the blending is very good.Here are examples of:- the original photo resized to 50% to save "bandwidth" - the 4-bit alpha channel also resized- the placement on FSRegards, Luis

Share this post


Link to post
Share on other sites

Hi Luis.That looks great. I hope we can go that way with VTPs.I have found there is no way to mix photoreal and VTPs in the same LOD13 Area... I had hoped we could fool the sim into believing the texture was simply landclass, but FS2002 is smarter than I am. :(That rules out any blending of a photoreal texture to the background, except by very hard work coloring the texture.However, the phototexture can still be used as a VTP1 or VTP2 texture, and that allows blending, feathering... The drawback? Water would have to be made with LWM polygons, as the alpha channel would be transparent ( not water ).There is something I'd like to know. What is the maximum resolution of the old TexPolys? Is it better than 4.8 meters?Dick

Share this post


Link to post
Share on other sites

>There is something I'd like to know. What is the maximum >resolution of the old TexPolys? Is it better than 4.8 >meters? Hi Dick,There is no limit to resolution. Luis

Share this post


Link to post
Share on other sites

Hi Luis.To place a 256x256 polygon with VTP Method1 isn't really hard.Here's an example:include TDFMacros.incinclude TDFHeaders.inc ; LOD13 edge marker; N25* 18.75' E22* 30.00'BGLHeader 26, 24, 24, 21, TerrainHeaderStart, VTPHeaderVTPHeader label word VTPFileHeader 256, VTPIndexStart, TextureStart, VTPEndVTPStart label word; ---------------------------------------------------------------------------------------------------------; Cell_432_184datamark_0 label word VTPDataArea 1, 0, 0, 0 VTPLayer 4, 1 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, 0datamark_1 label word; ---------------------------------------------------------------------------------------------------------Cell_432_184 EQU VTPCellID 0, 432, 184 VTPIndexStart label word VTPIndexHeader 1, VTPIndexData, VTPStart VTPIndexData label word VTPIndexEntry Cell_432_184, VTPStart, datamark_0, datamark_1; ---------------------------------------------------------------------------------------------------------TextureStart label word VTPTextureListHeader 1, TextureIndexStart, TextureDataStart, TextureDataEndTextureIndexStart label word VTPTextureListEntry TextureDataStart, texturemark_0, texturemark_1TextureDataStart label word texturemark_0 label word VTPTextureName "blue.bmp" texturemark_1 label wordTextureDataEnd label word; ---------------------------------------------------------------------------------------------------------VTPEnd label wordI've enclosed TXT attachments that are the include files... save and rename them as 'TDFHeaders.inc' and 'TDFMacros.inc'They must be in the same folder as BGLC, and your TXT bglc code file... just drag'n'drop the bglc code on the BGLC icon.The BGL Header Bounds would need to be changed, and the x, y of the VTPDataArea ( LOD13 ). Also the Cell numbers ( LOD8 ), would need changing, and the texture name. TDFCalc, included with the LWM tutorial works for finding the numbers. The attached include files are updates, and should replace the ones with the LWM Tutorial.The "blue.bmp" is a 256x256 8-bit with alpha, mipped bitmap... blue around the edges and transparent in the middle. The Layer is 4 so everything will show over it... great for checking the LOD13 boundries of an area, and I use it with screenshots to copy the default texture!But, the texture could just as easily have been a photoreal BMP, as long as it has been run through imagetool for the formating and mipping. Remember, VTPs use the alpha for transparency.Dick

Share this post


Link to post
Share on other sites

each time I look at these images, the transparent area looks darker than the outside...I love these illusions.B

Share this post


Link to post
Share on other sites

Hi Bob.You're right. The transparent portion does appear to be darker. I'll try something later to place several transparent BMPs on top of each other, and we'll see if it gets darker.:)Dick

Share this post


Link to post
Share on other sites

Hi DickI'm trying to understand here. Are you in fact saying that we can place a custom texture on a normal landclass cell simply by naming the texture correctly and setting the landclass to #253 (or #252)? If that is the case, then surely resample.exe and a custom .inf file aren't even needed directly - one could just use John Cillis's Landclass Assistant to do the work of creating the landclass BGL very easily? All that would be needed then would be the texture(s) in 256x256 DXT1 format and the correct filename(s). So then the only outstanding need is the suggested little spreadsheet to generate the required filename from the Lat/Lon coordinates?In fact, I suspect that John Cillis would be interested in adding this to the functionality of Landclass Assistant.Or do I have the wrong end of the stick?BTW, the blending between one cell and the next for the default ground textures is controlled by the strange ?????m??.bmp files - the sets that don't have them are the ones that produce unblended 'square' edges.CheersGerrish

Share this post


Link to post
Share on other sites

Hi Gerrish.Yes. I'm placing CUSTOM textures with a LandClass BGL.We still need resample ( so far... ), to give us the BGL.There are some problems...Each landclass texture placed, expects a masking border to the west and south ( at least with the INF numbers I use ). But Custom textures have no blending masks, so the areas to the west and south are blanked.That is fixed by adding the correct CUSTOM textures ( with the correct names ) for the south and west.First pic is lava over my home ( value #133 ).Second pic is a single custom texture, appropiately named, and residing in a local texture folder.Third pic is extra, properly named textures, added to the local texture folder, to fill the blank areas.The BGL was a Landclass with value #253 for the Custom tile, and #254 ( transparent ) filling the rest of the LOD5 Landclass area.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