damage textures again

using damage textures with new ship models -> trek.exe basics; support/discussion/questions

Moderator: thunderchero

User avatar
Callahan
Lieutenant-Junior Grade
Lieutenant-Junior Grade
Posts: 78
Joined: Sat Mar 13, 2010 3:00 am

Post by Callahan » Thu Dec 23, 2010 12:23 pm

Progress !

By making a HOB A hybrid of RM1 over RM2 I used R´tan scars on R´derex model.

Looking weird and misplaced, but now I know where the scar info is located in the HOB file. And some HOBs are missing them, like Klingon DD, causing a crash when to be loaded.

Seems only type A files contain that info. I will now try to apply the patch of bytes to other models. This is gonna be interesting, but as of now I am unable to willingly alter the location and angle of the scars.

Doing more research on this the next few days.
Join the klingon empire at www.goldentowns.com/?i=352931
Become an affiliate of Kahless himself and play for free to earn real money!

You will be protected and advised by the chancellor himself.
Long live the empire!
Q'pla!

User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 6066
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.
Contact:

Post by thunderchero » Thu Dec 23, 2010 12:58 pm

Callahan wrote:Progress !

By making a HOB A hybrid of RM1 over RM2 I used R´tan scars on R´derex model.

Looking weird and misplaced, but now I know where the scar info is located in the HOB file. And some HOBs are missing them, like Klingon DD, causing a crash when to be loaded.

Seems only type A files contain that info. I will now try to apply the patch of bytes to other models. This is gonna be interesting, but as of now I am unable to willingly alter the location and angle of the scars.

Doing more research on this the next few days.
I am guessing you are dealing with only vanilla models?

I am interested in the location in hob file of scar data you have found.

like you already stated it will be tough to locate the new scars in correct location/size/angle.

thunderchero

User avatar
Callahan
Lieutenant-Junior Grade
Lieutenant-Junior Grade
Posts: 78
Joined: Sat Mar 13, 2010 3:00 am

Post by Callahan » Thu Dec 23, 2010 2:04 pm

Yep, I only used vanilla for update, but I looked at some new ones too.

Here is where I am by now.
All models using scars have the same basic structure up to byte 2300 or so. Pos 1640 is the start for the scar data patch. 2216 is the end.

Some pointers identifed, too.

Byte 1 file length.
Pos 117 points to end of scar data for all models including the one w/o scar data.
Pos 113 points to some early data - mostly starting at byte 140.
Pos 115 points to the first list of data.
pos 119 points to the second list of data.

Value of Byte 77 is repeating after the scar data patch followed by a pointer 56 Bytes more far than the one to the scar data end. Then comes a Byte telling the distance in Bytes to the second entry of the data list of the Pos 115 pointer.

Unfortunately, I lack the IQ to get a grip on how to convert the format. Especially the data from byte 140 to 1640 is to be reformed to properly add up scar data.
I have no idea yet what data it is; Or where the pointer telling the data length of this patch is located.

The rest should be easy - resetting the pointers to the new adresses. The rest of the HOB looks common for all models and does not appear to be affecting the scars.
Join the klingon empire at www.goldentowns.com/?i=352931
Become an affiliate of Kahless himself and play for free to earn real money!

You will be protected and advised by the chancellor himself.
Long live the empire!
Q'pla!

User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 6066
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.
Contact:

Post by thunderchero » Thu Dec 23, 2010 2:37 pm

Callahan wrote:Especially the data from byte 140 to 1640 is to be reformed to properly add up scar data.
I have no idea yet what data it is; Or where the pointer telling the data length of this patch is located.
data 140-151 is the gif data used by the model (this data varies on new models depending on how many gifs are used)

data 80-107 is data used by UE to edit placement and model radius

thunderchero

EDIT; here is some data I found

file rm1_a.hob

