damage textures again

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

Moderator: thunderchero

User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7321
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 »

Dr_Breen wrote:there has to be a way how it's done in creator, as the original botf creators sure did it that way as well
creator may be the problem it self original BOTF models were created in "GameGen II by MultiGen (1996)" good luck finding this program. And I have looked.

The Creator we use has 8 years of progress ahead of what BOTF modelers used so that feature may be no longer supported.

I hope someone proves me wrong :wink:

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

Post by Callahan »

thunderchero wrote:I think you are correct about 4,5,6 Just have no clue yet best way to set this value.

8 - stretch X correct size port-starbord
9 - roll around Y axis my test showed roll on X higher port lower starboard
10 - stretch Y correct size bow-stern
12 - roll X axis my test showed roll on Y higher stern lower bow

7 & 11 I saw no change switching from known good values 00 00 00 00 may work for all new scars?

thunderchero
Rolling around the Y axis (bow-stern line) does lift-lower port/starbord edges.
Same for 12: X axis ( line port-starbord) rolling around it will result in lower/higher bow/stern edges.

At least I think so, but geometry was not my favorite.
User avatar
Callahan
Lieutenant-Junior Grade
Lieutenant-Junior Grade
Posts: 78
Joined: Sat Mar 13, 2010 3:00 am

Post by Callahan »

Just had time to do some more tests.



Seems like the original crew had problems with overlapping, too.
User avatar
Dafedz
Lieutenant-Commander
Lieutenant-Commander
Posts: 129
Joined: Mon May 05, 2008 2:00 am

Re: damage textures again

Post by Dafedz »

Don't know if anyone's reading this anymore, but I did some experiments with this a while ago, and came to the conclusion that the only way this can effectively be done is with Creator (or better still, Gamegen.)

Image

I had this info from Christian Ingle way back in the day when Jig and I were trying to make phasers work. It provides a snippet of how it was done in Gamegen.
SeaBee-T
Lieutenant-Junior Grade
Lieutenant-Junior Grade
Posts: 81
Joined: Fri May 23, 2008 2:00 am

Re: damage textures again

Post by SeaBee-T »

Hey, as long as it's posted, I'm pretty sure someone will stumble on it in the future and thank you profusely for it! ;)
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7321
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.
Contact:

Re: damage textures again

Post by thunderchero »

Hi Everyone,

I know old topic, why, ect

but working on another project I noticed a few things that got me to here.
close.jpg
close.jpg (119.62 KiB) Viewed 5447 times
I have done all this with creator but I can not get the "damage billboard" orientation correct.

anybody got any ideas....

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

Re: damage textures again

Post by thunderchero »

This is just bugging me now...... :evil: :evil: :evil: :evil: :evil:

here is info I have collected

phaser slots data in hobs files

the location will slightly vary depending on how many textures are used by model (scar texture are not listed in hob)

all slots are 48 bytes.
during model conversion of flt to hob,
only the location of polygon center and basic scale (1.0) is written to hob.

the slot number in creator is very important
slots 1 - 16 are main phaser slots (16 max)
slot 17 is 48 byte space between types
slots 16 - 30 I think are b.gif phaser slots or maybe plasma (12 max)
slot 31 is 48 byte space between types
slots 32 - 43 are for damage slots (12 max)

Note; a 1 vertex polygon is used 1 per slot. this is a special polygon
the location where data is written in hob depends on slot number
example my current test
I have slot 01 - 08 for phasers, but next slot is 32 - 35 for damage slots. this give a large space between last phaser and start of damage data (1104 bytes 23 slots @ 48 bytes each)
if I re-number damage slots to 09 - 12 (or any thing between 9 -31) this give a no space/wrong space between last phaser and start of damage slot and game will crash since damage slot are not in proper location for trek.exe to find them.

here is image of my test model
oriantation.jpg
oriantation.jpg (153.14 KiB) Viewed 5434 times
Z = front to back
X = side to side
Y = top to bottom

slot data

48 bytes
12 - float (4 bytes) type values
first value "location position" X- left to right from center of model to center of polygon used for slot.
second value "location position" Y- top to bottom from center of model to center of polygon used for slot.
third value "location position" Z- front to back from center of model to center of polygon used for slot.

with these 3 values it will locate the graphics for damage spot. (slot polygon is only used for location, shape or size does not matter).
note; these values can be found by running "getloc.exe" from conversion files.

