Author Topic: Couple beginner questions on rotation around origin and model conversion  (Read 1263 times)

SkimmingSanshiro

  • Newbie
  • *
  • Posts: 21
  • Karma: +3/-0
    • View Profile
So I have very little experience developing games mostly in Unity and Lua by modifying demos to make a new game. Always wanted to develop for the Saturn since a kid but having a few issues with my demo so far in Jo engine.

I'm using the Advanced 3D sample as my base and so far Ive implemented in it my Player and Level 3D models I converted from .dae and also have the Player control a bit worked out and some movement in the level scenery.

One thing that's driving me a bit crazy is when I display my 3D models in game and rotate thier matrix, they spin off their origin making it almost impossible to place where I want or rotate my player correctly. Also when I display objects in game they are upside down and seems x,y,z are inverted but maybe that's how its supposed to be. Ive looked all the samples and ones posted here, but I just cant grasp what I'm doing wrong.


I have a 3D ocean wave and I'm trying to use a screendoored plane over the top to give the effect of water surface and also eventually another solid plane for the beach. But for the life of me cannot get the plane to be where I want flat above the 3D ocean wave model with he origin being off no matter what x,y,z rotation or position.
The other problem is when I'm trying to convert my sonic jam player model with textures with the map tool it say 214 textured polygons is too much for the Saturn and wont convert even decimated to 140polygons. The dae model has 1 TGA texture


Edit: Well most of this was a brianfart objects are rotating are their correct origin. My ocean wave model in blender when exported was off origin maybe why I cant line it up very well with the dithered plane, it also has bad geometry maybe why the dithered plane doesn't cover evenly.
 Really enjoy using this application time to buy a Saturn again and Pseudo cart. Here is my screen so far of a skimboard/surfing type game.
http://i.magaimg.net/img/2szm.jpg
« Last Edit: March 08, 2018, 08:40:08 am by SkimmingSanshiro »

XL2

  • Sr. Member
  • ****
  • Posts: 343
  • Karma: +75/-1
    • View Profile
Have you tried this?
https://github.com/polygon-studio/Blender-to-Saturn-Model-Exporter

It has some issues with duplicated textures, but it should do what you need.
You can also try my FPS demo's map converter (old old version when I was just starting to learn to code) and play a bit with it to output your player's model.
It imports the textures too, so you would just need to play a bit with the export format to do what you need.

I will share my new FPS demo and map converter in a few weeks, you could also use that, but sadly it's not fully ready yet.

ponut64

  • Full Member
  • ***
  • Posts: 176
  • Karma: +13/-0
    • View Profile
A tip from me -

Yabause is good for hardware debugging, but it is a rather innacurate emulator. Use SSF :)

SkimmingSanshiro

  • Newbie
  • *
  • Posts: 21
  • Karma: +3/-0
    • View Profile
Looking forward to the new tools. That Blender add on looks perfect but unfortunately when I try to install it  auto and manually putting the folder in addons but it doesn't show up and in the console window to see whats wrong  I get "fake_module: addon missing 'bl_info' gives bad performance!: "  in latest blender and 2.66 even reinstalled. Also I couldn't find a bat to build in your FPS map convertor how do I make it?

One more thing is there a download for that 3D mesh/texture mapping example he has on the github? I noticed Jo convertor can convert my .obj with textures but not dae. But in the .h file I don't see how to call them like the one time I got a .dae to convert. The only difference in their .h file is "MESHon" is "MESHoff" so don't see how that works to implement. When I sucessfully converted a .Dae is gave me instructions on loading the textures but I couldn't get it to even load in game and now jo convertor says file no supported when trying no matter a 32x32 TGA/PNG. That link led me to his SGL  guide but still a bit lost http://www.rockin-b.de/saturn/saturngametutorial/SaturnGameTutorial.htm. I know the saturn has to display a entire texture on every face so bit confused how I use my tga texture from the blender model in jo.

On a positive I got the plane I wanted in place finally and with Screendoors and transparency at the same time with a little movement doesn't make for a bad ocean effect.
 





 

XL2

  • Sr. Member
  • ****
  • Posts: 343
  • Karma: +75/-1
    • View Profile
For the collision tool/map converter, you can just open de cbp file in Code::Blocks and compile from there.

For the Blender tool, I haven't tried it yet, but I will soon, I'll let you know if it works for me.

SkimmingSanshiro

  • Newbie
  • *
  • Posts: 21
  • Karma: +3/-0
    • View Profile
