Register | Login
Views: 19364387
Main | Memberlist | Active users | ACS | Commons | Calendar | Online users
Ranks | FAQ | Color Chart | Photo album | IRC Chat
11-02-05 12:59 PM
1 user currently in Rom Hacking: hukka | 2 guests
Acmlm's Board - I2 Archive - Rom Hacking - Starfox Polygon Viewer, Now in Color! | |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread
User Post
VL-Tone

Red Cheep-cheep
Level: 23

Posts: 29/200
EXP: 64158
For next: 3565

Since: 06-06-04
From: In the Moon!

Since last post: 5 days
Last activity: 2 hours
Posted on 10-08-04 03:06 PM Link | Quote
Hi there!

Just wanted to give you a little update about my StarFox reverse-engineering project. My Shockwave polygon decoder now
shows animated objects and more recently I added color at last. It wasn't easy but after a few days of intense hacking
I found how the palette/texture animation data was stored. Color animation and bitmap textures are not yet enabled in
my demo. Try it in your browser at http://pages.infinit.net/voxel/StarFoxObjectDecoder.htm and/or look at larger
screenshots there:
http://www.angelfire.com/electronic/dokidoki/http://membres.lycos.fr/nes3d/SFXDecoderScreenshots.html

If this page was to go down in the next few days, a mirror is set up there
http://membres.lycos.fr/nes3d/StarFoxObjectDecoder.htm but you'll be annoyed with the french banner frame




The StarFox 2 betas can use most of the StarFox 1 palettes it seems, though bitmap textures are different. As you can
see I pretty much figured out all things pertaining to the bitmap textures in SF 1, so it's mostly a matter of finding
an efficient way to deal with them in Shockwave. Not that it's hard, but I never dealt with texture mapping before.

One thing I figured out pretty quickly is that StarFox only uses a fixed palette of 16 colors to display all polygons!


Using a checkerboard pattern the FX chip can simulate up to 256 colors on the screen (more like 128 though). These
pseudo-colors are refered as a XY byte in hex so X and Y are the 2 colors used in the pattern. Color 0 on the 16 colors
palette is a transparent color so when you use it with a normal color, lets say F0 with F being green, you get a
semi-transparent green color polygon. As far as I know this is not used in the game except for bitmap texture masking
but in theory everything could be semi-transparent with probably no loss on speed. Each object face can either use a
solid color, a light sourced color or a bitmap texture. The faces color number refers to the type of color/texture
using a byte, that gives 256 possibilities. Those possibilities are defined somewhere begining at $18200 in the ROM.
Each entry can be static or an animated sequence of colors/textures. There are about 9 of these sets and the 28 byte
object definition has a pointer to tell which one is used, for example 13 82 is the most commonly used palette (refer
to my other post to know where the 28 bytes object definition table is.) That 13 82 number translate to
$18213+$200=$18413 in the ROM. At this address you can find 256 2 bytes color/texture references. Here is a little
description of the format:

XX 00 to XX 08= Nine light sourced colors, the different variations are stored at $19000 in ROM.
The 9 colors are stored as 10 shades so that makes 90 bytes. There are 4 conscecutive shade variations of these 90
bytes.


XX 3E= Color where XX is Color from one of the twenty 32 color palette sets starting at $18D8A in ROM.
Which of one of the 20 palettes variations is used can be changed dynamically by the game (like when you crash).


XX 3F= Color where each X is from the standard StarFox 4-bit palette to form the checkerboard pattern


XX 40= 32x32 Texture where XX is texture position number, 80$+ is on texture page two
XX 41= 64x64 Texture flip horiz
XX 42= 8x8 Texture flip horiz
XX 43= 64x16 Texture flip horiz
XX 44= 32x8 Texture flip horiz
XX 45= 32x8 Texture
XX 46= 64x64 Texture
XX 47= 16x8 Texture
XX 48= 32x32 Texture
XX 49= 64x64 Texture Polar Mapping Down Left
XX 4A= 64x64 Texture Polar Mapping Down Right

