Author Topic: Model converter (.ZTP) -0.1 - WIP  (Read 1651 times)

XL2

  • Sr. Member
  • ****
  • Posts: 341
  • Karma: +72/-1
    • View Profile
Model converter (.ZTP) -0.1 - WIP
« on: May 29, 2018, 05:51:36 am »
Here is my model converter (and source code) with my custom binary file format I made for my Sonic Z-Treme Engine (ZTP for Z-Treme Polygons).

The code is bad, I just quickly coded this and didn't spend much time cleaning up or removing all the globals.
I will revisit the code and try to add precalculated lightning and per vertex animation support. (done 2018-06-10)
I also added a demo I originaly made for our friend Virtua skimmer.
I would like to ditch OBJ files for DAE, but it's quite hard to implement so I might stick with OBJ for now.

New in version 0.05 : I rotated all the quads 180 degrees and flipped the normals so that the textures are in the proper direction (it was just an annoying issue that didn't cause problems). Updated the demo to add a few features. If you just want to use the converter, update your model loader c file in the ZT folder else you will get alignement issues (the sprites are now in ZTI format).

New in version 0.10 : Animation support! The tool can read a chain of OBJ files and do vertex animation (similar to Quake 2 MD2 format) with interpolation. The normals are also compressed. The demo's animation is bad simply because my own animation is bad, so don't mind it!
« Last Edit: July 26, 2018, 05:04:04 pm by XL2 »

SkimmingSanshiro

  • Newbie
  • *
  • Posts: 21
  • Karma: +3/-0
    • View Profile
Re: Model converter (.ZTP) -0.05 - WIP
« Reply #1 on: May 29, 2018, 02:58:17 pm »
Great work, I didn't even notice the texture issue. Precalculated lighting and per vertex animation would be really useful. I thought the visible workspace was 1200 faces but your demo runs +1500, awesome!
edit: Nevermind its displaying 700
« Last Edit: May 29, 2018, 03:01:05 pm by SkimmingSanshiro »

XL2

  • Sr. Member
  • ****
  • Posts: 341
  • Karma: +72/-1
    • View Profile
Re: Model converter (.ZTP) -0.05 - WIP
« Reply #2 on: May 29, 2018, 04:37:41 pm »
The default workspace can process 2000 quads max, but it will display less because of backface culling.
In my FPS demo I could display over 1000 textured quads at 20 fps.

XL2

  • Sr. Member
  • ****
  • Posts: 341
  • Karma: +72/-1
    • View Profile
Re: Model converter (.ZTP) -0.05 - WIP
« Reply #3 on: June 05, 2018, 04:46:02 am »
Ok, good news!

I got the vertex animation working with compressed vertices (6 bytes each instead of 12 bytes) and linear interpolation (so that you can display a 60 FPS animation with only 15 frames or less if you wish).
Vertex animation allows you to do animations as complex as you want.

I got 40 frames of animation down to 10 KB with 175 vertices (the Sonic model) at 15 fps interpolated to 60 (so 10 frames of animation instead of 40).
I still need to add normals with (maybe, could be overkill) interpolation as well.
It should be possible to compress the normals to 3 bytes instead of 12, but I'll need to see the results as it could be bad.
For the Sonic model, I could probably have 240 frames worth of animation down to less than 100 KB.
While it's a lot, Sonic moves fast so I need more frames, but for a slow moving caracter (like a human) you could probably get good results at 1/6 animation or less if you dismiss 60 FPS.

I still need to improve everything and the user interface is quite complicated right now (you need both your base OBJ model with material and the animation OBJ files numbered in a linear fashion - but Blender can generate those easily).

I'm also worried about the impact on CPU.
Sadly I don't know assembly so I won't be able to fully optimize the function or offload it to the SCU DSP, but I hope to keep the cost to a minimum.

I also added an option to reorganize the 3D model so that you can easily add bone-animation to it if you wish to (for manual animation only).

I hope to release the new version of the converter tool this week.



SkimmingSanshiro

  • Newbie
  • *
  • Posts: 21
  • Karma: +3/-0
    • View Profile
Re: Model converter (.ZTP) -0.05 - WIP
« Reply #4 on: June 06, 2018, 06:57:54 pm »
Fantastic news! Really making projects like mine possible. One thing though excuse my lack of concept but in my Katamari project I ported the PSP level and decimated it and made it quads. When loading the ZTE it missing a few select faces even some simple 4 vertex quad with correct normals, but will let me add more complex things like the plate of snails.

I fixed a lot of the levels glitches by merging the vertices of the separate objects and making sure there isn't a face underneath another. But having a hard time making any more 3d objects show up without being clipped out by the floor or whatever. .

For example of a simple quad clipped: the shopping bag that goes up to the table here
https://i.imgur.com/pa150nf.png

Is clipped on the saturn build but let me add the plate of all this stuff on it, if merged the plates vertices to the ground.
https://www.youtube.com/watch?v=TnBsa35S4MA


Can I make a level this way if I clean it up more or is the Zsorting(?) too much with all the stuff and need a proper map?

XL2

  • Sr. Member
  • ****
  • Posts: 341
  • Karma: +72/-1
    • View Profile
Re: Model converter (.ZTP) -0.05 - WIP
« Reply #5 on: June 06, 2018, 07:35:37 pm »
It depends.
Like I mentionned the tool isn't designed for maps.
It could be that your normals are reversed.
You can use dual plane, but it won't do backface culling so you will cause useless overdraw.
Just make your normals are Ok.
In Blender just activate the backface culling option.
For the clipping : set the zsort to SORT_MAX for the level, SORT_CEN or Min for your entities.

ponut64

  • Full Member
  • ***
  • Posts: 175
  • Karma: +13/-0
    • View Profile
Re: Model converter (.ZTP) -0.05 - WIP
« Reply #6 on: June 06, 2018, 09:46:13 pm »
Looks to me like there are just too many quads, but hey, you've probably done more with this than I have :)

XL2

  • Sr. Member
  • ****
  • Posts: 341
  • Karma: +72/-1
    • View Profile
Re: Model converter (.ZTP) -0.05 - WIP
« Reply #7 on: June 06, 2018, 09:54:21 pm »
Yes, in the video he has 2500 vertices which is the maximum the default workarea supports.
You need to do visibility culling, using an octree/grid/bsp tree at minimum.

SkimmingSanshiro

  • Newbie
  • *
  • Posts: 21
  • Karma: +3/-0
    • View Profile
Re: Model converter (.ZTP) -0.05 - WIP
« Reply #8 on: June 07, 2018, 04:03:22 am »
Ah so seems maybe I can clean this up and have it work. How do I change the attributes in a ZTE without the .h file? I didnt see anything in the SGL documentation other than the .h attributes. Its the same as slZdspLevel();?

The normals are correct one that shopping bag and even replaced it with just a simple plane it doesn't show up looking at both sides. Even with the player removed.  I noticed if I don't draw my player that is 255 vertices it only brings down the count to 2446 so it must just stop drawing the levels vertices at some point and move onto the player. But if I separate the bag to its own ZTE it doesn't draw it either so not really sure what some faces deal are.

Ill just keep messing with it until I get everything now displaying and everything else will be sprite. I tried it out on a real saturn and still runs smooth with the level only missing like three 3d models needed.

Edit: wow I was drawing my level twice lol, now its 1300 vertices but still not drawing the bag.
« Last Edit: June 07, 2018, 04:14:15 am by SkimmingSanshiro »

XL2

  • Sr. Member
  • ****
  • Posts: 341
  • Karma: +72/-1
    • View Profile
Re: Model converter (.ZTP) -0.05 - WIP
« Reply #9 on: June 07, 2018, 04:18:42 am »
 The vertices limit depend on the order you send your slputpolygon commands.
If SGL detects you have 2450 vertices and the next object has 60 vertices, it won't draw it at all.
Try only drawing your ball to see if it works.
For the dual plane quads, if you have a texture name starting with DUAL_ it will convert it as dual plane.
I'm not sure if I implemented this already in the demo.

ponut64

  • Full Member
  • ***
  • Posts: 175
  • Karma: +13/-0
    • View Profile
Re: Model converter (.ZTP) -0.05 - WIP
« Reply #10 on: June 07, 2018, 04:41:44 am »
The bag has no depth to it, right? Just a plane?
In that case I would guess there's nothing you can do except make it dual-plane.

SkimmingSanshiro

  • Newbie
  • *
  • Posts: 21
  • Karma: +3/-0
    • View Profile
Re: Model converter (.ZTP) -0.05 - WIP
« Reply #11 on: June 07, 2018, 04:45:46 am »
Ill try out the DUAL_ texture name out. I was actually displaying my level twice and only at 1300 vertices now but still doesn't want to draw certain faces the same way. The bag has no depth and there's also a box missing thats pretty simple. Backface culling is on in blender. Ill try these trouble ones a seperate dual plane models. So weird this plane is having issues.

 Might try out making the floor a seperate model with a lower zsort see if helps the clipping.

XL2

  • Sr. Member
  • ****
  • Posts: 341
  • Karma: +72/-1
    • View Profile
Re: Model converter (.ZTP) -0.05 - WIP
« Reply #12 on: June 07, 2018, 05:26:10 am »
Also, what's the texture like? Does it have a width that is a multiple of 8?

corvusd

  • Jr. Member
  • **
  • Posts: 81
  • Karma: +8/-0
    • View Profile
    • Personal Web Portfolio
Re: Model converter (.ZTP) -0.05 - WIP
« Reply #13 on: June 07, 2018, 08:37:49 pm »
Fantastic news! Really making projects like mine possible. One thing though excuse my lack of concept but in my Katamari project I ported the PSP level and decimated it and made it quads. When loading the ZTE it missing a few select faces even some simple 4 vertex quad with correct normals, but will let me add more complex things like the plate of snails.

I fixed a lot of the levels glitches by merging the vertices of the separate objects and making sure there isn't a face underneath another. But having a hard time making any more 3d objects show up without being clipped out by the floor or whatever. .

For example of a simple quad clipped: the shopping bag that goes up to the table here
https://i.imgur.com/pa150nf.png

Is clipped on the saturn build but let me add the plate of all this stuff on it, if merged the plates vertices to the ground.
https://www.youtube.com/watch?v=TnBsa35S4MA


Can I make a level this way if I clean it up more or is the Zsorting(?) too much with all the stuff and need a proper map?

Amazing project!! Katamari Damacy in SS whit RT Gouraud Shading!!! OOOOOHHHH!!! :D

David Gámiz Jiménez

SkimmingSanshiro

  • Newbie
  • *
  • Posts: 21
  • Karma: +3/-0
    • View Profile
Re: Model converter (.ZTP) -0.05 - WIP
« Reply #14 on: June 08, 2018, 12:43:57 am »
 I was so certain the texture was fine but turns out it was the problem for the missing planes. Must forgot to switch back to RGB after indexed or saved compressed. Everything is displaying pretty well now, the floor still wants to clip over a lot of things like the player and 3d objects I put on the ground but probably going to use sprite objects to pick up anyway and make the level nice and 3D. And since this half room is only 1000 vertices I think I can manage to add the other half of the PSP level and have the entire level running even with no culling.
.
Edit: Seems to be a file name problem with 3 letter names.
« Last Edit: June 08, 2018, 01:03:48 am by SkimmingSanshiro »

 

Sitemap 1 2 3 4 5 6 7 8 9 10 
SMF spam blocked by CleanTalk