Thanks Ill give it a shot. Also seem to have a problem is the polygon clipping when you get close to the camera on large models also causing everything to clip. You mention this issue in your FPS thread. Seems the solutions were to subdivide and jo_3d_display_level(level). When I subdivide even a part of my model it wont work anymore in a emulator and says %100 dynamic memory used. Its only 755 faces so im not sure what the deal is.

I have jo_3d_display_level(5) on my Player and he never clips. BUt in your thread Danny said examples of values for the level:
1: Display from 1/2
2: Display from 1/4
3: Display from 1/8
So am I using it wrong? Heres a video of my problem, maybe its because the messed up geometry in my wave that cause it the flicker?

https://www.youtube.com/watch?v=rri-5gReqZk
« Last Edit: March 08, 2018, 09:52:37 pm by SkimmingSanshiro »

XL2

  • Sr. Member
  • ****
  • Posts: 343
  • Karma: +75/-1
    • View Profile
For the zdisp level, you can set it up to 7 so that it clips closer to the camera.

Make sure your model as the UseNearClip option for each quad in the attributes.
Also choose Windows_In so that only objects in your current window gets sent to the VDP1.
Both will do pre-clipping before sending it to the VDP1, helping you with keeping up the framerate and prevent issues.

For the memory, reduce in your makefile the jo_malloc memory. Something like 256 kb should be enough.
You can also load data to the low work RAM.

For the issue you are having, try to add stats about the amount of quads and vertices on screen.
It could be an issue because you have too much for the default workarea (2500 vertices and 1800 quads).
You can use the slCheckOnScreen function to check if the object is on the screen (if the returned value is >= 0) and discard what is not.


If not, if you are using real transparency, it won't work well. Either set the framerate to 30 fps  (jo_framerate) or remove the VDP1 transparency and use the mesh effect only.
« Last Edit: March 08, 2018, 10:31:24 pm by XL2 »

SkimmingSanshiro

  • Newbie
  • *
  • Posts: 21
  • Karma: +3/-0
    • View Profile
Great tips you were right about the default workspace and managed to subdivide and keep it under. My I added UseNearClip in my attributes
Code: [Select]
ATTRIBUTE(Dual_Plane, SORT_CEN, No_Texture, 0x801f, CL32KRGB | No_Gouraud, CL32KRGB | MESHoff, sprPolygon, UseNearClip),
seems to make no difference on hardware/ssf, seems single plane helps but not much.

It seems I am at the point subdividing makes no difference and its purely on how close the wave is the the camera no matter the scale or poly size. Zdisp is a 7 but 5 seems to be the max effect.

In SSF the clipping is perfect even optimal now because its acts like a window into the barrel at the end of the run and can give a bonus on a barrel ending and have you visible in there. But thats just a bonus.

But on hardware the story is much different. The wave clips MUCH more and also takes with it my player and scenery depending how close it is to the camera. Maybe you could take a glance at my attached blend and tell me if its ridiculous its under 1000 polys. My player is under 200 and the game features currently only 2 sprites, background, 3 planes(I removed the beach right now since I need to figure out the warping), Mesh effects only now too

Here is the clipping on hardware with these changes. Dont mind the missing beach i removed it for now but everything else is clipping
https://www.youtube.com/watch?v=veA5lFDijY8





« Last Edit: March 13, 2018, 03:19:54 pm by SkimmingSanshiro »

ponut64

  • Full Member
  • ***
  • Posts: 176
  • Karma: +13/-0
    • View Profile
Give this a "shot".

http://www.mediafire.com/file/bwh5cacsflrz3m2/VSedit.zip

All I did was throw in a different mesh .. that doesn't render properly.

But that's not the point.

The point is, I tried this on real hardware (a US saturn), and it worked properly.
Incidentally I also used this to confirm the 352x240 mode worked, which it do.

My guess is you are working with a quads limit of some kind... but I'm not really experienced enough to draw a conclusion on that. Something in your mesh isn't right.
« Last Edit: March 11, 2018, 11:08:02 am by ponut64 »

XL2

  • Sr. Member
  • ****
  • Posts: 343
  • Karma: +75/-1
    • View Profile
