Previous Thread
Next Thread
Print Thread
Rate This Thread
Hop To
Page 1 of 2 1 2
#1726017 - 04/19/05 08:49 PM A new theory on height and texture files  
Joined: Nov 1999
Posts: 1,524
Keithb77 Offline
Member
Keithb77  Offline
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

Inline advert (2nd and 3rd post)

#1726018 - 04/19/05 09:02 PM Re: A new theory on height and texture files  
Joined: May 2001
Posts: 5,462
Polak Offline
Hotshot
Polak  Offline
Hotshot

Joined: May 2001
Posts: 5,462
New York, NY
Time to start experiments

Does the LBMap handle the bigest maps? Perhaps in order to organise the search you want us to make some specific tasks instead of making efforts pararell.

Suggestion: http://www.terrainmap.org
Perhaps some clues there.

One more and THAT is all I know about it:
http://www.vterrain.org/Textures/ground_textures.html

#1726019 - 04/19/05 09:50 PM Re: A new theory on height and texture files  
Joined: Nov 1999
Posts: 1,524
Keithb77 Offline
Member
Keithb77  Offline
Member

Joined: Nov 1999
Posts: 1,524
UK
Correction - its the ter_ht.map file that is the height map.
I now have a totally flat Azerbaijan!
But still correctly coloured.

No, the next version will handle the bigger files, with an export direct to BMP function that doesnt preview to the screen.

The big question is how to relate the palette files to the textures, I've a few ideas to follow up on that.
More tomorrow..........

Cheers,
Keith

#1726020 - 04/19/05 11:26 PM Re: A new theory on height and texture files  
Joined: May 2001
Posts: 5,462
Polak Offline
Hotshot
Polak  Offline
Hotshot

Joined: May 2001
Posts: 5,462
New York, NY
Keith,

I give you full credit for this whole discovery process and hope that I am not spoiling anything. However, I believe that we HAVE already full description of the process on this board in one of the link. All indicates that this must be process called VQTexture (Vector Quantisation) and it was pointed to us before by (I fill the name when I find it) with the article about one of the helo sim system called "Eagles".

All reference is in this article and process is described on pdf paper (cannot still find this link). This process was definetely used in 1st Longbow so it is logical that they just reused and refined it.

All the texture maps are INDEX MAPS. Each pixel color coded by palettes associated with map opens door to lower level map and another group (not sure here) of palettes. Or the first maps are pixels with coordinates opening sector in the lower level map with higher resolution.

On the end of that process is the texture, but mapped in memory for fast access, retrieval and rendering. I can only make this hypothesis and cannot prove anything, but I strongly feel that this something v close.

If it proves to be this true it could be very interesting to learn what are those textures and try to modify them.

#1726021 - 04/19/05 11:48 PM Re: A new theory on height and texture files  
Joined: Mar 2005
Posts: 160
Evil Lurker Offline
Member
Evil Lurker  Offline
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 Offline
Member
Evil Lurker  Offline
Member

Joined: Mar 2005
Posts: 160
Oregon
Keith:
Quote:
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 Offline
Member
Keithb77  Offline
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 Offline
Hotshot
Polak  Offline
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:

Quote:
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 Offline
Hotshot
Polak  Offline
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 Offline
Member
Evil Lurker  Offline
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 Offline
Member
Evil Lurker  Offline
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.
#1726028 - 04/20/05 05:13 PM Re: A new theory on height and texture files  
Joined: Nov 1999
Posts: 1,524
Keithb77 Offline
Member
Keithb77  Offline
Member

Joined: Nov 1999
Posts: 1,524
UK
EL,
you shouldnt be able to set heights to 256!
Maximum allowed value should be 255 - did you mean that?
I agree with the scaling and ca.ini

Polak,
will investigate palettes tonight, I've added a palette display function to LBMap.
Thanks for the info.

Cheers,
keith

#1726029 - 04/20/05 10:24 PM Re: A new theory on height and texture files  
Joined: Nov 1999
Posts: 1,524
Keithb77 Offline
Member
Keithb77  Offline
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 Offline
Member
Evil Lurker  Offline
Member

Joined: Mar 2005
Posts: 160
Oregon
255, correct.
Quote:
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.
#1726031 - 04/21/05 08:06 AM Re: A new theory on height and texture files  
Joined: Nov 1999
Posts: 1,524
Keithb77 Offline
Member
Keithb77  Offline
Member

Joined: Nov 1999
Posts: 1,524
UK
El,
LB2 may support other values but I doubt it.

Polak,
there is a bug in my palette code - its now fixed and LBMap is creating true-coloured maps just like in the game!

Will post the bugfixed version in a few hours...gotta work for a while!

Cheers,
Keith

#1726032 - 04/21/05 11:50 AM Re: A new theory on height and texture files  
Joined: Mar 2005
Posts: 160
Evil Lurker Offline
Member
Evil Lurker  Offline
Member

Joined: Mar 2005
Posts: 160
Oregon
Quote:
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.
Quote:
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.
#1726033 - 04/21/05 07:24 PM Re: A new theory on height and texture files  
Joined: Nov 1999
Posts: 1,524
Keithb77 Offline
Member
Keithb77  Offline
Member

Joined: Nov 1999
Posts: 1,524
UK
EL,
the hx file looks like a height-map to me?
Actually it looks like one of those ink-blot psycho tests when coloured.......

Thanks for the tip re installing LBMap, I've put a warning on the download page, together with the new version.

Cheers,
Keith

#1726034 - 04/21/05 10:42 PM Re: A new theory on height and texture files  
Joined: Mar 2005
Posts: 160
Evil Lurker Offline
Member
Evil Lurker  Offline
Member

Joined: Mar 2005
Posts: 160
Oregon
Quote:
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.
#1726035 - 04/22/05 04:59 AM Re: A new theory on height and texture files  
Joined: Nov 1999
Posts: 1,524
Keithb77 Offline
Member
Keithb77  Offline
Member

Joined: Nov 1999
Posts: 1,524
UK
EL,
you need to de-select Colour before displaying the file, otherwise the altitude value is wrong.
Sorry - I'll fix the program not to display Altitude in colour, I cant get the correct value.

Cheers,
Keith

#1726036 - 04/22/05 07:36 AM Re: A new theory on height and texture files  
Joined: Mar 2005
Posts: 160
Evil Lurker Offline
Member
Evil Lurker  Offline
Member

Joined: Mar 2005
Posts: 160
Oregon
Quote:
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.
Page 1 of 2 1 2

Moderated by  RacerGT 

Quick Search
Recent Articles
Support SimHQ

If you shop on Amazon use this Amazon link to support SimHQ
.
Social


Recent Topics
Actors portraying US Presidents
by PanzerMeyer. 04/19/24 12:19 PM
Dickey Betts was 80
by Rick_Rawlings. 04/19/24 01:11 AM
Exodus
by RedOneAlpha. 04/18/24 05:46 PM
Grumman Wildcat unique landing gear
by Coot. 04/17/24 03:54 PM
Peter Higgs was 94
by Rick_Rawlings. 04/17/24 12:28 AM
Whitey Herzog was 92
by F4UDash4. 04/16/24 04:41 PM
Anyone can tell me what this is?
by NoFlyBoy. 04/16/24 04:10 PM
10 Years ago MV Sewol
by wormfood. 04/15/24 08:25 PM
Pride Of Jenni race win
by NoFlyBoy. 04/15/24 12:22 AM
Copyright 1997-2016, SimHQ Inc. All Rights Reserved.

Powered by UBB.threads™ PHP Forum Software 7.6.0