here is info from getloc.exe for polygon below
0.452817, -0.053557, -0.000000

fourth value is a mystery, if set to 0.0 or negitive damage will not display but all positive values show no effect.
note; this value is set during conversion to 1.0, vanilla damage slot has varying values

the next 2 values look to have no effect
fifth value is unknown (set to 0.0 during conversion, vanilla damage slot has varying values)
sixth value unknown (set to 0.0 during conversion, vanilla damage slot has varying values)

The next 6 values are based on the center of damage spot using edges.
I will be mainly using images to explain them

here is the orientation (values unedited) after conversion.
damage.jpg
damage.jpg (73.11 KiB) Viewed 5434 times
I added green line when damage could not be seen from prospective.

keep in mind edges are moved parallel to center of damage not rotated.
value 7 set to 0.0 during conversion
value shown 1.0
if you could center on damage ft view damage would look unchanged
value 7.jpg
value 7.jpg (65.48 KiB) Viewed 5434 times
value 8 set to 1.0 during conversion
value shown 2.0
if viewed from side damage would look unchanged
value 8.jpg
value 8.jpg (28.68 KiB) Viewed 5434 times
value 9 set to 0.0 during conversion
value shown 1.0
if viewed from top damage would look unchanged
value 9.jpg
value 9.jpg (30.1 KiB) Viewed 5434 times
value 10 set to 0.0 during conversion
value shown 1.0
if you could center on damage ft view damage would look unchanged
value 10.jpg
value 10.jpg (25.02 KiB) Viewed 5434 times
value 11 set to 0.0 during conversion
value shown 1.0
if viewed from side damage would look unchanged
value 11.jpg
value 11.jpg (30.14 KiB) Viewed 5434 times
value 12 set to 1.0 during conversion
value shown 2.0
if viewed from top damage would look unchanged
value 12.jpg
value 12.jpg (34.36 KiB) Viewed 5434 times
I am thinking with a little geometry calculations this might be able to be automated?

also you can create list with the vertex locations (all 3 corners of polygon used) using the "GetCoord.exe" from conversion files.

here is info from GetCoord.exe for vertex of polygon used

{ 0.452817, -0.053557, -0.000000 },
{ 0.369722, -0.053557, -0.000000 },
{ 0.437387, -0.053557, -0.116025 }

anybody good at geometry?

thunderchero
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1503
Joined: Sun Apr 27, 2008 2:00 am

Re: damage textures again

Post by Spocks-cuddly-tribble »

This OpenFlight tutorial might be worth a look?

Encoding Models using OpenFlight .flt https://docs.ogc.org/bp/16-009r5.html (F3 -> damage)
6.6. Model Points

A model point is similar to a model zone; it identifies a location on the model that is of interest to at least one simulation client device. A point defines a local coordinate system on the model. Hence, a point has a position and an orientation.

In some respect, a point and a zone are similar and can be used interchangeably. A zone is used when the component of interest is physically modeled and has a graphical representation. When the zone is not modeled but still represents a component of interest, a point is used to indicate its presence.

Again, the OpenFlight Group Node mechanism provides a convenient means of implementing the concept of a point because a transformation can be added to the node.

Requirements Class – Model Points /req/openflight/model-points
Target type Operations
Dependency Openflight Specification
Requirement 23 /req/openflight/model-point-damage=states
Requirement 24 /req/openflight/model-dis-origin
Requirement 25 /req/openflight/model-viewpoint

ff.

6.9. Model Switch Nodes...

6.9.2. Usage

...Damage States

Figure 6-45. General Damage State Tree Structure...
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7321
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.
Contact:

Re: damage textures again

Post by thunderchero »

Spocks-cuddly-tribble wrote: Mon Jan 16, 2023 11:29 am This OpenFlight tutorial might be worth a look?
Nice tutorial, I think I used one close to that one to learn how to add phaser slots using vertex's. advantage of using a vertex as a phaser slot is you could put it anywhere with a more precise firing point.

the original way would use a duplicate polygon and phaser would fire from center of that polygon also duplicate polygon tend to cause transparency issue.

As for damage texture I found info in Falcon 4 source code that suggests we need a special script during conversion (flt to hob) to add values, 30% damaged 1 spot, 40% damaged 2 spot... ect