As many figured out textures are stored as two 256x256 pages using 4 bits per pixel (they use the same 16 colors
palette). The pages are interleaved meaning that for each XY$ byte in hex, X is used for page 1 and Y for page 2.

XX 8X= Animated color/texture where XXX is anim data offset (18XXX$+200$ in ROM).
First byte of animated data is the number of frames, then the data is in this same format (some entries seems unused
and corrupted).

So thats about it, I didnt check all of the other types because they are not used in the game objects, but there are
some weird unused things like the polar mapping texture effect which creates a circular pattern from a bitmap.

Note that in the pictured palettes, I blended the checkerboard pattern to obtain a solid color, anyway Shockwave uses
opengl and I don't see a way to do this silkscreening effect on a standard 3d videocard, it's really an FX chip thing.
(no it's not a matter of applying a checkerboard pattern to a polygon, as it would get distorted by perspective)

Here is the most common 256 colors/textures palette (13 82) used in the game, decoded to rgb color, note that bitmap
textures and the transparent color are represented as white and black . Colors going down are animated.


As for level data, I'm still working on documenting it's format, if you click on the StarFox logo in my demo you'll be
able to play in the training level, decoded from the game, with some missing parts. There are still many things to
figure out and document before I can think of making a level editor or a remake, but it seems less impossible than a
few months ago. There is a category of objects that moves on paths and/or are somewhat interactive, these are mostly
enemies and bosses (and the hidden multi bomb weapon). One of the objects I found in this category is an arwing that
comes in front of you, and mimick all of your movements, or another that does it while inverting the horizontal or
vertical movements! Really fun to play with (for a few seconds at least), maybe I should release an IPS patch. I'm
waiting to have a more complete hack before releasing something else. Sure I could change many things in a level,
moving and changing objects, changing colors, put textures and transparency on most objects and call it "the first REAL
hack ever released for StarFox 1", but you know, I'm not like that

I'm interested in the in the StarFox 2 translation effort, as it includes finding out about the only compressed
part of the game, which is the graphics used for text, characters and the title screen, and that applies to StarFox 1
too. As you know the textures for the polygons shown up here are not in the same format, and they are uncompressed, and
all the data I found was too. I would sure like to be able to hack the bitmap part of the title screen Also, StarFox
can also use the compressed graphics as polygon textures, and it does in a few rare cases, such as the big text flying
towards you in the credits, and the Nintendo logo when you boot the game. Ah that makes me think, I found a cheat that
enables you to regain control of the arwing during the credits and (end of level sequences) and then you can shoot the
names! What a great way to waste time on the weekend
Smallhacker

Green Birdo

SMW Hacking Moderator
Level: 68

Posts: 585/2273
EXP: 2647223
For next: 81577

Since: 03-15-04
From: Söderhamn, Sweden

Since last post: 10 hours
Last activity: 9 hours
Posted on 10-08-04 06:09 PM Link | Quote
Amazing!
FloBo

Koopa
Level: 17

Posts: 13/101
EXP: 20723
For next: 4020

Since: 09-11-04

Since last post: 3 days
Last activity: 13 hours
Posted on 10-08-04 11:17 PM Link | Quote
Well, seems like both of SNES's Starfox-versions should be completely hackable in the future. As there are both an english and a german text (and graphics) hacked versions coming up. And thanks to you, VL-Tone, there should be a way to change the 3-d models used by both games as well.


...mmmmhh! Just been dreaming of a complete hacked "Starfox3" PD-rom ^^


but hey: really great work so far. When will you/we be able to change polygon-data within the rom? I mean, none of us really knows how all that 3d-stuff works in particular. So what about an object-editor in the future?


(edited by FloBo on 10-08-04 02:21 PM)
Shadic

Cukeman
Level: 27

Posts: 139/304
EXP: 111073
For next: 5086

Since: 08-20-04
From: Somewhere, Over the Rainbow!

Since last post: 9 days
Last activity: 2 hours
Posted on 10-09-04 03:28 AM Link | Quote
Holy crap! You kick ass!

Bravo.
cpubasic13
17 years old now. Time to buy some M rated games by myself!
Level: 54

Posts: 622/1346
EXP: 1206934
For next: 26936

Since: 03-15-04
From: Blame my parents, Eddy

Since last post: 2 days
Last activity: 1 day
Posted on 10-09-04 04:25 AM Link | Quote
All I have to say: GOOD WORK! I would probably not deal with Starfox polygon editing, but this could prove useful to me in some reason...

Good work.
Smallhacker

Green Birdo

SMW Hacking Moderator
Level: 68

Posts: 592/2273
EXP: 2647223
For next: 81577

Since: 03-15-04
From: Söderhamn, Sweden

Since last post: 10 hours
Last activity: 9 hours
Posted on 10-09-04 04:46 AM Link | Quote
Yesterday: Metroid
Today: Starfox
Tomorrow: Super Mario 64
The day after tomorrow: Perfect Dark

Mmm! Can't wait until sunday.


(edited by Smallhacker on 10-08-04 07:47 PM)
windwaker

Ball and Chain Trooper
WHY ALL THE MAYONNAISE HATE
Level: 61

Posts: 119/1797
EXP: 1860597
For next: 15999

Since: 03-15-04

Since last post: 4 days
Last activity: 6 days
Posted on 10-09-04 05:01 AM Link | Quote
Great job on this, man . This is really awesome. Was this done in flash?
VL-Tone

Red Cheep-cheep
Level: 23

Posts: 30/200
EXP: 64158
For next: 3565

Since: 06-06-04
From: In the Moon!

Since last post: 5 days
Last activity: 2 hours
Posted on 10-09-04 07:36 AM Link | Quote
Hey thanks for the pleasant comments

Flobo wrote
So what about an object-editor in the future?
Yes I would like to make an object editor, but there is a problem, part of the polygon object data includes ways for
the FX chip to do Z-Sorting, and this format looks a little complicated, I haven't figured it out. For small
modifications it wouldn't matter, for example if you keep the same number of faces and vertices. Maybe just enabling
editing of colors/textures and moving vertices positions could be fun enough and that should'nt be tough to implement.
I'm evaluating possibilities for now.


windwaker wrote: Was this done in Flash?
No it wasn't This demo and all my other demos are Shockwave files (.DCR not .SWF... go figure ) produced with
Macromedia Director. I'll try not to rant too much about how Shockwave and Flash are different. Both are from the same
company. Flash started with very limited interactivity but got better over the time. Still you can do most everything
in Shockwave that you can do in Flash, but much much more. For example, Flash cannot do real 3d, the best it could do
is animating vectors shapes with calculated perspective, but it's a pain in the a** to program, it's real slow and it
doesn't use 3d cards. Shockwave 3d uses OpenGL or Direct X and has like 150 commands to modify and create every aspect
of 3d worlds right down to the vertex. Shockwave also have extensive commands to compose bitmap images (offscreen) and
draw into them.

I could go on and on about the many things that you can do in Shockwave that either simply cannot be done in or is very
complicated to do Flash. And you can even insert and control flash movies in Director/Shockwave projects.

Anyway the models in my StarFox demo have polygon meshes generated from decoding the ROM data, and they are real 3d
polygon objects displayed in a real 3d engine, I didn't have to program the part that actually displays them. I can
issue simple commands once the model is built and inserted into the 3d world, for example
theworld.model[1].transform.rotation (0,10,45) that will rotate objects.

I hope my work can inspire some people into trying to hack Mario 64 or GoldenEye polygons and levels (or even StarFox
64!), you know, it's not that impossible to do
Cellar Dweller

Flurry
!!!
Level: 27

Posts: 155/269
EXP: 107817
For next: 8342

Since: 03-15-04
From: Arkansas

Since last post: 16 days
Last activity: 34 min.
Posted on 10-09-04 12:00 PM Link | Quote
I too would like to see hacks of Super Mario 64. There was some discussion about N64 and SM64 hacking in thread 2154. (I wonder if HyperHacker has gotten home yet? )

I have been trying to find a copy of Ultralib as well as the function reference that was taken down from n64.icequake.net so that the Ultralib code and calls to Ultralib could be found in SM64. All I could find was an introductory document. An N64 emulator with a decent debugger would also be nice.

The MIO0 compression, used in some N64 games such as SM64, has been cracked and a tool has been created that can both compress and decompress.

(I hope I have not taken the thread too much off topic.)
VL-Tone

Red Cheep-cheep
Level: 23

Posts: 31/200
EXP: 64158
For next: 3565

Since: 06-06-04
From: In the Moon!

Since last post: 5 days
Last activity: 2 hours
Posted on 10-10-04 10:09 AM Link | Quote
Its ok, its still on the topic of extracting and modifying polygon data of a 3d console game.

For now I'm not really into n64 hacking, though I would be happy to see other people find the polygon and level data for Mario 64. What I hope to show is that 3d hacking is not that hard. Most polygon engines share the same good old basic format, vertex lists and face lists.

I began yesterday to implement basic editing features in my StarFox object viewer. I hope to release something soon.


Xkeeper
The required libraries have not been defined.
Level: NAN

Posts: -3163/-863
EXP: NAN
For next: 0

Since: 03-15-04

Since last post: 2 hours
Last activity: -753366 sec.
Posted on 10-14-04 08:49 AM Link | Quote
That's insane.

Where the heck is "HOLD JACKPOT" and "BYE BYE!!" used, though? Unused textures?
Mel
(USER WAS TOTALLY AWESOME FOR THIS POST)
Level: 47

Posts: 534/991
EXP: 762490
For next: 3713

Since: 03-15-04
From: secure tripcodes are for jerks

Since last post: 17 min.
Last activity: 16 min.
Posted on 10-14-04 09:03 AM Link | Quote
Well, I assume the "BYE BYE!!" is from the Slot Machine, if you get three Androsses. The "HOLD JACKPOT" has to be used somewhere in there as well, too...
BMF98567
BLACK HAS BUILT A SILLY DICE-MAZE!
GO!

Current list of BURNING FURY >8( recipients:
- Yiffy Kitten (x2)
- Xkeeper
Level: 53

Posts: 397/1261
EXP: 1094149
For next: 62970

Since: 03-15-04
From: Blobaria
Special Move: Rising Meatloaf Backhand Combo

Since last post: 21 hours
Last activity: 1 hour
Posted on 10-14-04 12:05 PM Link | Quote
"BYE BYE!!" is used by Professor Hanger. It scrolls across that little black screen when he "greets" you.

"HOLD JACKPOT" is unused. I'm certain it was associated with that slot machine boss at one time (maybe scrolled across that banner on top of the machine).
Xkeeper
The required libraries have not been defined.
Level: NAN

Posts: -3162/-863
EXP: NAN
For next: 0

Since: 03-15-04

Since last post: 2 hours
Last activity: -753366 sec.
Posted on 10-14-04 12:09 PM Link | Quote
BMF, I get a 403 when viewing that image.

And there was probably a 'credits' system for the slot machine, and after getting enough it'd probably explode... ?
BMF98567
BLACK HAS BUILT A SILLY DICE-MAZE!
GO!

Current list of BURNING FURY >8( recipients:
- Yiffy Kitten (x2)
- Xkeeper
Level: 53

Posts: 398/1261
EXP: 1094149
For next: 62970

Since: 03-15-04
From: Blobaria
Special Move: Rising Meatloaf Backhand Combo

Since last post: 21 hours
Last activity: 1 hour
Posted on 10-14-04 12:13 PM Link | Quote
Originally posted by Xkeeper
BMF, I get a 403 when viewing that image.
Yeah, I just realized that. Copy n' paste, plz.
VL-Tone

Red Cheep-cheep
Level: 23

Posts: 32/200
EXP: 64158
For next: 3565

Since: 06-06-04
From: In the Moon!

Since last post: 5 days
Last activity: 2 hours
Posted on 10-15-04 05:25 AM Link | Quote
I was wondering the same thing about the Jackpot and Hold textures, and came to the same conclusions
Maybe we could try to find if there is a coin count tracking byte somewhere in RAM.

Professor Hanger is a reference to StarGlider II, in the game, a boss is named "Professor Halsen Taymar"

I figured the rest of the polygon data format yesterday, which is the "BSP tree" data.
What I found is that objects in SF use Binary Space Partitioning to do the Z-sorting.
This means implementing object editing will be tough, but still feasible.
I already made a demo where you can select and move vertices and change faces color.
It saves an IPS patch containing the edited object, the problem is that it doesn't
take BSP data into account so Z ordering can be messed up.

I'll have to find a way to generate new suitable BSP trees for edited objects.
If you have questions about what are normals and BSP trees etc, don't hesitate to ask.
I'm not a 3d pro either, but I'm learning

So here is a preliminary doc about the polygon format which uses the standard Arwing as an example.




Annotated Deconstruction Of Low Polygon Arwing Object From The Original StarFox.
--------------------------------------------------------------------------------


Notes about this document:

Hex numbers in brackets [] is all the actual ROM data for this object,in the same order.
The low polygon Arwing is entry 294 in the StarFox Decoder demo.
This data can be found at $8F373 in the StarFox 1.0 ROM
(Version 1.0 has a bright red contour on title screen Starfox logo)
As shown below, the first bytes in ROM are 04 04 00 00 F6 00 01 00 00 FA 00.
Everything outside the brackets are annotations.
The animated object data format is not covered in this document.


***Vertex Lump Data***

[04] Normal vertex list following (list type is $04)
[04] Number of vertices in list (as is)

XX YY ZZ 8-bits signed integers
--------
[00 00 F6] 000 000 -010
[00 01 00] 000 001 000
[00 FA 00] 000 -006 000
[00 02 50] 000 002 080
[38] Mirrored (X-axis) vertex list following (list type is $38)
[06] Number of vertices in list (will generate 2x that amount of vertices.)

XX YY ZZ 8-bits signed integers
--------
[24 0E D8] 036 014 -040 (mirror point is -036 014 -040)
[14 F5 EC] 020 -011 -020
[EE 09 FA] -018 009 -006
[F6 04 00] -010 004 000
[14 04 00] 020 004 000
[F2 0A 14] -014 010 020

[0C] End vertex list ($0C)

There are other types of vertex lists (other than $38 and $04 used in this object)
List type $1C is for animated objects.
List type $34 is ehmmm I'm not sure yet, it's along the lines of mirroring where
vertices are doubled, it's mostly used for the wireframe rectangular rotating beams.
I think there are others not documented yet.

***End of Vertex Lump Data***


***Triangles Data for BSP and Normals***

[30] Begin triangle list used to calculate normals and are used by the BSP tree. ($30)

[14] Number of triangles (equal to the number of faces) wich is twenty in this case

P1 P2 P3
--------
[00 0A 01] Three point numbers referencing to the calculated vertex list (The list above + mirror points)
[01 0B 00] In this case there is 4 normal points and six mirrored points so that makes 4+(6*2)=16 vertices.
[0A 0B 01] The order in this case: 4 normal vertex, then 6 vertex with their position intact, and 6 mirrored ones.
[0B 02 00]
[00 02 0A]
[03 0B 0A]
[03 02 0B]
[0A 02 03]
[0B 0C 09]
[04 09 0C]
[0A 0D 05]
[08 0D 0A]
[06 0F 0B]
[0B 0F 06]
[0A 0E 07]
[07 0E 0A]
[0D 08 05]
[08 0A 05]
[04 0B 09]
[0C 0B 04]

***End of Triangles Data for BSP and Normals***


***BSP Tree Data***

[3C] Start of BSP tree

This is a node-based BSP tree, the number of entries is equal to the number of convex faces groups in the face data.

[28 06 18 00 0C] Leaf node ($28) where in that case $06 is refering to a triangle in the list above.
This triangle is the splitting triangle used to divide which face group is in front or behind.
$0018 (reversed byte order) is the number of bytes to skip to get to this faces group data (leaf part of the node).
0C is the number of bytes to skip to get to the one of the two branches for this node. "28 01 7C 00 04" in this case.
The other branch is simply the next BSP entry, "28 0E 1E 00 04" in this case.

[28 0E 1E 00 04]
[44 25 00] Leaf ($44) where $0025 (reversed byte order) is the number of bytes to skip to get to this face group data.
[44 48 00]
[28 01 7C 00 04]
[44 83 00]
[44 94 00]

***End of BSP Tree Data***


***Face Data***

[14] Start of Face group (convex shape) ($14)

Ns Fn Co NX NY NZ V1 V2 V3... Ns is the number of sides for this face. Fn is face number or ID.
-------------------------- Co is color/texture number, refer to my documentation (first post in thread) about the color/texture sets.
NX NY and NZ is the vector of the calculated normal for this face normalized to 128 (or is it 127?)
Vx refers to the vertex numbers as defined by the vertex lump list just like the triangle list (see above)
The number of Vx vertex references is equal to the number of sides, in this case three.
Supported number of sides are 1 (point),2 (line),3,4,5,6 and 8 sides.
Ns Fn Co NX NY NZ V1 V2 V3
--------------------------
[03 06 10 A6 5A F7 03 02 0B] ->This face is a triangle with a gray tint ($10), with a normal vector of (-90,90,9), connecting vertex 3, 2 and 11.
[FF] End of faces group($FF)
[14] Start of Face group (convex shape) ($14)
[03 0E 07 BF 64 D5 0A 0E 07]
[FF]
[14]
[03 0A 00 00 7B 1F 0A 0D 05]
[03 0B 2C 00 9E AF 08 0D 0A]
[03 10 00 48 A5 CC 0D 08 05]
[03 11 01 B0 A2 1D 08 0A 05]
[FF]
[14]
[03 07 14 5A 5A F7 0A 02 03]
[03 00 0A DC 87 0C 00 0A 01]
[03 02 2B 00 00 7F 0A 0B 01]
[03 04 12 53 53 32 00 02 0A]
[03 05 00 00 81 FD 03 0B 0A]
[03 0F 07 41 9C 2B 07 0E 0A]
[FF]
[14]
[03 01 0A 24 87 0C 01 0B 00]
[FF]
[14]
[03 0C 07 41 64 D5 06 0F 0B]
[03 0D 07 BF 9C 2B 0B 0F 06]
[FF]
[14]
[03 03 0E AD 53 32 0B 02 00]
[03 12 00 50 A2 1D 04 0B 09]
[03 13 00 00 7B 1F 0C 0B 04]
[03 08 2C 00 9E AF 0B 0C 09]
[03 09 01 B8 A5 CC 04 09 0C]

[FF 00] End of face group data and end of object data (sometimes is FE00 and sometimes there is nothing indicating the end?)
***End of Face Data***



(edited by VL-Tone on 10-14-04 08:33 PM)
Add to favorites | "RSS" Feed | Next newer thread | Next older thread
Acmlm's Board - I2 Archive - Rom Hacking - Starfox Polygon Viewer, Now in Color! | |


ABII


AcmlmBoard vl.ol (11-01-05)
© 2000-2005 Acmlm, Emuz, et al



Page rendered in 0.020 seconds.