#1726017 - 04/19/05 08:49 PM
A new theory on height and texture files
|
Joined: Nov 1999
Posts: 1,524
Keithb77
Member
|
Member
Joined: Nov 1999
Posts: 1,524
UK
|
I have had a slightly radical rethink! The texture files were there all along - the ter_ul, _l, _m and _h ARE the texture files. The _hm file is the height map, the hx and ht files are very very similar but presumably modified for a specific purpose. I have tried applying the PAL files as a palette to the MAP files. Although the colours are wrong, the _UL etc files come out looking like shaded relief pictures and the _HM etc files like 'filled-in' contour maps. This begins to make much more sense. I've put an example UL jpg up at my website on the Longbow page, together with the version of LBMap that generated it. You can clearly see roads/tracks and other details. This clearly isnt the whole story but we are getting closer! The PALette files are very big - there is space for 180 256-byte palettes in the file, which may be a clue! When I thought I was setting the heights to a constant (see New maps thread) I was actually setting the colours constant. DOH! Apologies for being a dope! Cheers, Keith PS there is lots of stuff in this new LBMap thats not documented but hopefully will be obvious. Its an installable package, including the OCX it needs. You can browse for MAP files, select PALette files and offsets within them (offset 6 within the palette seems better than 0) etc etc
|
|
#1726021 - 04/19/05 11:48 PM
Re: A new theory on height and texture files
|
Joined: Mar 2005
Posts: 160
Evil Lurker
Member
|
Member
Joined: Mar 2005
Posts: 160
Oregon
|
Here's the link to Eagles: Link I got it from the "Appearance folder- palette for DOBJECT.TEX" thread.
A7N8X Dlx., 2700+@3200 settings, 9700Pro, Sony 17" Trinitron, Altec Lansing 2.1 speakers. WinXP Pro.
|
|
#1726022 - 04/19/05 11:58 PM
Re: A new theory on height and texture files
|
Joined: Mar 2005
Posts: 160
Evil Lurker
Member
|
Member
Joined: Mar 2005
Posts: 160
Oregon
|
Keith: I now have a totally flat Azerbaijan! But still correctly coloured. Is it colored exactly like it would appear if there were heights in the game? If you have the room on your server, could you post a couple of screenshots? So, it appears that the [NTC] TerrainHeight=28 [AZR] TerrainHeight=50 are used as multipliers for the values in ter_ht.map file, would you agree with that? By setting those to zero, you also get a totally flat map, but not at sea level. Your technique results in a totally flat map at sea level, I'm assuming. (Yeah, I know what they say about about assuming) I'm trying to figure out here the exact formula for the TerrainHeight value, we should have enough data now to derive it if we wish.
A7N8X Dlx., 2700+@3200 settings, 9700Pro, Sony 17" Trinitron, Altec Lansing 2.1 speakers. WinXP Pro.
|
|
#1726023 - 04/20/05 08:13 AM
Re: A new theory on height and texture files
|
Joined: Nov 1999
Posts: 1,524
Keithb77
Member
|
Member
Joined: Nov 1999
Posts: 1,524
UK
|
EL, I'd post screenshots if I could take them! They come out psychedelic pink. The terrain is coloured exactly like the hills were there. You should be able to reproduce my experiment using the latest LBMap, which includes all required components. Just select the ter_ht.map file, enter Height Max and Min values (I used 100 for both, try 0 and 200 too) and click [Update]. Exit LBMap and run LB2 as normal. NB copy the ht file first!
Polack, maybe the textures are pre-rendered using that VQ technique? I've looked into the add-on terrains available, Bosnia and Kosovo, and neither have the _l, _m or _h files at all, just the _ul map. Also some of the palettes are just 1024 bytes. There is a snow palette for the standard terrain that is also just 1024 bytes, it replaces the 140032 byte standard palette and changes some ground colours to white, leaving the rest unchnged. But the sky turns black! So the ground colours are in the first 256 colours (768 bytes) and other colours follow?
If we can crack the palette issue, new terrains are easier than expected, if not they will be harder!
I've looked through the links you supplied but not yet found an ideal candidate...... We need height data at 32M resolution (30M should be ok) in a nice simple format, and a matching photograph at preferably 4M resolution.
Edit: The Spanish site looks hopefull, they've got 2M resolution height-maps and textures, better than we need. Just need to stitch a few together and crop to 50K*50K and reduce the resolution and then think how to import them.........
Cheers, Keith
|
|
#1726024 - 04/20/05 12:13 PM
Re: A new theory on height and texture files
|
Joined: May 2001
Posts: 5,462
Polak
Hotshot
|
Hotshot
Joined: May 2001
Posts: 5,462
New York, NY
|
Keith, progress you are making is tremendous. I am just only assisting you with some excerpts of informations found around (like that precious IMHO found by EL) which frankly I cannot even make too much use, but you can. So here is something which maybe could give some insight into palettes: 4.1 Colour management The program works in indexed-colour video mode with 256 colours, because that mode allows nice pictures while providing fast image generation compared to hi-colour and true-colour video modes. The 256-colour palette is not totally fixed, it is divided up into three parts. Those parts may be changed if the components of the world change, i.e. we use another terrain or another sky texture. The first 128 colours belong to the terrain, the next 96 to the objects and the last 32 to the sky. Actually, the 96 colours maintained for the objects are fixed, but the other two parts are not.
The basic unit of the simulation is a mission. A mission file determines which terrain and which sky to use. The mission file stores the palette to be used with the specific mission. This allows the programmer, for example to use the same sky bitmap with different palettes in different missions. In one mission, the regular palette may be used, while in a night mission he/she may use a darkened version of the palette.
Two tables are also required to produce some effects. Because the program uses an indexed colour mode, the calculation of the Gouraud-shading used at the terrain rendering is not straightforward. The shading table is used to help shading calculations. The basic idea is the following: let us suppose, that we have two colours, both represented by a one-byte indexes to the palette entry. (Actually, the index may be only in the range of 0..127, because we use only 128 colours for the terrain). We would like to compute several colours, that fall between our two selected ones, and are also in the palette. So, we calculate the RGB representations of the two colours, and we linearly interpolate the RGB values of the colours between them. Then, we choose the nearest colour from the palette for each RGB value between the two colours. But if we fix the number of intermediate colours, then the results of a such calculation may be pre-computed for all the possible cases. Eagles uses 8 intermediate colours, and so the size of the table is 128*128*8 bytes = 128 Kbytes.
The second table is called effect table, and is used to produce atmospheric effects such as fog, smoke, and fade of the furthest parts of the terrain. This table is for all the 256 colours, not just for the terrain colours. The table consists of several sub-tables. One sub-table is responsible for one effect, e.g. darkening the colours by 50%. It is an array of 256 bytes, and it contains the nearest colours for the darkened original colours. With a sub-table, darkening a part of the screen can be performed quite quickly, this pseudo-code explains it:
for each pixel(x,y) to be darkened { byte oldvalue= screen_array [y] [x]; byte newvalue= sub_table [oldvalue]; screen_array [y] [x]= newvalue; }
This one is from menioned earlier Eagles rendering system. It may be close, but it may be completely far off and different what our sim is using. Just something to review and ponder a little.
|
|
#1726025 - 04/20/05 12:29 PM
Re: A new theory on height and texture files
|
Joined: May 2001
Posts: 5,462
Polak
Hotshot
|
Hotshot
Joined: May 2001
Posts: 5,462
New York, NY
|
If may suggest one more think. And aggain it is only quess nothing more. -ul (ultra low map) map is index map whixh is a key to perrendered set of textures which is nothing but color patches sitting in the memory. Pls look at that linked Eagle article closely at the referenced Longbow 3 screens. All this is VQ process.
But because the patches look rather primitive, set of gradually increasing map resolutions was introduced -l, -m, -h which works like a huge texture, but in the greyscale and giving only relief, road, ridges and all lines and textures but not color. The mechanism of rendering of those is even perhaps independent from VQ , however they show both in a final result as a form of multitexture.
Again just "guess theory, but see if we can eliminate -l, -m, -h maps.
|
|
#1726026 - 04/20/05 01:14 PM
Re: A new theory on height and texture files
|
Joined: Mar 2005
Posts: 160
Evil Lurker
Member
|
Member
Joined: Mar 2005
Posts: 160
Oregon
|
Okay, I played with values in the TER_ht.map file. Here's a rundown on the results noted: Value: Alt.@ FARP 1: 000 0 100 1641 200 3282 255 4184 It's a linear scaling, and my opinion is that this allows you to set the "base" altitude of a mapset and the other files "ride" on this value. The "TerrainHeight=x" in the CA.INI file is used to scale this value, depending on the difference between lowest and highest points on a particular map, I believe. There is only one TER_ht.map file in the folder; if you switch from the AZR to NTC areas, new TER_*.map sets are written to the terrain folder. Is this making sense? Also, setting the TER_ht.map to one value (it doesn't matter what the value is), doesn't really result in a totally flat terrain, I still see some minor altitude differences close-up, and in the far distance, it seems more pronounced. We'll need to investigate this next, I believe.
A7N8X Dlx., 2700+@3200 settings, 9700Pro, Sony 17" Trinitron, Altec Lansing 2.1 speakers. WinXP Pro.
|
|
#1726027 - 04/20/05 01:44 PM
Re: A new theory on height and texture files
|
Joined: Mar 2005
Posts: 160
Evil Lurker
Member
|
Member
Joined: Mar 2005
Posts: 160
Oregon
|
I changed the values in TER_hx.map to all 100 and saw no effect in the game or in the Nav map. That one's a mystery for now. Setting the value of TER_t.map to 100, 220 and 240 caused an immediate explosion of my helicopter when starting a mission. I'm assuming it's used for terrain collision detection. At 256 the sim runs normally and I can't see any in-game effects. Any ideas?
A7N8X Dlx., 2700+@3200 settings, 9700Pro, Sony 17" Trinitron, Altec Lansing 2.1 speakers. WinXP Pro.
|
|
#1726029 - 04/20/05 10:24 PM
Re: A new theory on height and texture files
|
Joined: Nov 1999
Posts: 1,524
Keithb77
Member
|
Member
Joined: Nov 1999
Posts: 1,524
UK
|
EL, the _t file is terrain type 0 = water, 255 = land. Polak, LBMap now has an Export function that works with all maps to create an 8-bit colour BMP directly. It also has a palette browser that is giving interesting but inconclusive results. Download from http://members.lycos.co.uk/keithb77/ as usual. Cheers, Keith
|
|
#1726030 - 04/20/05 10:40 PM
Re: A new theory on height and texture files
|
Joined: Mar 2005
Posts: 160
Evil Lurker
Member
|
Member
Joined: Mar 2005
Posts: 160
Oregon
|
255, correct. the _t file is terrain type 0 = water, 255 = land. That's the only 2 values it will recognize? I see now from studying the file, that's all that is present in the original. Thanks. When you get bored, set the TER_t.map to 200 and launch a mission. Your helicopter explodes spectacularly (much better than in the game), but your wingman and all of the other helicopters and vehicles are unaffected and continue the game normally, until you "end mission". That seems pretty strange.
A7N8X Dlx., 2700+@3200 settings, 9700Pro, Sony 17" Trinitron, Altec Lansing 2.1 speakers. WinXP Pro.
|
|
#1726032 - 04/21/05 11:50 AM
Re: A new theory on height and texture files
|
Joined: Mar 2005
Posts: 160
Evil Lurker
Member
|
Member
Joined: Mar 2005
Posts: 160
Oregon
|
the _t file is terrain type 0 = water, 255 = land. LB2 may support other values but I doubt it. I believe you, I just had the idea that if they mapped an entire area with 8-bit precision, they would have used more than 1 bit of information. I can think of some things that could have been done with it besides 0=water and 255=land. Maybe their logic will become apparent as we peoceed further. there is a bug in my palette code - its now fixed and LBMap is creating true-coloured maps just like in the game! I was beginning to suspect that yesterday, because when I opened the TER_hx.map and explored the values, it was obviously not a height map. I bet it looks just like a satellite view in the Mission Briefing screen now, doesn't it? I'll wait for your new file and proceed. Keith, I needed to manually delete the old LBMap.exe before installing the new one, or it didn't get overwritten. Just FYI in case someone else has this problem and asks, or you could add a FAQ/readme to the package.
A7N8X Dlx., 2700+@3200 settings, 9700Pro, Sony 17" Trinitron, Altec Lansing 2.1 speakers. WinXP Pro.
|
|
#1726034 - 04/21/05 10:42 PM
Re: A new theory on height and texture files
|
Joined: Mar 2005
Posts: 160
Evil Lurker
Member
|
Member
Joined: Mar 2005
Posts: 160
Oregon
|
the hx file looks like a height-map to me? I moved the cursor across a short section of the map and the values jumped all over the place. It's also possible that your program is not decoding the true values. What I mean is, if I follow up a slope and record the values, I get something like 200, 035, 125, 015, 205 in a short span. See what I'm saying? Let me try it with your new program and see if I change my mind.
A7N8X Dlx., 2700+@3200 settings, 9700Pro, Sony 17" Trinitron, Altec Lansing 2.1 speakers. WinXP Pro.
|
|
#1726036 - 04/22/05 07:36 AM
Re: A new theory on height and texture files
|
Joined: Mar 2005
Posts: 160
Evil Lurker
Member
|
Member
Joined: Mar 2005
Posts: 160
Oregon
|
you need to de-select Colour before displaying the file, otherwise the altitude value is wrong. Ah! Thank you, I understand now.
A7N8X Dlx., 2700+@3200 settings, 9700Pro, Sony 17" Trinitron, Altec Lansing 2.1 speakers. WinXP Pro.
|
|
|
|
|
|
|
|
|
|
|
|
Exodus
by RedOneAlpha. 04/18/24 05:46 PM
|
|