and without some kind of example script it will be tough to figure out.

Note; flashing lights like on top of Ferengi starbase require same type of script during conversion for how long on/off from what I understood.
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1503
Joined: Sun Apr 27, 2008 2:00 am

Re: damage textures again

Post by Spocks-cuddly-tribble »

The XML element <Damage_Level> is a list of percentages representing the transitions between child nodes of the switch. The list counts ‘n-1’ entries where ‘n’ is the number of states.

req/openflight/damage-transition

The percentages representing the transitions SHALL be limited to the range [0, 99]. The value 100 is not allowed because the level of damage SHALL exceed the transition value in order to select the correct state.
Example of a Damage State Switch with 8 Transitions [damage spots] for BotF: (9 child nodes [States] -> No Damage + 8 Damage States)

Code: Select all

<CDB:Switch name = "Damage_State">

<Damage_Level>30 40 50 60 70 80 90 99</Damage_Level>

</CDB:Switch>
- first value intial damage threshold needed for first damage spot 30 (nice number with 8 spots so 10% per new spot :wink: )
- last value 99 for destroyed (bug or feature in BotF?) -> so 100 (destroyed) exceeds the transition value 99:
Turner wrote: Thu May 27, 2010 3:13 pmThe last damage spot will be added, when the ship explodes. Not one moment earlier.
The last damage spot in BotF is just a cheap derivative for the destroyed state!


thunderchero wrote: Mon Jan 16, 2023 3:03 pmflashing lights like on top of Ferengi starbase require same type of script during conversion for how long on/off from what I understood.
OpenFlight - Database Specification - MultiGen-Paradigm: https://www.presagis.com/workspace/uplo ... ht16-0.pdf

F3 -> Flashing -> many flags/bits you can set @ Light Point Record + Light Point Appearance Palette Record + Light Point Animation Palette Record
Last edited by Spocks-cuddly-tribble on Sat Jan 21, 2023 2:32 pm, edited 1 time in total.
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1503
Joined: Sun Apr 27, 2008 2:00 am

Re: damage textures again

Post by Spocks-cuddly-tribble »

Above research indicates the damage state transition is NOT part of the 12 values in the 48 byte hob slots :!:

We should not need damage percentages in the HOB file for BotF:

Code: Select all

004A22C5           fsubrp st(1), st                        ; 1 - health_ratio = damageRatio (e.g. 0.8 for 20% hull)
004A22C7           fild  dword ptr [ecx+154h]              ; max number of damage spots
004A22CD           fmulp st(1), st                         ; damageRatio * max number of damage spots = number of spots to show
E.g. ship with max 8 damage spots at 20% hull -> 0.8 * 8 = 6.4 (round down) -> show 6 damage spots. :idea:
Last edited by Spocks-cuddly-tribble on Sat Jan 21, 2023 6:40 pm, edited 6 times in total.
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7321
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.
Contact:

Re: damage textures again

Post by thunderchero »

Very nice info and research, :up:

I wish I was able to give it a try, Maybe some time in the future. :wink:
or maybe some other member might give it a try.
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1503
Joined: Sun Apr 27, 2008 2:00 am

Creator DOF Tools for Scar1.hob Damage Spots

Post by Spocks-cuddly-tribble »

DOF Nodes (Degrees of Freedom) - Creator Example: http://www.vis-sim.com/creator/creator_dof1_ex_04.pdf

Let you not only translate elements, but also rotate, scale, and skew them (for bending moments to adapt scars to uneven surfaces).

'Create toolbox' -> DOF button 'Positioning DOF tool' sets zero position (orientation) vs ship surface with 'Origin' and 'Y/X' axes:
Positioning_DOF_Tool.png
Positioning_DOF_Tool.png (417.9 KiB) Viewed 204 times
Attach Scar1.hob/gif (or a surrogate) as child to DOF node (in BotF HOB not needed) to animate/test dynamic orientation values in DOF-Viewer Tool.

Save before using 'DOF Viewer' (might crash) to test Rotate (constraints/limits on the motion from Rotate tab) or Scale X, Y or Z each:
DOF_Viewer_Tool.png
DOF_Viewer_Tool.png (111 KiB) Viewed 207 times
I hope this works during conversion. HOB slot number must be 31 + number of damage spot (damage percentages via trek.exe, see above).