Ok! According to your video, the Saturn can't complete the drawing. You are at 60 fps, but with all the textured quads, it's too much. You can set dynamic framerate : DynamicFrame (On);  (I'm not in front of my pc, so it might have a different spelling or with sl in front, just look at the demo I made for ponut)

Also try 30 fps :
extern Uint8 SynchConst();
SynchConst=2;
(Again, I'm not on my pc, but take a look at the demo I sent ponut64).
Always use Single_plane!
Else it will still draw backfaced quads.

Also don't use real transparency.

If you really want 60 fps, use low quality textures : 16x16 or even 8x8, but with more than 450/500 quads on screen it might start to enter the draw end mode, which just tries to draw as much as possible before the v-blank.

Also, I forgot to mention, but use Window_In in the attributes.

SkimmingSanshiro

  • Newbie
  • *
  • Posts: 21
  • Karma: +3/-0
    • View Profile
Alright got it working! 30fps was the key, makes the water effect move slower too which is great. I cant 3D model worth anything so glad I don't have to redo the wave for now. Now it mirrors SSF output.

On another note do you guys sometimes failure to launch on Saturn Hardware? I can tell it will happen because the CD stops spinning before I launch the game with Psuedo menu. Maybe I should burn slower than 16x or get Verbatim Datalife+

XL2

  • Sr. Member
  • ****
  • Posts: 343
  • Karma: +75/-1
    • View Profile
Try to burn disks at 2x.
It could also be related to the current functions : there are issues with the current Jo Engine CD functions according to my tests.
You can use the SBL GFS_Load functions (look at RockinB tutorial to see how it works : http://www.rockin-b.de/saturn/saturngametutorial/SaturnGameTutorial.htm ) for now as they are much faster, but it would require you to play with memory allocation (sending everything to Low-work RAM should be the easiest way).

Also, try to use Single plane only on your model.
Trust me, you don't want dual plane except for some rare instances (a quad that you need to be able to see from both sides).

From what I see, there should be no reasons that it can't work at 60 FPS, but like I said you must keep the amount of quads at a reasonable level (400 more or less) and at a rather low texture resolution (16x16 should be fine).

The Saturn is also quite good with untextured quads, so you can play with that too.

SkimmingSanshiro

  • Newbie
  • *
  • Posts: 21
  • Karma: +3/-0
    • View Profile
Yeah single plane I have to touch up my model to correct the quads a bit but defiantly runs better. So I got everything back onscreen lined up and working a bit on gameplay now.

It seems my skimboard sprite only rotates on origin if I draw it at 0,0,0? Trying to rotate it so I can 360 with the board and player together but it rotates along some origin im not sure of when I draw my sprite anywhere else besides 0,0,0

Im draw it like this
jo_3d_draw_sprite_at(6, sonic_pos_x  , sonic_pos_y - 5 , sonic_pos_z + 5  );
jo_3d_rotate_matrix_z(skim2_rot_z);

and rotate like this
skim_rot_z +=7;

Its seems a bit crazy to me as my Player(Sonic/Virtua Kid) its done the same way and it works fine with
jo_3d_translate_matrix    ( sonic_pos_x,sonic_pos_y,sonic_pos_z );
jo_3d_rotate_matrix_z    ( sonic_rot_z) ;

I tried not translating it to sonic_pos and just some coordinates and it still off origin. I also made a 3D model instead of a sprite and it still doing the same thing. Is it something to do with my camera?

Heres a video of me doing a 360 out to a wave and the sprite is rotating on some weird origin.
https://www.youtube.com/watch?v=UJZz8BfGwVY



XL2

  • Sr. Member
  • ****
  • Posts: 343
  • Karma: +75/-1
    • View Profile
I'm not 100% sure I understand your problem.
Try playing with another axis instead (x instead as an exemple), or do the rotation before the translation.
Play with a few settings, I'm sure you'll figure it out.

SkimmingSanshiro

  • Newbie
  • *
  • Posts: 21
  • Karma: +3/-0
    • View Profile
Sorry I'm not the best at explaining. Still having this problem though and think it might be a hardware limitation? Im trying to rotate the sprite of my board located somewhere besides 0,0,0 in the scene and rotating, and it doesn't spin on the right origin like when its located at 0,0,0 in any direction. The rotation with the sprite is so bad to rotate 90 degrees I just redraw it twice where I need it for now. I tried with jo_3d_draw_sprite_at and also jo_sprite_draw3D_and_rotate, etc using jo_3d_rotate_matrix_z(skim_rot_x) to call the rotation.

I made 3d model instead of a sprite and it doesn't have this rotation problem when put anywhere in the scene.

I made a video to show what I mean. The first is the 3d model spinning with me like I want and after the sprite spinning off axis with almost the same code
https://www.youtube.com/watch?v=EeTk8tAr3wo

Edit: Eh forget it Ill just use a 3d model just wanted to keep the polys down. Should I render my planes on the VDP2 i was reading your youtube comments and saw you mention warping with the vdp1 and im getting it bad. Maybe mode 7 for the planes?

« Last Edit: March 13, 2018, 05:06:16 pm by SkimmingSanshiro »

 

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