0x000000 (64 CD 00 00) file length
0x000004 (8C 00 00 00) start of gif data
0x000008 (69 00 00 00) (same for all models new and vanilla)
0x00000c (C0 00) (same for all models new and vanilla)
0x00000f (00 40) new models (00 00)
0x000010 (F9 01 00 00)
0x000014 (E8 00 00 00)
0x000018 (03 00 00 00 00 00 00 00 00 00 00 00) total gifs listed in hob file
0x000024 (2B 00 00 00) total special polygon sections (2B=43x48=2064 bytes)
0x000028 (03 00 00 00) (I think this is how many LOD used by model)
0x00002c (01 00 00 00 00 00 00 00) total gifs used by model
0x000034 (98 00 00 00 00 00 00 00) start of phaser data (48 bytes each)
0x00003c (54 CD 00 00) file size -16
0x000040 (8C 09 00 00) start of polygon data? new models start with (00 00 00 00)
0x000044 (74 58 00 00) start of "b gif" polygon data?
0x000048 (8C 00 00 00) start of gif data
0x00004c (A8 08 00 00) start of data after damage data
0x000050 (21 73 4F C3) X-axis min (used by UE)
0x000054 (78 40 B3 C2) X-axis max (used by UE)
0x000058 (C0 44 37 C3) Y-axis min (used by UE)
0x00005c (21 73 4F 43) Y-axis max (used by UE)
0x000060 (CE 91 4D 41) Z-axis min (used by UE)
0x000064 (07 B6 24 43) Z-axis max (used by UE)
0x000068 (67 7A 91 43) model radius (combat distance approx) (used by UE)
0x00006c (10 50 77 44)
0x000070 (FE AC F3 44)
0x000074 (00 E0 AB 46)
0x000078 (00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00)
0x00008c (BC 00 00 00) rm1_a.gif
0x000090 (BD 00 00 00) rm1_b.gif
0x000094 (BE 00 00 00) rm1_c.gif

not sure if this would help you though
Last edited by thunderchero on Tue Dec 28, 2010 7:16 pm, edited 6 times in total.

User avatar
Callahan
Lieutenant-Junior Grade
Lieutenant-Junior Grade
Posts: 78
Joined: Sat Mar 13, 2010 3:00 am

Post by Callahan » Fri Dec 24, 2010 4:49 am

Thanks !
Played around with decryption of scar data.

Pos 2216 - 1640 makes 576 bytes.
576 / 12 scars == 48 each.
Asuming rectangle stuff - 12 bytes per corner.
4 X : 4 Y : 4 Z.
That´s all one would need to set up 12 scars.

Could it be that easy ?
Join the klingon empire at www.goldentowns.com/?i=352931
Become an affiliate of Kahless himself and play for free to earn real money!

You will be protected and advised by the chancellor himself.
Long live the empire!
Q'pla!

User avatar
Callahan
Lieutenant-Junior Grade
Lieutenant-Junior Grade
Posts: 78
Joined: Sat Mar 13, 2010 3:00 am

Post by Callahan » Fri Dec 24, 2010 9:48 am

Update.

I think I am a bit smarter now.
Byte #36 stores the number of special polygons.

The exe adds up data to know how to use them.

Vanilla models have more specials than phaser + damage - probably some info on where to hit em with beam weapons. That was not changed on my hybrid experiment. I hit the model at the usual spots but the texture appeared nearby

This is why the UDM III models work. All have 8 specials.
Exe named 8 phaser slots plus 0 dam textures.
8 minus 8 minus 0 == 0 -> matching number.
If we go negative we are crashed.

If we figure out the shape of the damage polygons we could add them in a model, say 12 of em plus 8 phaser polys to be defined earlier.
Set the exe 8 phasers and 12 damage would make it work.
So I do not think damage polygon are stored different from phaser ones, but have another shape maybe.

This is purely math based theory on my understanding of HOB shape. But it looks just as if it could work.

Could anyone test on this or tell me how to do a simple model so I may play around with it.
Join the klingon empire at www.goldentowns.com/?i=352931
Become an affiliate of Kahless himself and play for free to earn real money!

You will be protected and advised by the chancellor himself.
Long live the empire!
Q'pla!

User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 6066
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.
Contact:

Post by thunderchero » Fri Dec 24, 2010 10:05 am

Hi Callahan,

As far as I know the model hobs only has the xyz position to be used by the scar1.hob. The scar1.hob is only a basic square single polygon. What I do not understand is how it displays some as square and some as rectangles?

good luck

thunderchero

