SCARZIP (SCARZ Information Pane)
Sonic Stadium
Green Hill Zone


THE 10 CULTMANDMENTS | THE IDIOT'S GUIDE TO POSTING AT SCARZ
Sonic Online
Sonic Dimension


Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Thoughts on models, Towards a complete NiGHTS model ripped from the game
Quick Man
post Nov 2 2005, 10:46 PM
Post #1


BE ATTITUDE FOR GAINS

Group Icon

Group: CulT Member
Posts: 274
Joined: 17-December 03
From: United Kingdom of Great Boredom
Member No.: 1,120
Gender: Male
Country: United Kingdom



Recently I've been doing more Saturn development, because the SGL is fun to use. I also want to see a tool for ripping models from NiGHTS complete with correct positioning on different objects.

Here's how the SGL (Saturn Graphics Library) does it. This may shed light on how we can get it from NiGHTS.

The position, rotation and scaling for every object is stored in a matrix which is pushed to the stack, changed through the transformation functions slRotX(), slRotY(), slRotZ(), slTranslate() and slScale() and popped again. This positions and draws one object on screen.

Now, objects can also inherit the matrix of their parent. They then apply their own transformations and are displayed in the usual way.

Here's how it works. In the following snippet pos1[XYZ] and pos2[XYZ] are FIXED values and ang1[XYZ] and ang2[XYZ] are ANGLE values. PD_PLANE1 and PD_PLANE2 are both polygons whose nature is irrelevant. (A real SGL application will have more content since it needs the C gubbins to actually make everything work, but this is the crux of it.)

CODE
slPushMatrix()
{
    slTranslate(pos1[X], pos1[Y], pos1[Z]);
    slRotX(ang1[X]);
    slRotY(ang1[Y]);
    slRotZ(ang1[Z]);

    slPutPolygon(&PD_PLANE1);

    slPushMatrix()
    {
        slTranslate(pos2[X], pos2[Y], pos2[Z]);
        slRotX(ang2[X]);
        slRotY(ang2[Y]);
        slRotZ(ang2[Z]);

        slPutPolygon(&PD_PLANE2);
    }
    slPopMatrix();
}
slPopMatrix();


Here the positioning of PD_PLANE2 inherits the matrix of PD_PLANE1 - in essence PD_PLANE2's position is calculated relative to that of PD_PLANE1. By incrementing ang2[Y] I could for example make PD_PLANE2 spin. It's important to note that if I increment ang1[Y] then PD_PLANE1 and PD_PLANE2 both spin - PD_PLANE2 keeps its position the same relative to PD_PLANE1.

Someone more intelligent, more attractive and more godlike will be able to talk about the assembly code this generates and we may from there be able to assess what sort of thing we should be looking for in order to calculate the relative positions for each object in a full model. We're quite close to being able to rip a model from NiGHTS with correct positioning, but more work is needed and I hope I can call on the CulT gremlins to work their usual magic.


--------------------
SONIC CULT IS BEING VERBALLY ASSAULTED BY RETARDS.

ARE YOU A BAD ENOUGH DUDE TO SAVE SONIC CULT?
Go to the top of the page
 
+Quote Post
SANiK
post Nov 4 2005, 04:36 PM
Post #2


The things we do to the people that we love...

Group Icon

Group: CulT Family
Posts: 585
Joined: 13-April 04
Member No.: 2,150
Gender: Male



Nights and SA(2)models are compiled programs.
That means that the pointers within them change.
The only way to CORRECTLY read the model data is to load the model as a program and execute it.

That requires the whole Nights game to be emulated which is too much work.

The current program I have out there scans for vertex and poly data and rips it. Junk data often times gets through and fucks up the positioning.

Right now I have a headache but hopefully I can talk about this more later on.


--------------------
Nintendo DS emu by Raker45:
user posted image
Go to the top of the page
 
+Quote Post

1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
Start new topic

 

Lo-Fi Version Time is now: 16th December 2017 - 07:53 AM