Elaboration wrote:9 degrees of freedom, translation, rotation and scaling on all 3 axes. Generally, only one degree of freedom is allowed at a time and most often, that single degree of freedom is a rotation about a single axis. However, the modeler is free to allow any translation, rotation and, even scaling; even though stretching an articulation does not usually produce a realistic effect (see BotF HH1 ingame):
damage.png
damage.png (75.13 KiB) Viewed 94 times
Each DOF node specifies a local coordinate system and the range allowed for translation, rotation, and scale with respect to that coordinate system.

DOF record = start/end is a Put matrix (3 point to 3 point transformation vs world origin) + a series of applied transformations = data for HOB slot: :idea:
QuasarDonkey wrote: Sat Jun 02, 2012 2:08 amobject slots, 48 bytes each. That data contains object center coordinates and 3D transformation matrices, like this:

Code: Select all

Object Center: (102.598503,  -50.955070,  265.037506)
Matrix:
 [0.118372      0.069266       -0.990551] 
 [0.000000      0.997564        0.069756] 
 [0.992969     -0.008257        0.118084]
Computing the transformation matrices might be a little tricky if you don't know how to use matrix math. Basically all you need to do is use separate matrices for translation, scaling, and rotation about each axis, and multiply the matrices together in a particular order to get the final matrix.
Transformation matrices can be defined with Multigen DOFs or by applying a Transformation to a node. :idea:

Maneuver Tools toolbox -> Insert Transformation Matrix tool - Creator Example: http://www.alexshill.com/projects/openscene.htm

Put -> simultaneously translates, rotates, and scales geometry

When you apply a transformation to a node, you attach a transformation matrix to the node (pfSCS): https://www.evl.uic.edu/ahill/flight/page07.html


Let's hope we don't need the unknown HOB data on "degrees of freedom":
QuasarDonkey wrote: Sat Jun 02, 2012 2:08 amThere's also more data in the HOBs on "degrees of freedom", possibly affecting maneuverability? But my HOB loader doesn't load that data yet.
And then there's animation data too...
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7321
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.
Contact:

Re: Creator DOF Tools for Scar1.hob Damage Spots

Post by thunderchero »

Spocks-cuddly-tribble wrote: Sat Jan 21, 2023 1:27 pm
QuasarDonkey wrote: Sat Jun 02, 2012 2:08 amThere's also more data in the HOBs on "degrees of freedom", possibly affecting maneuverability? But my HOB loader doesn't load that data yet.
And then there's animation data too...
I did get the "hob stuff" from QD. I never figured out any use for it
887403818-hob-stuffzip.zip
(449.69 KiB) Downloaded 3 times
yes we all know I collect files :grin:
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1503
Joined: Sun Apr 27, 2008 2:00 am

Re: damage textures again

Post by Spocks-cuddly-tribble »

Have you ever tested the three unknown HOB GLfloat at 0x3C?

And where is the model centerpoint/origin (changed for some default models as workaround for unfinished torpedo slots)?
struct GLObjectData {
	GLint				totalsize;
	GLint				StructureSize;
	GLint				version;
	GLint				objectFlag;
	GLint				TotalVertices;
	GLint				TotalCoord;
	GLint				TotalTextures;
	GLint				TotalDOF;
	GLint				TotalSwitch;
	GLint				TotalObjectSlot;
	GLint				TotalTextureSet;
	GLint				TextureSetSize;
	GLint				*switchList;
	GLbeadSlot			*Slotptr;
	GLbeadDOFTree			*dofTree;
	GLbeadTree			*beadRoot;
	GLvertexData			*VertexList;
	GLvertexCoord			*VertexCoord;
	GLbeadTexture			*beadTexture;
	GLAnimation			*objectAnimation;
	GLvertex			objectMin;
	GLvertex			objectMax;
	GLfloat				objectRadius;

	//XXX These three floats are only present in BotF HOB files!
	GLfloat				unknown1, unknown2, unknown3;

	GLint				TotalDynamicVertex;
	GLdynamicVertex			*DynamicVertex;
	GLint				TotalDynamicPolygon;
	GLdynamicPolygon		*DynamicPolygon;

	GLvertex			*instanceVertexBuffer;
};
Many not used in BotF e.g. DynamicVertex and DynamicPolygon (might be stuff like dynamic wing positions for BoPs)?
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
Post Reply

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