User avatar
Callahan
Lieutenant-Junior Grade
Lieutenant-Junior Grade
Posts: 78
Joined: Sat Mar 13, 2010 3:00 am

Post by Callahan » Fri Dec 24, 2010 10:54 am

IIRR - in C++ you may blit any image on a rectangle with the corner positions defined.
Scaling/ stretching is done by DirectDraw.

So, if the HOB defined the squares corners - or a rectangle-like structure in general, the blitter can adapt the scar1.gif to fit the defined position.

As I postulated above, it seems the HOB has 48 bytes per scar, allowing 4 corners XYZ to be defined for it.
( 4x12 bytes per 4 corners positions of 1 scar)

This is why I think the damage spots are part of the phaser polygon array on saving/converting a HOB.

So, if the damage poligon has more/less than 48 bytes (phaser size) the info on the EXE would allow Botf to calculate the exacting size of the array to load from the HOB.

If all polys have 48 bytes, the better. In that case Trek would use the info in the phaser slot just to know how to use the poligons each.
I think this is the most probable case.

Theory:
The shape of the item to be handled could be important for it´s use. If shape does not match the requirement of the action...crash - probably.
The phaser spots should not be usable for scars, nor the scars positions would do good as phaser spots.

HH1 has 69 poligon count saved in it. At least 14 are phasers - first part - at least 12 are damage spots - last part - and 43 must serve other purposes - middle part.

But as I am more than green concerning model design and conversion, it will take a while before I can do some models to test on the result.

Yet I am quite very sure this is how Trek.exe uses the HOB data to create Beam start/end points and scar placement.
Join the klingon empire at www.goldentowns.com/?i=352931
Become an affiliate of Kahless himself and play for free to earn real money!

You will be protected and advised by the chancellor himself.
Long live the empire!
Q'pla!

User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 6066
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.
Contact:

Post by thunderchero » Fri Dec 24, 2010 11:23 am

Callahan wrote:This is why I think the damage spots are part of the phaser polygon array on saving/converting a HOB
I can view any vanilla model in unwrap and they have no physical polygons for damage textures. this is why I think when converting it uses a script for placement. If you read in the hob converter readme it talks about different scripts used.

Also you can replace scar1.gif with a white gif and the polygon points of the scar do not match any polygons of model.

But this may be what you ment by "saving/converting a HOB"

thunderchero

User avatar
Callahan
Lieutenant-Junior Grade
Lieutenant-Junior Grade
Posts: 78
Joined: Sat Mar 13, 2010 3:00 am

Post by Callahan » Fri Dec 24, 2010 2:53 pm

The scars are not related to the model itself. My hybrid rm1~rm2 showed scars in space, a good distance away from the model.
But they appear to be stored in the same array that contains the phaser spots.


I see 2 possible approaches in getting damage textures to work w/o the original script, as we do know how it should look in a finished HOB.

I may be wrong after all, but aside from some dignity, there is not much I can loose on trying it.

OK - based on a vanilla model with 3 GIFs and 43 phaser spot like slots 48 bytes each we should try to do the following:

Build a simple, pink (any other bright color will do, too) textured, 3 GIF dummy cube for to add the phaser spots.

1st method:
If it is possible, add 31 phaser spots and 12 rectangles on the hull model. With some luck, their original script was designed to do just that.
This would be the perfect way to victory, as we get usable rectangle positions right away.

2nd method:
Add 43 phaser spots.
If I am right we can just paste the 576 bytes of scar data used by most vanilla models over the last 12 phaser spots and Trek.EXE should be able to read in the data right.
We still would need to set the XYZ 4 times for each scar to be placed well, but we should have them working at least.
---
If one of these two methods is working, we may operate with a lower amount of phaser spots.
For now, I just want to be as close to vanilla for to better understand the effect on the HOB of what we are doing.

Another attempt would be to use 8 phaser spots and 12 rectangles for method 1, and 20 phaser spots for method 2.
This way we would not have any other than phaser and damage objects.
We should try that if we fail to get our 43 slot models working.

Do you know anyone who could help us with creating such test models ?
Once done I may investigate on how much closer we are to the vanilla HOBs.

