Author Topic: 3D World, models and animation format.  (Read 5381 times)

Offline dl.zerocool

  • long
  • ***
  • Posts: 104
    • View Profile
3D World, models and animation format.
« on: March 31, 2010, 07:40:08 pm »
Hello,

I have few questions so I started a new topic, perhaps it will help someone else too.

So here are my questions:
Are at the moment all the JPCT features implemented in JPCT-AE (of course features that can run on android) like models, animation, textures etc. support?
What are the recommended/supported format to load a world ? (like in quake3 maps are based on bsp format, but not characters).
" " to load non animated objects ?
" " to load animated objects ?
Are keyframes already implemented or does we have to use things like Bones " http://www.aptalkarga.com/bones/#overview "
What is the correct way to add textures to a model, what are the main advices or tips that we have to follow (texture names?) etc.?
Does JPCT-AE allow 2D drawing, like textures, text etc. ? (To do a personal menu for example).
Does JPCT-AE already include a 3D model selection based on 2D (x,y) point ?

I think I asked them all.
Thanks in advance.

Best regards.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: 3D World, models and animation format.
« Reply #1 on: March 31, 2010, 09:12:34 pm »
Actually, most things from jPCT can be found in jPCT-AE too.

What's missing:

  • Portal rendering (nobody used that and it just cluttered the code)
  • Shadow mapping, projective textures, shaders (because there's only limited hardware and no official software support for these features)
  • Software rendering (pointless on Android)
  • jPCT's hybrid rendering pipeline (too slow on Android)
  • Some minor things related to lighting and colors...

Some classes have moved, some methods have changed slightly. I used the opportunity to simplify some things.

On to your questions:

jPCT-AE uses the same model loaders that jPCT uses, i.e. OBJ, MD2 or 3DS are valid options. However, parsing the files is slow on Dalvik and consumes much memory. This is why AE has an additional loader for a serialized format. This format can be written by the latest desktop jPCT only (get it from the AE-page) via the new DeSerializer class. I suggest to use desktop jPCT to load your models in any format jPCT supports, call build() on all of them (to create the normals so that AE doesn't have to do this again) and serialize it using the DeSerializer. Then load this format in AE. This is the fastest way.

For animated objects, you can use the same procedure. The DeSerializer supports keyframes too. AE supports keyframes in the same way as jPCT. However, keep in mind that the VM is pretty slow and that uploading the animation to the GPU is expensive, so keep your vertex count low.

About adding textures: You can do this in the same way as jPCT does it (you can find more information about this in the wiki) . When using the DeSerializer, the texture names will be serialized with the model. All you have to do to restore them on AE is to add textures with the same names to the TextureManager before loading the model. Order doesn't matter here, just the names have to be equal.

jPCT-AE supports blitting (as discussed in the other thread) via the FrameBuffer. This can be used for blitting overlays, backdrops, menus etc. However, blitting requires vertex uploads to the gpu, which is slow (also discussed in that other thread)...i'm trying to improve this, but i don't expect it to become lightning fast.

jPCT includes some pickPolygon-methods, AE doesn't for some technical reason. However, you can do something similar as described in this thread: http://www.jpct.net/forum2/index.php/topic,1468.0.html. I've added that crude "calcMinDistanceAndObject3D"-method mentioned in the thread to AE, so that you don't have to use CollisionListeners if you don't want to.

Hope this helps!




Offline dl.zerocool

  • long
  • ***
  • Posts: 104
    • View Profile
Re: 3D World, models and animation format.
« Reply #2 on: March 31, 2010, 09:32:52 pm »
Hello,
Thanks for your complete and fast answer!

Yes it does help a lot, and I'm right now going to put all of this in practice.

Just two more questions, keyframes can be extracted from all models (OBJ,MD2,3DS) or only from MD2. (This is what I understood from the features page.
Is there any max poly on screen that is recommended to be able to run the thing on all phones ?
I know that there's a big difference between each phone and this question can be quite difficult to answer.

Thank you.
« Last Edit: March 31, 2010, 09:41:09 pm by dl.zerocool »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: 3D World, models and animation format.
« Reply #3 on: March 31, 2010, 09:44:13 pm »
MD2 already consists of keyframes. When using 3DS or OBJ, each keyframe is an object/file of its own and you have to merge them into an Animation yourself. The wiki contains some information about this (so does the forum, but i can't find the thread right now, because the search function sucks (at least for me)): http://www.jpct.net/wiki/index.php/Loading_3ds_Keyframes_from_Blender

Offline dl.zerocool

  • long
  • ***
  • Posts: 104
    • View Profile
Re: 3D World, models and animation format.
« Reply #4 on: March 31, 2010, 09:49:27 pm »
MD2 already consists of keyframes. When using 3DS or OBJ, each keyframe is an object/file of its own and you have to merge them into an Animation yourself. The wiki contains some information about this (so does the forum, but i can't find the thread right now, because the search function sucks (at least for me)): http://www.jpct.net/wiki/index.php/Loading_3ds_Keyframes_from_Blender
You are awesome, thank you !
I'm sorry that I didn't see it before.