Jump to content
COMBATSIM Forum

Recommended Posts

Great :thumbsup:

As the next big update with SSD files and such is still due, here's a short progress report:

I had to clean up major parts of the renderer because performance became an urgent problem with SSD's (mostly due to the texture portions which are selected by 0083). It's faster by about one order of magnitude now (60 fps @ 45 % CPU load instead of 20 fps @ 100 % CPU load when I first loaded SSD's) — still too slow for me, though. I'm doing a major cleanup which worked out great to this point; the code of the renderer is much simpler now. Still many lines of code to go, though.

The small bug with solid shadows from the previous screenshots is fixed, too. Mistyped 256 to 255 :rolleyes:

With sketchy SSD decoding and the new knowledge on .3 headers, the code base for internal logic has grown, too. On the other hand, I do hope to get the precomputed LOD offsets out soon so the entire .3 loader relies on logic we've decoded so far (becomes stand-alone, one could say).

One problem I procrastinated for weeks now is actually loading red****.ini so we can eventually visualize different times of day. I still haven't begun with it, but the renderer is now well-prepared for the implementation and shouldn't make any problems.

I aim to upload a version with rudimentary SSD support (at this point, terrain tiles only) next weekend. Oh, and I still need to send Home Fries my stuff for the Wiki …

Link to post
Share on other sites
  • Replies 1.1k
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

I need to collect an overview on the instructions for the wiki anyway, so I'll as well post the current progress here:

// 0000

// Return to caller by popping the current subroutine from the call stack.


// 0001 <color> <position0> <position1>

// Draw a flat-shaded line of the color at palette index <color> between the <position0>'th and

//	<position1>'th (transformed) position.


// 0002 <color> <position0> <position1> <position2>

// Draw a flat-shaded triangle with the color at palette index <color>. The indices of its vertices'

//	(transformed) positions are given in clockwise order by <position0>, <position1> and <position2>.


// 0003 <color> <position0> <position1> <position2> <position3>

// 007D <color> <position0> <position1> <position2> <position3>

// Draw a flat-shaded quad with the color at palette index <color>. The indices of its vertices'

//	(transformed) positions are given in clockwise order.


// 0004 <color> <vertices> <position>[<vertices>]

// Draw a flat-shaded <vertices>-sided polygon with the color at palette index <color>. It consists of at

//	least three vertices; its (transformed) position's indices are given in clockwise order.


// 0008 <offset>

// Call the subroutine at <offset> - 2 bytes offset from the instruction's end.


// 0015 <position0> <position1> <position2> <offset>

// If the triangle of the (transformed) vertices at the given positions (clockwise) faces away from the

//	viewer, jump <offset> - 2 bytes relative to the end of the instruction.

// TAW must strictly obtaining a back-to-front draw order because there is no Z buffering; that's what these

//	jumps are for.


// 001A <opacity> <color> <position0> <position1> <position2>

// Draw a flat-shaded, transparent triangle with the color at palette index <color>. If <opacity> equals

//	0000, the trianle is semi-transparent. If <opacity> equals 000E, it is fully transparent. The indices of

//	its vertices' (transformed) positions are given in clockwise order by <position0>, <position1> and

//	<position2>.

// Used to cover textured terrain with dust. Other values than 0000 and 000E could not yet be tested because

//	we have no untouched glide / Direct3D mode available and the software mode doesn't support transparency.


// 001B <opacity> <color> <position0> <position1> <position2> <position3>

// 003E <opacity> <color> <position0> <position1> <position2> <position3>

// 007E <opacity> <color> <position0> <position1> <position2> <position3>

// Draw a flat-shaded, transparent quad with the color at palette index <color>. If <opacity> equals 0000,

//	the quad is semi-transparent. If <opacity> equals 000E, it is fully transparent. The indices of its

//	vertices' (transformed) positions are given in clockwise order by <position0>, <position1>, <position2>

//	and <position3>.

// 001B is used to cover textured terrain with dust; 003E is used in 'dust.3' only; 007E is used to

//	render low-LOD helicopter rotors. Other values than 0000 and 000E could not yet be tested because we

//	have no untouched glide / Direct3D mode available and the software mode doesn't support transparency.


// 0020 <reference> <offset>

// If the currently active parameter is below <reference>, jump <offset> - 2 bytes.


// 0021 <reference> <offset>

// If the currently active parameter equals <reference>, jump <offset> - 2 bytes.


// 0022 <reference> <offset>

// If the currently active parameter is above <reference>, jump <offset> - 2 bytes.


// 0027 <threshold> <offset>

// If the object's distance from the viewer is above <threshold>, jump <offset> - 2 bytes.

// Used to fade details, e.g. shadows, with distance.


// 002D <translation> <offset>

// A translation to the <translation>'th raw position is pushed onto the stack and the subroutine at

//	<offset> - 2 B is called. The transformation is popped when the subroutine returns.

// Used to draw instances of the same sub-mesh at multiple locations, e.g. jet engines of airliners.


// 002E <texture> <number> for each <number>[<u> <v>]

// 0047 <texture> <number> for each <number>[<u> <v>]

// Write <number> texture coordinates of a polygon. If <texture> is nonzero, the texture's name must be

//	looked up in "red****.ini"'s [globaltextures] section. Otherwise, the texture of the hard-coded name is

//	used.


// 002F <vertices> for each <vertices>[<index>]

// 008E <vertices> for each <vertices>[<index>]

// Draw a textured <vertices>-sided polygon with the last set of texture coordinates. It consists of at

//	least three vertices; its (transformed) position indices are given in clockwise order. The texture's

//	bytes are interpreted as indices to the current color palette.


// 0030 <unit length>

// Scale the following transformed positions by 1 ÷ <unit length>.


// 0031 <number> (<color>)[<number>]

// Legacy instruction to push vertex colors for a polygon. Used in "ses.3" only; tests have shown that TAW

//	just ignores this instruction. Probably the static counterpart to 0095.


// 0033 <color> <position>

// Draw a point at the <position>'th (transformed) position with the color at palette index <color>.

// Used for runway lights. Probably the static counterpart to 0096.


// 0034 <unknown> <color> <position>

// Draw a large point at the <position>'th (transformed) position with the color at palette index <color>.

// Used for lights on buildings.


// 0037 <divisor>

// Push a new fog distance on the stack which is divided by <divisor>. It will be popped when the subroutine

//	returns. This instruction is legacy; a50.3 and awc_a50 are the only models using it and it gives them a

//	buggy appearance.


// 0039 <unknown> <color> <position0> <position1>

// Draw <number> points of the color at palette index <color> between the <position0>'th and <position1>'th

//	position.


// 0048 <index>

// Choose parameter <index> as the current active parameter for 0020, 0021 and 0022 instructions.


// 0049 <xRotation> <yRotation> <zRotation> 0000 0000 0000 0000 0000 0000 <translation> <offset>

// A transformation is pushed onto the stack and the subroutine at <offset> - 2 B is called. The

//	transformation is popped when the subroutine returns. It consists of (in that order):

//	— a rotation around the z axe by 2pi - <zRotation> ÷ 65536 × 2pi

//	— a rotation around the x axe by 2pi - <xRotation> ÷ 65536 × 2pi

//	— a rotation around the y axe by <yRotation> ÷ 65536 × 2pi

//	— a translation to the <translation>'th position.

// Used to draw rotated sub-meshes, e.g. turrets. The zeroes in the header are probably scratch space to

//	build up a 3×3 rotation matrix.


// 004B <mask> <offset>

// If a bitwise AND of <mask> with the global flags evaluates nonzero, then a transformation is pushed onto

//	the stack and the subroutine at <offset> - 2 B is called. The transformation sets the upper three rows

//	of the world and view matrix to identity, which causes the submesh to always face the viewer. It is

//	popped when the subroutine returns.

// This instruction is used to check if sprites are enabled and, if so, to draw them. Sprites can be smoke

//	puffs or pilots' heads.


// 004C <color0|color1> <zero|color2>

// Fetch three one-byte color indices for the next Gouraud-shaded triangle. Consider endianness!


// 004D <position0> <position1> <position2>

// 0080 <position0> <position1> <position2>

// Draw a Gouraud-shaded triangle with the last three color palette indices. The indices of its vertices'

//	(transformed) positions are given in clockwise order by <position0>, <position1> and <position2>.


// 004E <color0|color1> <color3|color2>

// Fetch four one-byte color indices for the next Gouraud-shaded quad. Consider endianness!


// 004F <position0> <position1> <position2> <position3>

// 0081 <position0> <position1> <position2> <position3>

// Draw a Gouraud-shaded quad with the last four color palette indices. The indices of its vertices'

//	(transformed) positions are given in clockwise order by <position0>, <position1>, <position2> and

//	<position3>.


// 0053 <number> <base index> (<x> <y> <z>)[<number>]

// Write <number> 3D positions starting at <base index>.


// 005C <color> <position> <radius>

// Draw a flat-shaded sphere of the color at palette index <color> and a radius of <radius> at the

//	<position>'th (transformed) position.

// Used for radar domes, simple smoke puffs, heads and other spherical objects.


// 005F <number> (<color> <position> <radius>)[<number>]

// Draw <number> flat-shaded spheres, with of the color at palette index <color> and a radius of <radius> at

//	the <position>'th (transformed) position each.


// 0061 <number> <offset>

// Transform <number> raw XYZ positions starting at index <offset> for future use.


// 0063 <x> <y> <z>

// Write the next raw XYZ position with the given delta to the lastly-written one.


// 0064 <x>

// Write the next raw XYZ position with the given delta to the lastly-written one.


// 0065 <y>

// Write the next raw XYZ position with the given delta to the lastly-written one.


// 0066 <z>

// Write the next raw XYZ position with the given delta to the lastly-written one.


// 0067 <x> <y>

// Write the next raw XYZ position with the given delta to the lastly-written one.


// 0068 <x> <z>

// Write the next raw XYZ position with the given delta to the lastly-written one.


// 0069 <y> <z>

// Write the next raw XYZ position with the given delta to the lastly-written one.


// 006A <x> <y> <z> <index>

// Write the raw XYZ position at the given index with the given delta to the lastly-written one.


// 006B <x> <index>

// Write the raw XYZ position at the given index with the given delta to the lastly-written one.


// 006C <y> <index>

// Write the raw XYZ position at the given index with the given delta to the lastly-written one.


// 006D <z> <index>

// Write the raw XYZ position at the given index with the given delta to the lastly-written one.


// 006E <x> <y> <index>

// Write the raw XYZ position at the given index with the given delta to the lastly-written one.


// 006F <x> <z> <index>

// Write the raw XYZ position at the given index with the given delta to the lastly-written one.


// 0070 <y> <z> <index>

// Write the raw XYZ position at the given index with the given delta to the lastly-written one.


// 0071 <position0> <position1> <position2>

// Draw a flat-shaded triangle from the (transformed) positions at the given indices (clockwise) with the

//	same color as the last flat-shaded primitive.


// 0072 <position0> <position1> <position2> <position3>

// Draw a flat-shaded quad from the (transformed) positions at the given indices (clockwise) with the same

//	color as the last flat-shaded primitive.


// 0073 <vertices> (<position>)[<vertices>]

// Draw a flat-shaded <vertices>-sided polygon with the same color as the last flat-shaded primitive. It

//	consists of at least three vertices; its (transformed) position's indices are given in clockwise order.


// 0083 <uBase> <vBase> <uDimension> <vDimension>

// Limit texture sampling to the given portion (given in pixels). Out-of-bounds accesses are tiled. This is

//	achieved by computing sample positions through uv % (<uDimension>, <vDimension>) + (<uBase>, <vBase>).

// Used to duplicate texture portions over large areas, e.g. single windows over entire buildings.


// 0084

// Use the whole texture for sampling again. Used to terminate 0083 blocks.


// 0088 <vertices> for each <vertices>[<index>]

// Draw a textured <vertices>-sided polygon with the last set of texture coordinates. It consists of at

//	least three vertices; its (transformed) position indices are given in clockwise order. The texture's

//	bytes are interpreted as tranculency information:

//		— transparent (0) to opaque (31) black (used for oil spills)

//		— transparent (32) to opaque (63) white (used for missile trails)

//	and the current texture color from 0098, 00A7 and 00A8 instructions is used as a multiplier.


// 008D 0003 <position>[3]

// Draw a semi-transparent flat-shaded triangle with palette color #152.

// Used to draw afterburners.


// 0095 <unknown> <color> <position>

// Draw a point at the <position>'th (transformed) position with the color at palette index <color>.

//	<unknown> seems to be legacy; changing it had no visible effect on the game.

// Used for lights on planes. Probably the dynamic counterpart to 0033.


// 0096 <unknown> <color> <position>

// Draw a large point at the <position>'th (transformed) position with the color at palette index <color>.

//	<unknown> seems to be legacy; changing it had no visible effect on the game.

// Used for lights on planes. Probably the dynamic counterpart to 0034.


// 0098 <coverage>

// Multiply the texture's coverage with the factor 31 + <coverage> (in the range of [0, 31]).

// Used to fade smoke puffs and building shadows.


// 009D <position0> <position1> <position2>

// Draw a triangle. The indices of its vertices' (transformed) positions are given in clockwise order by

//	<position0>, <position1> and <position2>. Whether the triangle is flat-shaded, Gouraud-shaded or

//	textured depends on the material mode set by the last 009F instruction.


// 009E <position0> <position1> <position2> <position3>

// Draw a quad. The indices of its vertices' (transformed) positions are given in clockwise order by

//	<position0>, <position1>, <position2> and <position3>. Whether the triangle is flat-shaded,

//	Gouraud-shaded or textured depends on the material mode set by the last 009F instruction.


// 009F <unknown> <surface> <type>

// Fetch the next triangle's or quad's material. Whether it is flat-shaded, Gouraud-shaded or textured

//	depends on the global 'BUILD_TEXTURES' flag as well as on the instruction's type:

//	• with BUILD_TEXTURES enabled, the rendering mode is read from 'red****.ini'.

//	• with BUILD_TEXTURES disabled, the rendering mode depends on the instruction's type:

//		— 0103 <color>: one color is fetched for a flat-shaded quad.

//		— 0301 <color>[3]: three colors are fetched for a Gouraud-shaded triangle.

//		— 0401 <color>[4]: four colors are fetched for a Gouraud-shaded quad.

//		— 0900 FFFF (<U> <V>)[4]: four texture positions are fetched for a textured quad.


// 00A3 <offset>

// If true-color textures are available, jump <offset> - 2 bytes.


// 00A7 <r> <g> <b>

// Enables blending of 0088 textures with the given 8-bpc sRGB color. Available with true-color textures

//	only; usually followed by a 00A8 terminator.


// 00A8

// Disables 00A7.




UNCERTAIN




// 0007 <offset>

// If ???, call the subroutine at <offset> - 2 bytes.


// 0024 <reference> <offset>

// 707.3 >= ???


// 0025 <reference> <offset>

// 707.3 <= ???


// 0026 <threshold> <offset>

// Probably the same as 0027? The only thing for sure is, it's something with distance.


// 0038 <color> <position0> <position1> <position2> <position3>

// 00A2 <color> <position0> <position1> <position2> <position3>

// Draw a flat-shaded quad with the color at palette index <color>. The indices of its vertices'

//	(transformed) positions are given in clockwise order.

// The exact purpose of these instructions is unknown — they seem to be useful for shadow drawing only; the

//	polygons they draw are not visible in the actual game.


// 003F <unknown> <offset>

// If lights are enabled, draw the submesh at <offset> - 2 bytes.


// 0040 <unknown> <offset>

// a101.3 Same form as 003f, Is the only test value 128 ???


// 0041 <unknown> <offset>

// barracks.3 Same form as 003f, Is the only test value 128 ???


// 0042 <unknown> <offset>

// air_hq.3 Same form as 003f, Is the only test value 4 ???


// 0043 <time of day> <offset>


// 0045 <unknown>[2]

// fact90.3 Same form as 003f, Is the only test value 128 ???


// 0051 <position> <unknown>

// Mark the position at the given index as the base position for a weapon pylon.


// 004A <unknown>

// Probably some vertex operation. Changing the value did not have any visible effect on the game.


// 005D <unknown> <color> <position> <radius>

// Draw a semi-transparent flat-shaded sphere of the color at palette index <color> and a radius of <radius>

//	at the <position>'th position.


// 0060 <number> (<unknown> <color> <position> <radius>)[<number>]

// Draw <number> semi-transparent flat-shaded spheres, with of the color at palette index <color> and a

//	radius of <radius> at the <position>'th position each.


// 0075 <position>

// Mark the position at index <position> to spawn a weapon, chaff, smoke, etc.


// 0076 <offset>

// If ???, jump <offset> - 2 bytes.

// Assume true.


// 007B <offset>

// If ???, jump <offset> - 2 bytes.

// Assume true.


// 007C <offset>

// If ???, jump <offset> - 2 bytes.

// Enables and disables the glass of the F-22 canopy. Assume true.


// 0086 <position> <unknown>

// Mark the position at index <position> as a joint to other movable models, like rudders in the high F-22

//	LODs.


// 0087 <offset>

// If ???, jump <offset> - 2 bytes. Seems to enable or disable planes.


// 0093 <offset>

// If ???, jump <offset> - 2 bytes. Seems to enable or disable terrain.





UNKNOWN





// 0052 <unknown>[3]


// 0054


// 0077 <unknown>[9]


// 0094 <unknown>[2]


// 0097 <unknown>[2]

Link to post
Share on other sites

...After the hardcoded texture, I've elected to join the next 2 bytes in to one word of the form '2bXX' for now. Then come 8 seemingly separate bytes each in the range 00 to 0f....then finally the number of vertices as a word.

All the '0020' and '00a3' files are terrain, although the reverse isn't true. eg 'aswan_e' is a '0083'

I've shortened this list since the forum won't accept the whole thing. I've included the couple of instances where the 9th word isn't '07d0'.

fc00 1f40 0000 0000 7fff 0000 0000 0000 07d0 0000 0002 0003 0003 0000 0000 0000 00a3 000e 000b 000c 000d 0000 0000 0000 0000 0000 0000 0000 215445585f333000 2b5d 08 09 0a 0b 04 05 06 07 0000 0020 0000 0020 0000 0020 0000 005a abtw_1ra.3

fc00 1f40 0000 0000 7fff 0000 0000 0000 07d0 0000 0002 0003 0003 0000 0000 0000 00a3 000e 000b 000c 000d 0000 0000 0000 0000 0000 0000 0000 215445585f333000 2b5d 08 09 0a 0b 04 05 06 07 0000 0020 0000 0020 0000 0020 0000 0058 abtw_1ro.3

fc00 1f40 0000 0000 7fff 0000 0000 0000 07d0 0000 0002 0003 0003 0000 0000 0000 00a3 000e 000b 000c 000d 0000 0000 0000 0000 0000 0000 0000 215445585f333000 2b5d 0f 0c 0d 0e 04 05 06 07 0000 0020 0000 0020 0000 0020 0000 005a abtw_2ra.3

fc00 1f40 0000 0000 7fff 0000 0000 0000 07d0 0000 0002 0003 0003 0000 0000 0000 00a3 000e 000b 000c 000d 0000 0000 0000 0000 0000 0000 0000 215445585f333000 2b5d 0c 0d 0e 0f 07 04 05 06 0000 0020 0000 0020 0000 0020 0000 0058 abtw_2ro.3

fc00 1f40 0000 0000 7fff 0000 0000 0000 07d0 0000 0002 0003 0003 0000 0000 0000 00a3 000e 000b 000c 000d 0000 0000 0000 0000 0000 0000 0000 215445585f333300 2b5e 0c 0d 0e 0f 07 04 05 06 0000 0020 0000 0020 0000 0020 0000 0058 abusim2.3

fc00 1f40 0000 0000 7fff 0000 0000 0000 07d0 0000 0002 0003 0003 0000 0000 0000 00a3 000e 000b 000c 000d 0000 0000 0000 0000 0000 0000 0000 215445585f323500 2b58 08 09 0a 0b 0c 0d 0e 0f 0000 0020 0000 0020 0000 0020 0000 001e abu_sim.3

fc00 1f40 0000 0000 7fff 0000 0000 0000 07d0 0000 0002 0003 0003 0000 0000 0000 00a3 000e 000b 000c 000d 0000 0000 0000 0000 0000 0000 0000 215445585f333400 2b5f 09 0a 0b 08 0c 0d 0e 0f 0000 0020 0000 0020 0000 0020 0000 003a abydos.3

fc00 1f40 0000 0000 7fff 0000 0000 0000 07d0 0000 0002 0003 0003 0000 0000 0000 00a3 000e 000b 000c 000d 0000 0000 0000 0000 0000 0000 0000 215445585f333300 2b5e 04 05 06 07 03 00 01 02 0000 0020 0000 0020 0000 0020 0000 0032 aden_a.3

fc00 1f40 0000 0000 7fff 0000 0000 0000 07d0 0000 0002 0003 0003 0000 0000 0000 00a3 000e 000b 000c 000d 0000 0000 0000 0000 0000 0000 0000 215445585f313900 2b51 08 09 0a 0b 04 05 06 07 0000 0020 0000 0020 0000 0020 0000 0058 aden_b.3

fc00 1f40 0000 0000 7fff 0000 0000 0000 07d0 0000 0002 0003 0003 0000 0000 0000 00a3 000e 000b 000c 000d 0000 0000 0000 0000 0000 0000 0000 215445585f333300 2b5e 00 01 02 03 00 01 02 03 0000 0020 0000 0020 0000 0020 0000 0032 aden_c.3

fc00 1f40 0000 0000 7fff 0000 0000 0000 07d0 0000 0002 0003 0003 0000 0000 0000 00a3 000e 000b 000c 000d 0000 0000 0000 0000 0000 0000 0000 215445585f323800 2b52 00 01 02 03 00 01 02 03 0000 0020 0000 0020 0000 0020 0000 001e aden_d.3

fc00 1f40 0000 0000 7fff 0000 0000 0000 07d0 0000 0002 0003 0003 0000 0000 0000 00a3 000e 000b 000c 000d 0000 0000 0000 0000 0000 0000 0000 215445585f323100 2b51 0c 0d 0e 0f 0f 0c 0d 0e 0000 0020 0000 0020 0000 0020 0000 001e aden_e.3

fc00 1f40 0000 0000 7fff 0000 0000 0000 07d0 0000 0002 0003 0003 0000 0000 0000 00a3 000e 000b 000c 000d 0000 0000 0000 0000 0000 0000 0000 215445585f313900 2b51 0c 0d 0e 0f 07 04 05 06 0000 0020 0000 0020 0000 0020 0000 001e aden_f.3

fc00 1f40 0000 0000 7fff 0000 0000 0000 07d0 0000 0002 0003 0003 0000 0000 0000 00a3 000e 000b 000c 000d 0000 0000 0000 0000 0000 0000 0000 215445585f323100 2b51 0c 0d 0e 0f 0f 0c 0d 0e 0000 0020 0000 0020 0000 0020 0000 001e aden_g.3

..

fbf0 1f40 0000 0000 7fff 0000 0000 0000 07d0 0000 0002 0003 0003 0000 0000 0000 00a3 000e 000b 000c 000d 0000 0000 0000 0000 0000 0000 0000 215445585f333300 2b5e 0c 0d 0e 0f 07 04 05 06 0000 0020 0000 0020 0000 0020 0000 005a aswan_l.3

fbf0 1f40 0000 0000 7fff 0000 0000 0000 07d0 0000 0002 0003 0003 0000 0000 0000 00a3 000e 000b 000c 000d 0000 0000 0000 0000 0000 0000 0000 215445585f333400 2b5f 0a 0b 08 09 0e 0d 0c 0f 0000 0020 0000 0020 0000 0020 0000 0029 aswan_m.3

fa40 1f40 0000 0000 7fff 0000 0000 0000 03e8 0000 0002 0003 0003 0000 0000 0000 00a3 000e 000b 000c 000d 0000 0000 0000 0000 0000 0000 0000 215445585f323800 2b52 00 01 02 03 00 01 02 03 0000 0020 0000 0020 0000 0020 0000 005e aswan_n.3

fbf0 1f40 0000 0000 7fff 0000 0000 0000 07d0 0000 0002 0003 0003 0000 0000 0000 00a3 000e 000b 000c 000d 0000 0000 0000 0000 0000 0000 0000 215445585f333400 2b5f 0a 0b 08 09 0e 0d 0c 0f 0000 0020 0000 0020 0000 0020 0000 005a aswan_o.3

..

fc00 1f40 0000 0000 7fff 0000 0000 0000 07d0 0000 0002 0003 0003 0000 0000 0000 00a3 000e 000b 000c 000d 0000 0000 0000 0000 0000 0000 0000 215445585f323800 2b52 00 01 02 03 00 01 02 03 0000 0020 0000 0020 0000 0020 0000 0019 jeddah_f.3

fc00 1f40 0000 0000 7fff 0000 0000 0000 07d0 0000 0002 0003 0003 0000 0000 0000 00a3 000e 000b 000c 000d 0000 0000 0000 0000 0000 0000 0000 215445585f323000 2b51 04 05 06 07 0d 0e 0f 0c 0000 0020 0000 0020 0000 0020 0000 001e jeddah_g.3

fc00 1f40 0000 0000 7fff 0000 0000 0000 0c33 0000 0002 0003 0003 0000 0000 0000 00a3 000e 000b 000c 000d 0000 0000 0000 0000 0000 0000 0000 215445585f323800 2b52 00 01 02 03 00 01 02 03 0000 0020 0000 0020 0000 0020 0000 0019 jeddah_h.3

fc00 1f40 0000 0000 7fff 0000 0000 0000 07d0 0000 0002 0003 0003 0000 0000 0000 00a3 000e 000b 000c 000d 0000 0000 0000 0000 0000 0000 0000 215445585f313900 2b51 0c 0d 0e 0f 07 04 05 06 0000 0020 0000 0020 0000 0020 0000 001e jeddah_i.3

..

It is interesting that you separated the 8 bytes which are preceded by the Texture and 2bXX. Considering these 8 bytes follow the texture name, one would consider that they could possibly be related. Instead of 8 individual bytes, it makes more sense if I look at them as 2 sets of 4-bytes each. If we know that the terrain tile base textures are 192 x 192 and contain four blocks of 96 x 96, the 4-byte sets could be seen to describe an order of texture mapping of the corner coordinates of the individual 96 x 96 tiles. In effect, perhaps the 4-byte sets are possibly describing a terrain tile transformation (flipping?). If I use the tags in the following diagram to label the texture quads and then map the two 4-byte sets for each 00A3 type header, it seems to fit:

taw-quad1.jpg

:popcornsmilie:

Link to post
Share on other sites

Well maybe. I certainly agree that there seem to be two 4 byte sequences.

While looking through my list of 00a3 headers, I was surprised to see chinook1.3. In this, the 2bXX and 8 following bytes are missing, so the header is shorter.

Since my parsing rules for 00a3 give the start of the bytecode at the 46th word, my parsing is wrong. :(

Now, for this single file, I'm in the same situation as 0083/0087 where it's not obvious where the bytecode should start. :( :(

...and I've had another look at 0083/0087 to try and calculate the LOD starts, but I just can't see any correlation. :( :( :(

Link to post
Share on other sites

This may sound strange, but: How do we know it's our fault if we don't find LOD's?

I noticed F-14, F-16 and F-18 not having any LOD at all in TAW. Can anyone confirm this? Why doesn't TAW use their LOD's (which are definitely present, as we can render them)?! What other planes don't have LOD in TAW and what do they have in common?

Mike, could you please send me your 0083/0087 header lists?

Link to post
Share on other sites

The LODs are working fine for the Learjet at least. I changed the second word of learjet1.3 from 0x96 to 0x0001. This should only show the highest LOD within 8 feet or so. We expect then to see the second LOD when we start the Luxor Takeoff mission....which is what happens:

lear_lowlod.jpg

Link to post
Share on other sites

Got the list; thank you – the formatting is alright.

Yes, the learjet shows up correct here, too. The planes not having LOD's are:


f141.3

f161.3

f181.3

f22s1us1.3 / f22clus1.3 (couldn't identify the file)

rafale1.3

f15e

jast1.3

hawk1.3 ?

u21.3 ?

aurora1.3 ?
These are visible from distance, but I don't know whether they actually use a lower LOD or the highest LOD is just used until infinity:

f15.3

f16ub.3

ef20001.3

su371.3

su351.3

su271.3

mig211.3

mig351.3

mig291.3

mig31.3

f117a.3

a101.3

b2.3

tornado1.3

harrier.3

mirage1.3

mig27.3 / mig271.3 ?

su251.3

su301.3

su341.3

ec130.3

rc135.3

mig25.3

mig27.3

I couldn't test more yet. The F-18E is definitely invisible until I'm as close as 0.5 NM; the highest LOD will pop up then.

Not to self: TAW seems to use the projected Z coordinate of the model's center for distance tests; not the actual distance.

Link to post
Share on other sites

I did the same exercise with the F14 (f141.3) ie changing the second word to 0x0001 from 0x0096. I edited sim6a.udl and .mdl to call up F14s instead of Learjets. What's cool is the game is smart enough to put them at the military end of the airport near the F22.

Anyway, I couldn't see anything wrong with the LODs.

f14_lods.jpg

What technique are you using?

Link to post
Share on other sites

I did the same exercise with the F14 (f141.3) ie changing the second word to 0x0001 from 0x0096. I edited sim6a.udl and .mdl to call up F14s instead of Learjets. What's cool is the game is smart enough to put them at the military end of the airport near the F22.

Is there some reason you are using the edited Training Mission files? Even the A50 is a question because, in-game, it has that fog-like effect at distance instead of the simple LOD model I get with the 2nd word @ 0x0001.

Link to post
Share on other sites

I know that airbase at Luxor quite well, and also happen to know that the scenario is called sim6a, so it's easy to modify the .Xdl files to provide any vehicle I want.

This is the quickest way I know of seeing stuff in-game.

Link to post
Share on other sites

Alright. Well, here's the F-14 in custom combat, invisible even at close distance:

1nof14.th.jpg

Eventually visible with highest LOD a few feet closer:

2f14d.th.jpg

This still seems like a difference to the viewer to me. (Shouldn't it be visible for miles and miles as a small dot?) I don't know what to think of that.

Link to post
Share on other sites

Which set of .3 files are you using?

For the F-14, the first few words of the original f141.3 file are as follows:

fffb 0096 03e8 0000 0000 7fff

ie Most detailed LOD up to 0096 ( about 1200 feet), then least detailed LOD up to 03e8 ( about 1.5 miles)....then nothing.

There is also a set where we edited all the files so that the highest LOD is always shown. In this case, the first few words would look like this:

fffb 03e8 03e8 0000 0000 7fff.

Link to post
Share on other sites

I did indeed use the original file set for the viewer and the modified file set for the game :banghead:

They're consistent now. I'm sorry for the trouble.

Small update on time of day:

Compute the bit mask via (1 << parameters.timeOfDay) - 1.

Then, 0043 means jump if operand is below or equals the bit mask.

Assuming 0040 true, this will render the following with ref_2.3:

1 – 08:00 shadows, lights off

2 – 10:00 shadows, lights off

3 – 12:00 shadows, lights off

4 – 14:00 shadows, lights off

5 – 16:00 shadows, lights off

6 – 18:00 shadows, lights off

7 – 20:00 shadows, lights on

8 – 22:00–05:59 full moon shadows, lights on

9 – 06:00 shadows, lights on

I must, however, test other models.

Link to post
Share on other sites

I consider daytime decoded. The bit mask for the current time of day is computed by

(1 << x) - 1

where x equals

  • 1 for 08:00
  • 2 for 10:00
  • 3 for 12:00
  • 4 for 14:00
  • 5 for 16:00
  • 6 for 18:00
  • 7 for 20:00
  • 8 unknown
  • 9 for 06:00

// 003F <time> <offset>

// 0040 <time> <offset>

// If the time of day mask is above or equals <time>, draw the submesh at <offset> - 2 B.

// Used to enable building lights and street lights at night.


// 0043 <time> <offset>

// 0045 <time> <offset>

// If the time of day mask is below <time>, jump <offset> - 2 B.

// Used to enable landing gear lights on planes at night.

This might become easier, maybe we can drop the - 1. I'll still have to check that.

Shadows will only use 1–6 and 9. Night time keeps the shadows of daytime 6 if the night is moonlit, I suspect 8 means moonless night.

This has the following effects:

  • 08:00–17:59, no lights are drawn.
  • 18:00–19:59, the lights at skyscrapers, refineries and communications targets are drawn.
  • 20:00–07:59, the above lights, all building lights and street lights are drawn.

This resembles in-game experience exactly. However, I'll still have to decode moonlit and moonless nights. I see the first free flight in the training section is a moonlit night; are there any other scenarios with moonless nights I can observe?

Link to post
Share on other sites

Regarding aswan_q, the 'tongue' is defined by trg_4.tm, but as this is completely transparent, you see what is underneath.

I've changed trg_4 to the next index up, which happens to be 'plane_19.tm'

aswan1.jpg

Not the desired final result, but shows what can be done in 5 minutes with the help of this tool. :thumbsup:

Sorry it's been a while. With everything else going on the past couple months, this fell off the radar.

That said, I was inspired by a satellie image of Aswan Dam on the wall at work. In reality, that lip is earth. Aswan is back on the radar now, and I have a texture for you

TEX_50.tm

gallery_1267_5_12802.jpg

I think this is one of the additional water textures Polak made but didn't use, and it's not listed in the redxxxx.ini. That said, we could easily add 50=TEX_50, as the redxxxx file jumps from 49 to 51:

49=cam2_20

51=trg_16

Obviously, we want to use the XY coordinate boundaries of 0,0 and 95, 95.

If this color doesn't work out, I can always adjust the tile. Since it's not currently in use, adjusting the colors won't adversely affect anything else.

Another alternative if 50 doesn't work out is TEX_21.tm, using the same XY coordinates:

gallery_1267_7_14829.jpg

Thanks again, guys, for the great effort.

Link to post
Share on other sites

I see the first free flight in the training section is a moonlit night; are there any other scenarios with moonless nights I can observe?

Great work!

I'm not sure how it's decided whether there is a moon. It might be random since if I start the Takeoff training mission at 02:00, sometimes the moon is out, and sometimes it isn't.

Link to post
Share on other sites

Great work!

I'm not sure how it's decided whether there is a moon. It might be random since if I start the Takeoff training mission at 02:00, sometimes the moon is out, and sometimes it isn't.

I think it is random.

BTW, great find on the lighting as well.

Link to post
Share on other sites

You are correct. I can start the mission at the same time again and I'll have a moonless though it had a moon before. It might be pseudo-random (first eight flights with Moon, then eight without or something like that) but it's definitely something without common sense in it.

Anyway — moonlit and moonless nights use the same shadows (those of 22:00) until 06:00. Furthermore, I did a mistake with the 003F and 0040 mistakes, and the - 1 can be omitted if we don't check for equality. So everything boils down to this:

TODMask = (1 << x)

with x

  • 1: 08:00
  • 2: 10:00
  • 3: 12:00
  • 4: 14:00
  • 5: 16:00
  • 6: 18:00
  • 7: 20:00
  • 8: 22:00
  • 9: 06:00

// 003F <time> <offset>

// 0040 <time> <offset>

// If the time of day mask is below <time>, draw the submesh at <offset> - 2 B.

// Used to enable building lights and street lights at night.


// 0043 <time> <offset>

// 0045 <time> <offset>

// If the time of day mask is below <time>, jump <offset> - 2 B.

// Used to enable landing gear lights on planes at night.

With all those shadows and lights working, I'm really longing for palettes … :(

Link to post
Share on other sites

With all those shadows and lights working, I'm really longing for palettes … :(

There's probably more to palettes than meets the eye....

HF,

Here's aswan_q with tex_50 (and with the dam destroyed). Since the existing coordinates used the top right of the trg_4,I just removed 192 from each u coordinate:

aswan_q.jpg

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...