User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 6066
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.
Contact:

Post by thunderchero » Fri Dec 24, 2010 4:28 pm

I am not sure if I have the time needed to spend on this project (maybe after Christmas day)

here is my idea

first we will be dealing with already completed models for the most part so....

first test;

select any new model (simpler the better)

1. place 12 polygons on hull in the places you want damage textures.

2. remove model so all is left is the 12 polygons then save as flt and convert to hob

3. from data in new hob just created take the new data to add to the model hob.

4. reset all markers

5. save hob file and test

I would still need a list of all markers of hob file. (not sure if we have all of them)

thunderchero

User avatar
Callahan
Lieutenant-Junior Grade
Lieutenant-Junior Grade
Posts: 78
Joined: Sat Mar 13, 2010 3:00 am

Post by Callahan » Sat Dec 25, 2010 6:32 am

The markers will be difficult to set. I have identified dozens of them in groups throughout the HOB format. They seem to assign texture coords to poligons. The more complicated the model, the more of them.
Copy-pasting an array of other length is not working, already tried this.

I fear we will have to convert an entire model along with 43 entries in the array to have damage textures work.

I will use the time until we have a model to experiment with to learn editing the phaser slots of Trek.exe. May figure out more on how it composes and uses the array of the HOB format.

Edit:
I dare to say I do now know how to add scar texture to models quite precisely. Placing is another matter.

The HH1 HOB is quite unique in using a big array for specials. I´ve set the exe to use 24 damage spots and pasted HH3 ( sovereign ) location info after the HH1 patch to have a set of 24 scars.
On destruction, the Galaxy showed only 12 scars, but the entry of using 24 did not crash the game.
Also, every model I examined had the scar data stored starting in #32.

I do think the texture is hardcoded to use the slots 32 upward, up to a max of 12 to use at all.
B´rel has only 35 slots and uses 4 textures. Using more crashes game.
This means that textures cannot be assigned to entries lower than #32.

This also means that it will be very hard to extend the array with the HOBs of current models.
At least we do now know the "how to" with good precision.
I am quite sure it will be possible to add scar textures with future models.

User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 6066
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.
Contact:

Post by thunderchero » Mon Dec 27, 2010 3:15 pm

Hi Callahan,

I have edited a model to have space for 43 special slots (8 are used for phasers) I used the Miranda model from UDM as a test model. This ship pack is a current working model.

test43.zip

I hope this is something like what you were looking for.

Note; after this test I strongly think all current models, The phasers can be lowered to match other models with lower total of phasers slots so they could be used in same slot. (this model was created with 43 phasers slots and now works with 8 after editing) :wink:

thunderchero

Dr_Breen
Commodore
Commodore
Posts: 889
Joined: Wed Apr 30, 2008 2:00 am
Location: Zurich, Switzerland
Contact:

Post by Dr_Breen » Mon Dec 27, 2010 3:57 pm

i sense another phenomenal breaktrough here, can't wait to see damaged ships everywhere
Public BotF / EF2 Teamspeak 3 Server: 83.169.13.55

User avatar
Callahan
Lieutenant-Junior Grade
Lieutenant-Junior Grade
Posts: 78
Joined: Sat Mar 13, 2010 3:00 am

Post by Callahan » Tue Dec 28, 2010 11:17 am

Success !!!


The textures of thunderchero´s model are mismatching due to I added HOB manually - not with UE.
I Wanted to keep the 1.02 vanilla exe as it is for the test.

As you can see, NEW model uses "pasted in" RM2 scars on it. Also, the texture positions seem to be used for beam targets right away - right part of picture.

I think this is the breakthrough in this matter.
Due to the hardcoding of scar slots 32 to 43, UE can be adapted to look for if models uses textures ( and how many of them ) quite easy. And set the exe to use them the right way.


The next step will be to add the right scar positions along with creating a model HOB file.

For this, I need to know more about the nature of the phaser spots.
If they´re using a shape, I would bet on that the right shape will enable the texture positions to be placed as the phaser spots are.

Thanks for doing me a test model Thunderchero !!

Post Reply

Return to “using damage textures with new ship models -> trek.exe basics”

Who is online

Users browsing this forum: No registered users