Structured 3D

Hey guys, I've been working on a small project and have been wondering something. Okay, you know how 3D models are animated using nested matrices right? Well instead of hard-coding the structure of the matrices, is there some way data like this could be loaded from CD?

No rush or anything, the code still works fine with the way it is, but there's gotta be a better way than having something like...

Code:
void handle_character_skeletal_structure()

{

 switch(selected_character) //where 'selected_character' is a global.

 {

 case 0:

  slPushMatrix();

  {

  e2_SPRITE3D_animate(0);

  slPushMatrix();

  {

   e2_SPRITE3D_animate(1);

   slPushMatrix();

   {

   e2_SPRITE3D_animate(2);

   }

   slPopMatrix();

  }

  slPopMatrix();

  }

  slPopMatrix();

  break;

 case 1:

  ...

  break;

 }

 return;

}
in your source everytime, eh? I remember there being some sort of 'object' structure that pointed to 'limbs' (child matrices) of a model, but since I'm at work I don't have the docs right in front of me. (god forbid I'd actually be working, heh :lol: )

Once again, this is more of a curiosity than a crisis.

Like always, any info is appreciated ;)
 
Sorry for the late answer...

Originally posted by Zaksund+Mon, 2006-04-17 @ 06:23 PM--><div class='quotetop'>QUOTE(Zaksund @ Mon, 2006-04-17 @ 06:23 PM)</div><div class='quotemain'>Okay, you know how 3D models are animated using nested matrices right? Well instead of hard-coding the structure of the matrices, is there some way data like this could be loaded from CD?

[post=145747]Quoted post[/post]​

[/b]


Of course there is. You could create binary files on PC and load it on Saturn. You would have to define the binary format by yourself(serialize the OBJECT tree to an array of OBJECTs, child pointers are converted to indices in that array, Saturn converts them back to pointers after reading), there is no ready-to-use solution.

This has to be linked to actual 3D data, too. I did something similar that works on Saturn 3D SGL C code which reads C code and produces binary files and C code as well. Look for files RB_POL* and RB_MAP inside the RB library.

<!--QuoteBegin-Zaksund
@Mon, 2006-04-17 @ 06:23 PM

I remember there being some sort of 'object' structure that pointed to 'limbs' (child matrices) of a model, but since I'm at work I don't have the docs right in front of me. (god forbid I'd actually be working, heh :lol: )

[post=145747]Quoted post[/post]​

[/quote]

Exactly:

Code:
typedef struct obj{

  PDATA	*pat; 	/* É|ÉäÉSÉìÉÇÉfÉãÉfÅ[É^ÉeÅ[ÉuÉã */

  FIXED pos[XYZ]; /* ëäëŒà íuÉfÅ[É^ */

  ANGLE ang[XYZ]; /* âÒì]äpÉfÅ[É^ */

  FIXED scl[XYZ]; /* ÉXÉPÅ[ÉäÉìÉOÉfÅ[É^ */

  struct obj	*child; /* éqÉIÉuÉWÉFÉNÉgÉfÅ[É^ */

  struct obj	*sibling; /* åZíÌÉIÉuÉWÉFÉNÉgÉfÅ[É^ */

} OBJECT;

It can't handle XPDATA, but the function slPutObjectX(OBJECT *) ; could be easily implemented.

Are you still focusing so much on libraries? With regard to the lack of developers I think it's a good way to push a library only as far as other personal projects need it. What are you working on and can we expect a release (because that's all that counts for others, a release)? Keep it going, Zaksund!
 
Ah Thanks Rockin'!! That's just what I was looking for!! :cheers I knew one of you guys would come through.

Right now I'm working on a 3D animation editor. It probably would've made more sense to write an animation export tool for 3DSMAX or something, but I just wanted to see if this was something I could do. I've got about 3 more routines to write and a little cleanup to do then I'll release it.

Are you still focusing so much on libraries? With regard to the lack of developers I think it's a good way to push a library only as far as other personal projects need it.
Totally agreed. While like 80% of my code now uses the helper lib, for someone else it probably just ends up being another layer of abstraction.

Keep it going, Zaksund!
Always dude, always...

Once again, thanks for the reply!! In the back of my head, this question was driving me nuts! :lol:
 
Quick update: The core code is done and works perfectly now. I was stuck for a few days, wondering why my backup routines weren't working, but I was expanding the library in a memory address I had already allocated structures in...Oops!

So now I'm just cleaning up my model, and adding some window dressing. I'm not gonna pretend I'm an artist, but hey....you can always change the art later, right? The code working is the most important thing ;)
 
[attachmentid=1882]

Hah! Hey dudes! Here goes everything! :D

Check it out and let me know what's what. There really isn't much to it, conceptually it works, and I've checked it out with other models (like a 28 limbed human model and a like 4 limbed truck model), but the robot clips the least and looks the best of the bunch(finding the best sort type for a polygon takes forever!).

There are bugs and instructions all detailed in the readme. Just remember that the general process is:

- Pose character

- Create keyframe

- Edit animation

- Playback

Anyway...thanks for holding out, and keep coding guys!! ;)
 

Attachments

  • SSMED.rar
    495.6 KB · Views: 142
  • SSMED.rar
    495.6 KB · Views: 138
[attachmentid=1883]

[attachmentid=1884]

[attachmentid=1885]

[attachmentid=1886]

Not exactly the best quality, but they should give you the idea ;)
 

Attachments

  • SCN_03.png
    SCN_03.png
    134.2 KB · Views: 113
  • SCN_02.png
    SCN_02.png
    133.3 KB · Views: 119
  • SCN_02.png
    SCN_02.png
    133.3 KB · Views: 127
  • SCN_01.png
    SCN_01.png
    134.5 KB · Views: 139
  • SCN_01.png
    SCN_01.png
    134.5 KB · Views: 130
  • SCN_00.png
    SCN_00.png
    134.5 KB · Views: 154
  • SCN_00.png
    SCN_00.png
    134.5 KB · Views: 161
  • SCN_03.png
    SCN_03.png
    134.2 KB · Views: 113
Really nice work, I've added it to the Saturn progam page :thumbs-up: :thumbs-up: Zaksund do you have a homepage ?
 
I've always meant to create a webpage, but other than some Saturn demos...there really wouldn't be anything there :p

Where exactly is the readme? Inside the ISO?
Yep, it's in the ISO. Yeah, guess it would've made more sense to pack it outside, eh?
 
I've tried the demo on real Saturn, it's great stuff. I like the font and all it's file loading and backup capabilities.

Furthermore I appreciate that you're working with 3D on SEGA Saturn, because that's something homebrew has not concentrated on enough.

Let me invite you to enter the C4 - 2006 Saturn Coding Contest, I'd love to see you focussing the 3D aspect on Saturn even more. Because this year the objective is to show impressive visuals, which would fit perfectly. After E2 and this nice demo, it's time for you to win some prizes :D , don't you think?
 
Nice! Glad you enjoyed the demo! :D

I'd love to take part in this year's C4. It'll be great to be able to just focus on coding an entry...and I'm really curious to see what others are gonna do (some stuff you guys come up with just blows me away)! Win or lose, this sounds like fun!
 
Back
Top