Author Topic: [FF7]Jet Coaster 3D model  (Read 971 times)

ergonomy_joe

  • *
  • Posts: 24
    • View Profile
[FF7]Jet Coaster 3D model
« on: 2024-11-12 01:32:10 »
Nobody talks about the jet coaster minigame  :'(
why ?

So i decided to make a post about it.

You can get a lot of information from my decompilation project:
   https://github.com/ergonomy-joe/ff7-coaster
(but you need to understand programming then)

Most of the game's assets comes from the file "xbin.bin". This is actually some kind of archive containing 15 streams of data.
(I decided to call them stream, not sure if this is a good idea or not. Anyway ...)
"xbinadr.bin" contains 16 32-bit values that are the start offsets of these streams inside "xbin.bin".
Actually, it would be so if "xbin.bin" was loaded at address 0x800F0000 so some subtractions are needed here.

Anyway, here is a quick overview of each stream's purpose:
0 - BGM in AKAO format (not used in the windows version)
1 - 3D models information
2 - precomputed visibility list: add track element
3 - precomputed visibility list: remove track element
4 - array of SVECTOR: main track
5 - 2 offsets in [4]: left track & right track
6 - 2 lenghts for [4]: left track & right track
7 - array of SVECTOR: maybe camera rotation
8 - precomputed visibility list: add Triangle
9 - precomputed visibility list: remove Triangle
10 - array of Triangles (3 SVECTOR and 3 CVECTOR)
11 - array of SVECTOR: other objects pathes
12 - offsets in [11]
13 - lenghts for [11]
14 - array of game objects information
15 - array of chars: # of objects to add along the main track
16 - points to the end of file

by using the data (part of it) from streams 4, 5, 6 and 1, 10, 14, I created a 3d model file.

I'm trying to post it here.

It shows the main track and the static scenery.
Some objects are missing, the Welcome Post for instance. That is because they are added to the world at runtime.

I use the wavefront obj format because it's the easiest I know of.
I'm also using "3dviewer.net" for viewing because... well it works.
(Try the "Dark Mode" and the "Show Edges" option, it looks very cool)
There is a slight problem though: wavefront only allows one color (material) per triangle while our original data uses a Gouraud model with one color per vertex.
Well, better luck next time.

This is the simplest "sub-program" from FF7, but there is nonetheless a lot to talk about.
Notably concerning the way the track may have been designed, or the precomputed visibility (or is it offline culling ? predefined occlusion ? ... ?).

I may also have questions for people who know about 3D modeling during the 90s.
Until then, have fun.

PS: Well, I could not find how to include my model file here. It is a 3MB text file, 500KB when compressed. Any idea how I could post it here ?

[update]
I could upload an image here:


[update 2]
I found out that OBJ format allows for vertex coloring; but we loose the transparency then. Here is another view:
« Last Edit: 2024-11-14 05:58:12 by ergonomy_joe »

ergonomy_joe

  • *
  • Posts: 24
    • View Profile
Re: [FF7]Jet Coaster 3D model
« Reply #1 on: 2024-11-25 07:19:50 »
I uploaded my "Wavefront OBJ" file to the project github.

Here:
https://github.com/ergonomy-joe/ff7-coaster/blob/master/tools/coaster.obj

You can enjoy it through this URL:
https://3dviewer.net/#model=https://github.com/ergonomy-joe/ff7-coaster/blob/master/tools/coaster.obj

The track is not really a model. The original data is two sets of vertices that represent the respectively the left and right border of the track. The engine uses the "offline" (or is it precomputed ? or whatever) visibiliy data to build a list of visible vertices and build quads with it. The texture "rail.tex" is applied to thoses.
In my model, I just draw lines between the vertices of each pair.

At runtime, the camera position is computed directly from these vertices too.
(function C_005EA194 from C_005E98E0.cpp for those who dare)

ergonomy_joe

  • *
  • Posts: 24
    • View Profile
Re: [FF7]Jet Coaster 3D model
« Reply #2 on: 2024-11-29 00:17:02 »
Well, it's me again.

For the past few days I have been trying to import some of the data from xbin.bin to 3D Studio Max version 1.1; I guess this was the version that was around at the time of the development of FF7, and also, it is the only I could find. :-[

The problem was, this version doesn't include the SDK, which is necessary to build customs importer for instance. Fortunately, there is the source code for an old unreleased game called Golgotha (from Crack Dot Com) which has all the includes files. I had to recreated dummies lib files to please the linker and voila !



I also lack a proper documentation for the SDK. All the books I could find from the era are just about modeling (3D I mean  ;) ) and nothing about plugins development.

So far, I could import the main static models (but without colors) and create a LinearShape from the left part of the Track. Using 3D Studio Max's UI I then created a camera and I animated it by assigning it to the track's LinearShape. It worked ... a little, but I really lack information here.

Does someone have a good documentation for the SDK from that version ?

Also, does someone knows if it 3DS has the feature to generate visibiliy information (let's say, a list of the visible triangles) for each frame of animation ?

Kaiseran

  • *
  • Posts: 23
  • My best games is the RPGs and top is FF7 !
    • View Profile
Re: [FF7]Jet Coaster 3D model
« Reply #3 on: 2024-11-29 18:40:53 »
This is so interesting,
Can this program edit the battle model file LZS of FF7 PS1 version, because
I'm trying to change Cloud's hair to black for make him looks like Zack?
If yes can you do it?

myst6re

  • *
  • Posts: 650
  • Light King of the Savegame - Field Master - FF8.fr
    • View Profile
    • FF8.fr
Re: [FF7]Jet Coaster 3D model
« Reply #4 on: 2024-12-01 14:28:29 »
Really good work!

ergonomy_joe

  • *
  • Posts: 24
    • View Profile
Re: [FF7]Jet Coaster 3D model
« Reply #5 on: 2024-12-03 02:02:39 »
@Kaiseran
The Coaster mini-game has its own format for 3D models and stuffs, so the plugin cannot work for anything else. Sorry about that.

@myst6re
thanks


And now, a word on visibility.

As I say in a previous post, the visibility (or culling, or whatever it is, I'm not sure which word is the correct one in this case) of the static part of the 3D model is pre-computed.
Here is a short explanation of its implementation:

The track on which the cart is moving is defined by 2 sets of points, one the left part of the track and the other for the right. Each point has a distance with the next point of an average of 35 units.

Now, these points defined what we can call "STEP"s in the trajectory.
For each of these "STEP" there is an array of 16 bit values in the next streams:
-stream 2: TrackId to add
-stream 3: TrackId to remove
-stream 8: TriangleID to add
-stream 9: TriangleID to remove

These arrays do not have a constant size for each step. As a matter of fact, they are more like strings whose ending is marked by the value 0xffff.
Because of that, to get the position in the array for a particulare "STEP" you would need to scan it from the first "STEP" until the one you are interested in.

TriangleID is an index in the stream 10.
TrackID is a little bit more complicated, but basically is it the same thing for the track

As you ca see, the program maintains two lists of visible objects; one for the track, and one for the scenery.

They are both implemented as double-linked lists and the detail can be found in the file C_005ED8F0.cpp.

I'm pretty sure this particular implementation was conceived in-house by Square's developers.

As for the information in itself, I wonder:
.Is it possible that the list of visible triangles for each "STEP" of the trajectory, may have been created with whichever modeling tool the staff was using then ?
.Or did they write their own tool ?

If someone reading this has any insight on this, or a good documentation from that time (around 1996 I would say) that would be greatly appreciated.